From 8be93fc487064c5b417ab9b0ebd4e027a5e6b9ea Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 17 Nov 2011 08:54:46 -0500 Subject: [PATCH] KWIML: Test header inclusion after system headers Some system headers may define macros that interfere with preprocessor tests in KWIML headers. Test this case to be sure that the verification checks at the bottom of the headers do not fail. --- test/CMakeLists.txt | 2 ++ test/test.c | 4 ++++ test/test_include_C.c | 22 ++++++++++++++++++++++ test/test_include_CXX.cxx | 22 ++++++++++++++++++++++ 4 files changed, 50 insertions(+) create mode 100644 test/test_include_C.c create mode 100644 test/test_include_CXX.cxx diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index febc994531..a2359cce11 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -35,6 +35,7 @@ if(KWIML_LANGUAGE_C) list(APPEND test_srcs test_ABI_C.c test_INT_C.c + test_include_C.c ) endif() if(KWIML_LANGUAGE_CXX) @@ -42,6 +43,7 @@ if(KWIML_LANGUAGE_CXX) list(APPEND test_srcs test_ABI_CXX.cxx test_INT_CXX.cxx + test_include_CXX.cxx ) endif() diff --git a/test/test.c b/test/test.c index d71a28452c..131c81f925 100644 --- a/test/test.c +++ b/test/test.c @@ -16,6 +16,8 @@ extern int test_ABI_C(void); extern int test_INT_C(void); extern int test_ABI_CXX(void); extern int test_INT_CXX(void); +extern int test_include_C(void); +extern int test_include_CXX(void); #ifdef __cplusplus } // extern "C" #endif @@ -26,10 +28,12 @@ int main(void) #ifdef KWIML_LANGUAGE_C result = test_ABI_C() && result; result = test_INT_C() && result; + result = test_include_C() && result; #endif #ifdef KWIML_LANGUAGE_CXX result = test_ABI_CXX() && result; result = test_INT_CXX() && result; + result = test_include_CXX() && result; #endif return result? 0 : 1; } diff --git a/test/test_include_C.c b/test/test_include_C.c new file mode 100644 index 0000000000..fb3e4cf7fe --- /dev/null +++ b/test/test_include_C.c @@ -0,0 +1,22 @@ +/*============================================================================ + Kitware Information Macro Library + Copyright 2010-2011 Kitware, Inc. + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#include + +/* Test KWIML header inclusion after above system headers. */ +#include "test.h" +#include KWIML_HEADER(ABI.h) +#include KWIML_HEADER(INT.h) + +int test_include_C(void) +{ + return 1; +} diff --git a/test/test_include_CXX.cxx b/test/test_include_CXX.cxx new file mode 100644 index 0000000000..057b7c21c6 --- /dev/null +++ b/test/test_include_CXX.cxx @@ -0,0 +1,22 @@ +/*============================================================================ + Kitware Information Macro Library + Copyright 2010-2011 Kitware, Inc. + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#include + +/* Test KWIML header inclusion after above system headers. */ +#include "test.h" +#include KWIML_HEADER(ABI.h) +#include KWIML_HEADER(INT.h) + +extern "C" int test_include_CXX(void) +{ + return 1; +}