From 553acec76b2dc333a418e0218d65dacb76e30a81 Mon Sep 17 00:00:00 2001 From: Brad King Date: Sat, 12 Nov 2011 07:59:53 -0500 Subject: [PATCH 1/5] KWIML: Avoid redefining _CRT_SECURE_NO_DEPRECATE in test.h If the including project defines this macro do not re-define it in the test header. --- test/test.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/test.h b/test/test.h index 8abb1952a..b87a0e7e9 100644 --- a/test/test.h +++ b/test/test.h @@ -28,7 +28,9 @@ #define KWIML_HEADER1(x) /* Quiet MS standard library deprecation warnings. */ -#define _CRT_SECURE_NO_DEPRECATE +#ifndef _CRT_SECURE_NO_DEPRECATE +# define _CRT_SECURE_NO_DEPRECATE +#endif #else # error "test.h included multiple times." From 6d12ab3f897310354bbaffd7a07b0458f489a7df Mon Sep 17 00:00:00 2001 From: Brad King Date: Sat, 12 Nov 2011 09:39:40 -0500 Subject: [PATCH 2/5] KWIML: Suppress printf/scanf format warnings in test KWIML defines format string macros matching the fixed-sized types. This test checks that they behave as expected and that the arguments match the *sizes* expected by the format strings. --- test/CMakeLists.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index aaff9e934..15816cf6f 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -18,6 +18,13 @@ set_property(DIRECTORY "KWIML_HEADER(%)=<${KWIML}/%>" ) +# Suppress printf/scanf format warnings; we test if the sizes match. +foreach(lang C CXX) + if(KWIML_LANGUAGE_${lang} AND "${CMAKE_${lang}_COMPILER_ID}" STREQUAL GNU) + set(CMAKE_${lang}_FLAGS "${CMAKE_${lang}_FLAGS} -Wno-format") + endif() +endforeach() + if(KWIML_LANGUAGE_C) set(test_srcs test.c) else() From bcc06d498ccdc6af80544b415678f4385f99279b Mon Sep 17 00:00:00 2001 From: Brad King Date: Sat, 12 Nov 2011 10:03:33 -0500 Subject: [PATCH 3/5] KWIML: No INT_SCN*8 on SunPro compiler The Sun compiler does not document support for SCN*8 format (%hh*). It works only on platforms that happen to provide a runtime library that supports the format. --- INT.h.in | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/INT.h.in b/INT.h.in index 4a6298a70..5fca08f02 100644 --- a/INT.h.in +++ b/INT.h.in @@ -191,9 +191,7 @@ An includer may test the following macros after inclusion: #endif #if defined(__INTEL_COMPILER) -#elif defined(__SUNPRO_C) && __SUNPRO_C < 0x570 -# define @KWIML@_INT__NO_SCN8 -#elif defined(__SUNPRO_CC) && __SUNPRO_CC < 0x570 +#elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) # define @KWIML@_INT__NO_SCN8 #elif defined(__HP_cc) || defined(__HP_aCC) # define @KWIML@_INT__NO_SCN8 From 33fff24aca46c4eca17997c42c5f62d71666b836 Mon Sep 17 00:00:00 2001 From: Brad King Date: Sun, 13 Nov 2011 15:03:15 -0500 Subject: [PATCH 4/5] KWIML: No INT_SCN*8 on Intel for Windows Intel C/C++ for Windows does not support the SCN*8 format (%hh*). The MS runtime does not support it. --- INT.h.in | 3 +++ 1 file changed, 3 insertions(+) diff --git a/INT.h.in b/INT.h.in index 5fca08f02..3c1f05dc4 100644 --- a/INT.h.in +++ b/INT.h.in @@ -191,6 +191,9 @@ An includer may test the following macros after inclusion: #endif #if defined(__INTEL_COMPILER) +# if defined(_WIN32) +# define @KWIML@_INT__NO_SCN8 +# endif #elif defined(__SUNPRO_C) || defined(__SUNPRO_CC) # define @KWIML@_INT__NO_SCN8 #elif defined(__HP_cc) || defined(__HP_aCC) From a8f6159f69dbfdacf4d48ff26f21862d83fa7fd8 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 14 Nov 2011 07:53:06 -0500 Subject: [PATCH 5/5] KWIML: Create test output dir for Xcode Xcode 2.x forgets to create the target output directory before linking the individual architecture pieces of a universal binary for the target KWIML_test. Then it passes the directory to -L and -F options when linking the and warns that the directory does not exist. We work around the problem by using a pre-build rule on the target to create the output directory. --- test/CMakeLists.txt | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 15816cf6f..febc99453 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -56,3 +56,13 @@ set_property(TARGET ${KWIML}_test PROPERTY RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) add_test(${KWIML}.test ${CMAKE_CURRENT_BINARY_DIR}/${KWIML}_test) set_property(TEST ${KWIML}.test PROPERTY LABELS ${KWIML_LABELS_TEST}) + +# Xcode 2.x forgets to create the output directory before linking +# the individual architectures. +if(CMAKE_OSX_ARCHITECTURES AND XCODE + AND NOT "${XCODE_VERSION}" MATCHES "^[^12]") + add_custom_command( + TARGET ${KWIML}_test + PRE_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory "${CMAKE_CFG_INTDIR}" + ) +endif()