diff options
author | Brad King <brad.king@kitware.com> | 2009-11-20 13:38:18 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2009-11-20 13:38:18 (GMT) |
commit | bbbdf54a3569aa97687091b7d6a03d645f8dabcb (patch) | |
tree | abb7ebe12ffea0c399d297a29008949bf2d7df08 /Source/kwsys/kwsysPlatformTestsC.c | |
parent | 1136b97647ddd5b3eb77122494ee47fa3026a97e (diff) | |
download | CMake-bbbdf54a3569aa97687091b7d6a03d645f8dabcb.zip CMake-bbbdf54a3569aa97687091b7d6a03d645f8dabcb.tar.gz CMake-bbbdf54a3569aa97687091b7d6a03d645f8dabcb.tar.bz2 |
Fix KWSys FundamentalType for Universal Binaries
The FundamentalType header needs to know type sizes at preprocessing
time. This commit teaches it to avoid using CHECK_TYPE_SIZE because the
macro does not work for types whose size varies across architectuers in
Mac OS X universal binaries. Fortunately the Mac compilers provide just
enough information to detect the needed type sizes during preprocessing.
We now use preprocessor macros instead of configuration tests whenever
they are available. As a side effect this reduces the number of
try-compiles needed with GCC.
See issue #9913.
Diffstat (limited to 'Source/kwsys/kwsysPlatformTestsC.c')
-rw-r--r-- | Source/kwsys/kwsysPlatformTestsC.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/Source/kwsys/kwsysPlatformTestsC.c b/Source/kwsys/kwsysPlatformTestsC.c index 0d26347..e602964 100644 --- a/Source/kwsys/kwsysPlatformTestsC.c +++ b/Source/kwsys/kwsysPlatformTestsC.c @@ -60,3 +60,41 @@ int KWSYS_PLATFORM_TEST_C_MAIN() return f(n); } #endif + +/*--------------------------------------------------------------------------*/ +#ifdef TEST_KWSYS_C_TYPE_MACROS +char* info_macros = +#if defined(__SIZEOF_SHORT__) +"INFO:macro[__SIZEOF_SHORT__]\n" +#endif +#if defined(__SIZEOF_INT__) +"INFO:macro[__SIZEOF_INT__]\n" +#endif +#if defined(__SIZEOF_LONG__) +"INFO:macro[__SIZEOF_LONG__]\n" +#endif +#if defined(__SIZEOF_LONG_LONG__) +"INFO:macro[__SIZEOF_LONG_LONG__]\n" +#endif +#if defined(__SHORT_MAX__) +"INFO:macro[__SHORT_MAX__]\n" +#endif +#if defined(__INT_MAX__) +"INFO:macro[__INT_MAX__]\n" +#endif +#if defined(__LONG_MAX__) +"INFO:macro[__LONG_MAX__]\n" +#endif +#if defined(__LONG_LONG_MAX__) +"INFO:macro[__LONG_LONG_MAX__]\n" +#endif + ""; + +int KWSYS_PLATFORM_TEST_C_MAIN_ARGS(argc, argv) +{ + int require = 0; + require += info_macros[argc]; + (void)argv; + return require; +} +#endif |