Resync
[CMakeLuaTailorHgBridge.git] / CMakeLua / Source / kwsys / kwsysPlatformTestsC.c
blob58b22f3a56744dbc326dd35441fb8cc669cbf024
1 /*
2 Macros to define main() in a cross-platform way.
4 Usage:
6 int KWSYS_PLATFORM_TEST_C_MAIN()
8 return 0;
11 int KWSYS_PLATFORM_TEST_C_MAIN_ARGS(argc, argv)
13 (void)argc; (void)argv;
14 return 0;
17 #if defined(__CLASSIC_C__)
18 # define KWSYS_PLATFORM_TEST_C_MAIN() \
19 main()
20 # define KWSYS_PLATFORM_TEST_C_MAIN_ARGS(argc, argv) \
21 main(argc,argv) int argc; char* argv[];
22 #else
23 # define KWSYS_PLATFORM_TEST_C_MAIN() \
24 main(void)
25 # define KWSYS_PLATFORM_TEST_C_MAIN_ARGS(argc, argv) \
26 main(int argc, char* argv[])
27 #endif
29 /*--------------------------------------------------------------------------*/
30 #ifdef TEST_KWSYS_C_HAS_PTRDIFF_T
31 #include <stddef.h>
32 int f(ptrdiff_t n) { return n > 0; }
33 int KWSYS_PLATFORM_TEST_C_MAIN()
35 char* p = 0;
36 ptrdiff_t d = p - p;
37 (void)d;
38 return f(p - p);
40 #endif
42 /*--------------------------------------------------------------------------*/
43 #ifdef TEST_KWSYS_C_HAS_SSIZE_T
44 #include <unistd.h>
45 int f(ssize_t n) { return (int)n; }
46 int KWSYS_PLATFORM_TEST_C_MAIN()
48 ssize_t n = 0;
49 return f(n);
51 #endif