if(NOT TEST_COMPILE_ONLY)
message(STATUS "Finding valid architectures for ${os}...")
set(SIMPLE_C ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/src.c)
- file(WRITE ${SIMPLE_C} "#include <stdio.h>\nint main() { printf(__FILE__); return 0; }\n")
+ file(WRITE ${SIMPLE_C} "#include <stdio.h>\nint main(void) { printf(__FILE__); return 0; }\n")
set(os_linker_flags)
foreach(flag ${DARWIN_${os}_LINK_FLAGS})
# runtime libraries supported by our current compilers cross-compiling
# abilities.
set(SIMPLE_SOURCE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/simple.cc)
-file(WRITE ${SIMPLE_SOURCE} "#include <stdlib.h>\n#include <stdio.h>\nint main() { printf(\"hello, world\"); }\n")
+file(WRITE ${SIMPLE_SOURCE} "#include <stdlib.h>\n#include <stdio.h>\nint main(void) { printf(\"hello, world\"); }\n")
# Detect whether the current target platform is 32-bit or 64-bit, and setup
# the correct commandline flags needed to attempt to target 32-bit and 64-bit.
SOURCE "#if !(__ARM_FP & 0x8)
#error No double-precision support!
#endif
- int main() { return 0; }")
+ int main(void) { return 0; }")
if(NOT COMPILER_RT_HAS_${arch}_VFP_DP)
list(REMOVE_ITEM ${arch}_SOURCES ${arm_Thumb1_VFPv2_DP_SOURCES})
endif()
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Werror=unknown-pragmas")
check_c_source_compiles("
#pragma comment(lib, \"c\")
-int main() { return 0; }
+int main(void) { return 0; }
" C_SUPPORTS_COMMENT_LIB_PRAGMA)
cmake_pop_check_state()
endif()
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Werror=unknown-pragmas")
check_c_source_compiles("
#pragma comment(lib, \"c\")
-int main() { return 0; }
+int main(void) { return 0; }
" C_SUPPORTS_COMMENT_LIB_PRAGMA)
cmake_pop_check_state()
endif()
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Werror=unknown-pragmas")
check_c_source_compiles("
#pragma comment(lib, \"c\")
-int main() { return 0; }
+int main(void) { return 0; }
" C_SUPPORTS_COMMENT_LIB_PRAGMA)
cmake_pop_check_state()
endif()
#else
#error Not building for ARM64
#endif
- int main() { return 0; }
+ int main(void) { return 0; }
"
BUILDING_FOR_ARM64_OSX
)
CHECK_C_SOURCE_COMPILES("
static const char *__crashreporter_info__ = 0;
asm(\".desc ___crashreporter_info__, 0x10\");
- int main() { return 0; }"
+ int main(void) { return 0; }"
HAVE_CRASHREPORTER_INFO)
endif()
struct ffi_cif;
typedef struct ffi_cif ffi_cif;
void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue);
- int main() { ffi_call(0, 0, 0, 0); }"
+ int main(void) { ffi_call(0, 0, 0, 0); }"
HAVE_FFI_CALL)
cmake_pop_check_state()
endif()
list(APPEND CMAKE_REQUIRED_LIBRARIES ${Terminfo_LIBRARIES})
check_c_source_compiles("
int setupterm(char *term, int filedes, int *errret);
- int main() { return setupterm(0, 0, 0); }"
+ int main(void) { return setupterm(0, 0, 0); }"
Terminfo_LINKABLE)
cmake_pop_check_state()
endif()
# The program that will be executed to print Z3's version.
file(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testz3.cpp
"#include <assert.h>
+ #include <stdio.h>
#include <z3.h>
- int main() {
+ int main(void) {
unsigned int major, minor, build, rev;
Z3_get_version(&major, &minor, &build, &rev);
printf(\"%u.%u.%u\", major, minor, build);
# line is also a // comment.
set(OLD_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Werror -Wcomment")
- CHECK_C_SOURCE_COMPILES("// \\\\\\n//\\nint main() {return 0;}"
+ CHECK_C_SOURCE_COMPILES("// \\\\\\n//\\nint main(void) {return 0;}"
C_WCOMMENT_ALLOWS_LINE_WRAP)
set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
if (NOT C_WCOMMENT_ALLOWS_LINE_WRAP)
void func2() { printf(\"World\"); }
__asm__(\".symver func1, func@VER1\");
__asm__(\".symver func2, func@VER2\");
- int main() {
+ int main(void) {
func1();
func2();
return 0;
check_c_source_compiles("
${_includes}
${_type} typeVar;
- int main() {
+ int main(void) {
return 0;
}
" ${_variable})
check_c_source_compiles("
int func(void) __attribute__((__warn_unused_result__));
- int main() { return 0; }
+ int main(void) { return 0; }
" HAS_ATTRIBUTE_WARN_UNUSED_RESULT)
set(GCC_WARN_UNUSED_RESULT)
if (HAS_ATTRIBUTE_WARN_UNUSED_RESULT)
check_c_source_compiles("
__attribute__ ((unused)) static void foo(void);
- int main() { return 0; }
+ int main(void) { return 0; }
" HAVE___ATTRIBUTE__)
check_c_source_compiles_numeric("
#include <strings.h>
- int main() { (void)ffs(0); return 0; }
+ int main(void) { (void)ffs(0); return 0; }
" HAVE_DECL_FFS)
check_c_source_compiles_numeric("
- int main() { (void)__builtin_ffs(0); return 0; }
+ int main(void) { (void)__builtin_ffs(0); return 0; }
" HAVE_DECL___BUILTIN_FFS)
check_c_source_compiles_numeric("
#include <intrin.h>
- int main() { (void)_BitScanForward(NULL, 0); return 0; }
+ int main(void) { (void)_BitScanForward(NULL, 0); return 0; }
" HAVE_DECL__BITSCANFORWARD)
if (NOT HAVE_DECL_FFS AND
check_c_source_compiles_numeric("
#include <strings.h>
- int main() { (void)strcasecmp(\"\", \"\"); return 0; }
+ int main(void) { (void)strcasecmp(\"\", \"\"); return 0; }
" HAVE_DECL_STRCASECMP)
check_c_source_compiles_numeric("
#include <string.h>
- int main() { (void)_stricmp(\"\", \"\"); return 0; }
+ int main(void) { (void)_stricmp(\"\", \"\"); return 0; }
" HAVE_DECL__STRICMP)
if (NOT HAVE_DECL_STRCASECMP AND NOT HAVE_DECL__STRICMP)
check_c_source_compiles_numeric("
#include <strings.h>
- int main() { (void)strncasecmp(\"\", \"\", 0); return 0; }
+ int main(void) { (void)strncasecmp(\"\", \"\", 0); return 0; }
" HAVE_DECL_STRNCASECMP)
check_c_source_compiles_numeric("
#include <string.h>
- int main() { (void)_strnicmp(\"\", \"\", 0); return 0; }
+ int main(void) { (void)_strnicmp(\"\", \"\", 0); return 0; }
" HAVE_DECL__STRNICMP)
if (NOT HAVE_DECL_STRNCASECMP AND NOT HAVE_DECL__STRNICMP)
check_c_source_compiles_numeric("
#include <stdio.h>
- int main() { snprintf((void*)0, 0, \" \"); return 0; }
+ int main(void) { snprintf((void*)0, 0, \" \"); return 0; }
" HAVE_DECL_SNPRINTF)
check_c_source_compiles_numeric("
#include <stdio.h>
- int main() { _snprintf((void*)0, 0, \" \"); return 0; }
+ int main(void) { _snprintf((void*)0, 0, \" \"); return 0; }
" HAVE_DECL__SNPRINTF)
if (NOT HAVE_DECL_SNPRINTF AND NOT HAVE_DECL__SNPRINTF)