From 73f909930e2743c045c408e20ac20aca2570bf97 Mon Sep 17 00:00:00 2001 From: David Wells Date: Fri, 30 Nov 2018 14:52:34 -0500 Subject: [PATCH] Add a header that undefines macros. Some other projects, notably gtest, also define a macro named Assert. This new header allows for one to use gtest with deal.II by undefining all deal.II macros. --- .../incompatibilities/20181130DavidWells | 5 + doc/news/changes/minor/20181130DavidWells | 5 + include/deal.II/base/exceptions.h | 298 ++++++++++++++++++ include/deal.II/base/undefine_macros.h | 111 +++++++ tests/base/assertion_macros.cc | 173 ++++++++++ tests/base/assertion_macros.output | 2 + 6 files changed, 594 insertions(+) create mode 100644 doc/news/changes/incompatibilities/20181130DavidWells create mode 100644 doc/news/changes/minor/20181130DavidWells create mode 100644 include/deal.II/base/undefine_macros.h create mode 100644 tests/base/assertion_macros.cc create mode 100644 tests/base/assertion_macros.output diff --git a/doc/news/changes/incompatibilities/20181130DavidWells b/doc/news/changes/incompatibilities/20181130DavidWells new file mode 100644 index 0000000000..ec05805b74 --- /dev/null +++ b/doc/news/changes/incompatibilities/20181130DavidWells @@ -0,0 +1,5 @@ +Changed: The particle MPI datatype macro PARTICLE_INDEX_MPI_TYPE is +now properly namespaced: its new name is +DEAL_II_PARTICLE_INDEX_MPI_TYPE. +
+(David Wells, 2018/11/30) diff --git a/doc/news/changes/minor/20181130DavidWells b/doc/news/changes/minor/20181130DavidWells new file mode 100644 index 0000000000..7c588398a5 --- /dev/null +++ b/doc/news/changes/minor/20181130DavidWells @@ -0,0 +1,5 @@ +New: A new header deal.II/base/undefine_macros.h has been +added. This header, as the name suggests, undefines all deal.II macros that are +not prefixed with either DEAL or deal. +
+(David Wells, 2018/11/30) diff --git a/include/deal.II/base/exceptions.h b/include/deal.II/base/exceptions.h index 3a9be34422..9c1cd2e8cf 100644 --- a/include/deal.II/base/exceptions.h +++ b/include/deal.II/base/exceptions.h @@ -180,6 +180,17 @@ private: /** * Declare an exception class derived from ExceptionBase without parameters. * + * @note This and similar macro names are examples of preprocessor definitions + * in the deal.II library that are not prefixed by a string that likely makes + * them unique to deal.II. As a consequence, it is possible that other + * libraries your code interfaces with define the same name, and the result + * will be name collisions (see + * https://en.wikipedia.org/wiki/Name_collision). One can #undef + * this macro, as well as all other macros defined by deal.II that are not + * prefixed with either DEAL or deal, by including + * the header deal.II/base/undefine_macros.h after all other + * deal.II headers have been included. + * * @author Wolfgang Bangerth, November 1997 * @ingroup Exceptions */ @@ -194,6 +205,17 @@ private: * the exception, it simply reverts to the default text provided when * declaring the exception class through this macro. * + * @note This and similar macro names are examples of preprocessor definitions + * in the deal.II library that are not prefixed by a string that likely makes + * them unique to deal.II. As a consequence, it is possible that other + * libraries your code interfaces with define the same name, and the result + * will be name collisions (see + * https://en.wikipedia.org/wiki/Name_collision). One can #undef + * this macro, as well as all other macros defined by deal.II that are not + * prefixed with either DEAL or deal, by including + * the header deal.II/base/undefine_macros.h after all other + * deal.II headers have been included. + * * @ingroup Exceptions */ # define DeclExceptionMsg(Exception, defaulttext) \ @@ -219,6 +241,17 @@ private: * Declare an exception class derived from ExceptionBase with one additional * parameter. * + * @note This and similar macro names are examples of preprocessor definitions + * in the deal.II library that are not prefixed by a string that likely makes + * them unique to deal.II. As a consequence, it is possible that other + * libraries your code interfaces with define the same name, and the result + * will be name collisions (see + * https://en.wikipedia.org/wiki/Name_collision). One can #undef + * this macro, as well as all other macros defined by deal.II that are not + * prefixed with either DEAL or deal, by including + * the header deal.II/base/undefine_macros.h after all other + * deal.II headers have been included. + * * @ingroup Exceptions */ # define DeclException1(Exception1, type1, outsequence) \ @@ -245,6 +278,17 @@ private: * Declare an exception class derived from ExceptionBase with two additional * parameters. * + * @note This and similar macro names are examples of preprocessor definitions + * in the deal.II library that are not prefixed by a string that likely makes + * them unique to deal.II. As a consequence, it is possible that other + * libraries your code interfaces with define the same name, and the result + * will be name collisions (see + * https://en.wikipedia.org/wiki/Name_collision). One can #undef + * this macro, as well as all other macros defined by deal.II that are not + * prefixed with either DEAL or deal, by including + * the header deal.II/base/undefine_macros.h after all other + * deal.II headers have been included. + * * @ingroup Exceptions */ # define DeclException2(Exception2, type1, type2, outsequence) \ @@ -273,6 +317,17 @@ private: * Declare an exception class derived from ExceptionBase with three additional * parameters. * + * @note This and similar macro names are examples of preprocessor definitions + * in the deal.II library that are not prefixed by a string that likely makes + * them unique to deal.II. As a consequence, it is possible that other + * libraries your code interfaces with define the same name, and the result + * will be name collisions (see + * https://en.wikipedia.org/wiki/Name_collision). One can #undef + * this macro, as well as all other macros defined by deal.II that are not + * prefixed with either DEAL or deal, by including + * the header deal.II/base/undefine_macros.h after all other + * deal.II headers have been included. + * * @ingroup Exceptions */ # define DeclException3(Exception3, type1, type2, type3, outsequence) \ @@ -303,6 +358,17 @@ private: * Declare an exception class derived from ExceptionBase with four additional * parameters. * + * @note This and similar macro names are examples of preprocessor definitions + * in the deal.II library that are not prefixed by a string that likely makes + * them unique to deal.II. As a consequence, it is possible that other + * libraries your code interfaces with define the same name, and the result + * will be name collisions (see + * https://en.wikipedia.org/wiki/Name_collision). One can #undef + * this macro, as well as all other macros defined by deal.II that are not + * prefixed with either DEAL or deal, by including + * the header deal.II/base/undefine_macros.h after all other + * deal.II headers have been included. + * * @ingroup Exceptions */ # define DeclException4(Exception4, type1, type2, type3, type4, outsequence) \ @@ -338,6 +404,17 @@ private: * Declare an exception class derived from ExceptionBase with five additional * parameters. * + * @note This and similar macro names are examples of preprocessor definitions + * in the deal.II library that are not prefixed by a string that likely makes + * them unique to deal.II. As a consequence, it is possible that other + * libraries your code interfaces with define the same name, and the result + * will be name collisions (see + * https://en.wikipedia.org/wiki/Name_collision). One can #undef + * this macro, as well as all other macros defined by deal.II that are not + * prefixed with either DEAL or deal, by including + * the header deal.II/base/undefine_macros.h after all other + * deal.II headers have been included. + * * @ingroup Exceptions */ # define DeclException5( \ @@ -379,6 +456,17 @@ private: /** * Declare an exception class derived from ExceptionBase without parameters. * + * @note This and similar macro names are examples of preprocessor definitions + * in the deal.II library that are not prefixed by a string that likely makes + * them unique to deal.II. As a consequence, it is possible that other + * libraries your code interfaces with define the same name, and the result + * will be name collisions (see + * https://en.wikipedia.org/wiki/Name_collision). One can #undef + * this macro, as well as all other macros defined by deal.II that are not + * prefixed with either DEAL or deal, by including + * the header deal.II/base/undefine_macros.h after all other + * deal.II headers have been included. + * * @author Wolfgang Bangerth, November 1997 * @ingroup Exceptions */ @@ -392,6 +480,17 @@ private: * the exception, it simply reverts to the default text provided when * declaring the exception class through this macro. * + * @note This and similar macro names are examples of preprocessor definitions + * in the deal.II library that are not prefixed by a string that likely makes + * them unique to deal.II. As a consequence, it is possible that other + * libraries your code interfaces with define the same name, and the result + * will be name collisions (see + * https://en.wikipedia.org/wiki/Name_collision). One can #undef + * this macro, as well as all other macros defined by deal.II that are not + * prefixed with either DEAL or deal, by including + * the header deal.II/base/undefine_macros.h after all other + * deal.II headers have been included. + * * @ingroup Exceptions */ # define DeclExceptionMsg(Exception, defaulttext) \ @@ -403,6 +502,17 @@ private: * Declare an exception class derived from ExceptionBase with one additional * parameter. * + * @note This and similar macro names are examples of preprocessor definitions + * in the deal.II library that are not prefixed by a string that likely makes + * them unique to deal.II. As a consequence, it is possible that other + * libraries your code interfaces with define the same name, and the result + * will be name collisions (see + * https://en.wikipedia.org/wiki/Name_collision). One can #undef + * this macro, as well as all other macros defined by deal.II that are not + * prefixed with either DEAL or deal, by including + * the header deal.II/base/undefine_macros.h after all other + * deal.II headers have been included. + * * @ingroup Exceptions */ # define DeclException1(Exception1, type1, outsequence) \ @@ -415,6 +525,17 @@ private: * Declare an exception class derived from ExceptionBase with two additional * parameters. * + * @note This and similar macro names are examples of preprocessor definitions + * in the deal.II library that are not prefixed by a string that likely makes + * them unique to deal.II. As a consequence, it is possible that other + * libraries your code interfaces with define the same name, and the result + * will be name collisions (see + * https://en.wikipedia.org/wiki/Name_collision). One can #undef + * this macro, as well as all other macros defined by deal.II that are not + * prefixed with either DEAL or deal, by including + * the header deal.II/base/undefine_macros.h after all other + * deal.II headers have been included. + * * @ingroup Exceptions */ # define DeclException2(Exception2, type1, type2, outsequence) \ @@ -427,6 +548,17 @@ private: * Declare an exception class derived from ExceptionBase with three additional * parameters. * + * @note This and similar macro names are examples of preprocessor definitions + * in the deal.II library that are not prefixed by a string that likely makes + * them unique to deal.II. As a consequence, it is possible that other + * libraries your code interfaces with define the same name, and the result + * will be name collisions (see + * https://en.wikipedia.org/wiki/Name_collision). One can #undef + * this macro, as well as all other macros defined by deal.II that are not + * prefixed with either DEAL or deal, by including + * the header deal.II/base/undefine_macros.h after all other + * deal.II headers have been included. + * * @ingroup Exceptions */ # define DeclException3(Exception3, type1, type2, type3, outsequence) \ @@ -439,6 +571,17 @@ private: * Declare an exception class derived from ExceptionBase with four additional * parameters. * + * @note This and similar macro names are examples of preprocessor definitions + * in the deal.II library that are not prefixed by a string that likely makes + * them unique to deal.II. As a consequence, it is possible that other + * libraries your code interfaces with define the same name, and the result + * will be name collisions (see + * https://en.wikipedia.org/wiki/Name_collision). One can #undef + * this macro, as well as all other macros defined by deal.II that are not + * prefixed with either DEAL or deal, by including + * the header deal.II/base/undefine_macros.h after all other + * deal.II headers have been included. + * * @ingroup Exceptions */ # define DeclException4(Exception4, type1, type2, type3, type4, outsequence) \ @@ -454,6 +597,17 @@ private: * Declare an exception class derived from ExceptionBase with five additional * parameters. * + * @note This and similar macro names are examples of preprocessor definitions + * in the deal.II library that are not prefixed by a string that likely makes + * them unique to deal.II. As a consequence, it is possible that other + * libraries your code interfaces with define the same name, and the result + * will be name collisions (see + * https://en.wikipedia.org/wiki/Name_collision). One can #undef + * this macro, as well as all other macros defined by deal.II that are not + * prefixed with either DEAL or deal, by including + * the header deal.II/base/undefine_macros.h after all other + * deal.II headers have been included. + * * @ingroup Exceptions */ # define DeclException5( \ @@ -1233,6 +1387,18 @@ namespace deal_II_exceptions * See also the ExceptionBase class for more information. * * @note Active in DEBUG mode only + * + * @note This and similar macro names are examples of preprocessor definitions + * in the deal.II library that are not prefixed by a string that likely makes + * them unique to deal.II. As a consequence, it is possible that other + * libraries your code interfaces with define the same name, and the result + * will be name collisions (see + * https://en.wikipedia.org/wiki/Name_collision). One can #undef + * this macro, as well as all other macros defined by deal.II that are not + * prefixed with either DEAL or deal, by including + * the header deal.II/base/undefine_macros.h after all other + * deal.II headers have been included. + * * @ingroup Exceptions * @author Wolfgang Bangerth, 1997, 1998, Matthias Maier, 2013 */ @@ -1285,6 +1451,17 @@ namespace deal_II_exceptions * @ref Exceptions * module, in the discussion about the corner case at the bottom of the page. * + * @note This and similar macro names are examples of preprocessor definitions + * in the deal.II library that are not prefixed by a string that likely makes + * them unique to deal.II. As a consequence, it is possible that other + * libraries your code interfaces with define the same name, and the result + * will be name collisions (see + * https://en.wikipedia.org/wiki/Name_collision). One can #undef + * this macro, as well as all other macros defined by deal.II that are not + * prefixed with either DEAL or deal, by including + * the header deal.II/base/undefine_macros.h after all other + * deal.II headers have been included. + * * @note Active in DEBUG mode only * @ingroup Exceptions * @author Wolfgang Bangerth, 1997, 1998, Matthias Maier, 2013 @@ -1323,6 +1500,17 @@ namespace deal_II_exceptions * module. It is first used in step-9 and step-13. * See also the ExceptionBase class for more information. * + * @note This and similar macro names are examples of preprocessor definitions + * in the deal.II library that are not prefixed by a string that likely makes + * them unique to deal.II. As a consequence, it is possible that other + * libraries your code interfaces with define the same name, and the result + * will be name collisions (see + * https://en.wikipedia.org/wiki/Name_collision). One can #undef + * this macro, as well as all other macros defined by deal.II that are not + * prefixed with either DEAL or deal, by including + * the header deal.II/base/undefine_macros.h after all other + * deal.II headers have been included. + * * @note Active in both DEBUG and RELEASE modes * @ingroup Exceptions * @author Wolfgang Bangerth, 1997, 1998, Matthias Maier, 2013 @@ -1362,6 +1550,17 @@ namespace deal_II_exceptions * introduce this special assertion for ExcDimensionMismatch in order to keep * the user codes shorter. * + * @note This and similar macro names are examples of preprocessor definitions + * in the deal.II library that are not prefixed by a string that likely makes + * them unique to deal.II. As a consequence, it is possible that other + * libraries your code interfaces with define the same name, and the result + * will be name collisions (see + * https://en.wikipedia.org/wiki/Name_collision). One can #undef + * this macro, as well as all other macros defined by deal.II that are not + * prefixed with either DEAL or deal, by including + * the header deal.II/base/undefine_macros.h after all other + * deal.II headers have been included. + * * @ingroup Exceptions * @author Guido Kanschat 2007 */ @@ -1373,6 +1572,17 @@ namespace deal_II_exceptions * An assertion that tests whether vec has size dim1, and * each entry of the vector is itself an array that has the size dim2. * + * @note This and similar macro names are examples of preprocessor definitions + * in the deal.II library that are not prefixed by a string that likely makes + * them unique to deal.II. As a consequence, it is possible that other + * libraries your code interfaces with define the same name, and the result + * will be name collisions (see + * https://en.wikipedia.org/wiki/Name_collision). One can #undef + * this macro, as well as all other macros defined by deal.II that are not + * prefixed with either DEAL or deal, by including + * the header deal.II/base/undefine_macros.h after all other + * deal.II headers have been included. + * * @ingroup Exceptions * @author Guido Kanschat 2010 */ @@ -1403,6 +1613,17 @@ namespace internal * ExcIndexRange(index,0,range) if the assertion * fails. * + * @note This and similar macro names are examples of preprocessor definitions + * in the deal.II library that are not prefixed by a string that likely makes + * them unique to deal.II. As a consequence, it is possible that other + * libraries your code interfaces with define the same name, and the result + * will be name collisions (see + * https://en.wikipedia.org/wiki/Name_collision). One can #undef + * this macro, as well as all other macros defined by deal.II that are not + * prefixed with either DEAL or deal, by including + * the header deal.II/base/undefine_macros.h after all other + * deal.II headers have been included. + * * @ingroup Exceptions * @author Guido Kanschat, Daniel Arndt, 2007, 2018 */ @@ -1424,6 +1645,17 @@ namespace internal * (see there for an explanation of why we use std::complex at all) and to * satisfy the fact that std::complex has no implicit conversions. * + * @note This and similar macro names are examples of preprocessor definitions + * in the deal.II library that are not prefixed by a string that likely makes + * them unique to deal.II. As a consequence, it is possible that other + * libraries your code interfaces with define the same name, and the result + * will be name collisions (see + * https://en.wikipedia.org/wiki/Name_collision). One can #undef + * this macro, as well as all other macros defined by deal.II that are not + * prefixed with either DEAL or deal, by including + * the header deal.II/base/undefine_macros.h after all other + * deal.II headers have been included. + * * @ingroup Exceptions * @author Wolfgang Bangerth, 2015 */ @@ -1438,6 +1670,17 @@ namespace internal * exception of type ExcMPI is thrown with the given error code as an * argument. * + * @note This and similar macro names are examples of preprocessor definitions + * in the deal.II library that are not prefixed by a string that likely makes + * them unique to deal.II. As a consequence, it is possible that other + * libraries your code interfaces with define the same name, and the result + * will be name collisions (see + * https://en.wikipedia.org/wiki/Name_collision). One can #undef + * this macro, as well as all other macros defined by deal.II that are not + * prefixed with either DEAL or deal, by including + * the header deal.II/base/undefine_macros.h after all other + * deal.II headers have been included. + * * @note Active only if deal.II is compiled with MPI * @ingroup Exceptions * @author David Wells, 2016 @@ -1454,6 +1697,17 @@ namespace internal * An assertion that checks that the error code produced by calling a CUDA * routine is equal to cudaSuccess. * + * @note This and similar macro names are examples of preprocessor definitions + * in the deal.II library that are not prefixed by a string that likely makes + * them unique to deal.II. As a consequence, it is possible that other + * libraries your code interfaces with define the same name, and the result + * will be name collisions (see + * https://en.wikipedia.org/wiki/Name_collision). One can #undef + * this macro, as well as all other macros defined by deal.II that are not + * prefixed with either DEAL or deal, by including + * the header deal.II/base/undefine_macros.h after all other + * deal.II headers have been included. + * * @ingroup Exceptions * @author Bruno Turcksin, 2016 */ @@ -1471,6 +1725,17 @@ namespace internal /** * The non-throwing equivalent of AssertCuda. * + * @note This and similar macro names are examples of preprocessor definitions + * in the deal.II library that are not prefixed by a string that likely makes + * them unique to deal.II. As a consequence, it is possible that other + * libraries your code interfaces with define the same name, and the result + * will be name collisions (see + * https://en.wikipedia.org/wiki/Name_collision). One can #undef + * this macro, as well as all other macros defined by deal.II that are not + * prefixed with either DEAL or deal, by including + * the header deal.II/base/undefine_macros.h after all other + * deal.II headers have been included. + * * @ingroup Exceptions * @author Daniel Arndt, 2018 */ @@ -1489,6 +1754,17 @@ namespace internal * An assertion that checks that the error code produced by calling a cuSPARSE * routine is equal to CUSPARSE_STATUS_SUCCESS. * + * @note This and similar macro names are examples of preprocessor definitions + * in the deal.II library that are not prefixed by a string that likely makes + * them unique to deal.II. As a consequence, it is possible that other + * libraries your code interfaces with define the same name, and the result + * will be name collisions (see + * https://en.wikipedia.org/wiki/Name_collision). One can #undef + * this macro, as well as all other macros defined by deal.II that are not + * prefixed with either DEAL or deal, by including + * the header deal.II/base/undefine_macros.h after all other + * deal.II headers have been included. + * * @ingroup Exceptions * @author Bruno Turcksin, 2018 */ @@ -1509,6 +1785,17 @@ namespace internal /** * The non-throwing equivalent of AssertCusparse. * + * @note This and similar macro names are examples of preprocessor definitions + * in the deal.II library that are not prefixed by a string that likely makes + * them unique to deal.II. As a consequence, it is possible that other + * libraries your code interfaces with define the same name, and the result + * will be name collisions (see + * https://en.wikipedia.org/wiki/Name_collision). One can #undef + * this macro, as well as all other macros defined by deal.II that are not + * prefixed with either DEAL or deal, by including + * the header deal.II/base/undefine_macros.h after all other + * deal.II headers have been included. + * * @ingroup Exceptions * @author Daniel Arndt, 2018 */ @@ -1530,6 +1817,17 @@ namespace internal * An assertion that checks that the error code produced by calling a cuSOLVER * routine is equal to CUSOLVER_STATUS_SUCCESS. * + * @note This and similar macro names are examples of preprocessor definitions + * in the deal.II library that are not prefixed by a string that likely makes + * them unique to deal.II. As a consequence, it is possible that other + * libraries your code interfaces with define the same name, and the result + * will be name collisions (see + * https://en.wikipedia.org/wiki/Name_collision). One can #undef + * this macro, as well as all other macros defined by deal.II that are not + * prefixed with either DEAL or deal, by including + * the header deal.II/base/undefine_macros.h after all other + * deal.II headers have been included. + * * @ingroup Exceptions * @author Bruno Turcksin, 2018 */ diff --git a/include/deal.II/base/undefine_macros.h b/include/deal.II/base/undefine_macros.h new file mode 100644 index 0000000000..9178ae3313 --- /dev/null +++ b/include/deal.II/base/undefine_macros.h @@ -0,0 +1,111 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2018 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE.md at +// the top level directory of deal.II. +// +// --------------------------------------------------------------------- + +#include + +// This header undefines all macros that are not namespaced (i.e., macros that +// do not start with deal or DEAL). + +#ifdef Assert +# undef Assert +#endif // #ifdef Assert + +#ifdef AssertARKode +# undef AssertARKode +#endif // #ifdef AssertARKode + +#ifdef AssertCuda +# undef AssertCuda +#endif // #ifdef AssertCuda + +#ifdef AssertCusolver +# undef AssertCusolver +#endif // #ifdef AssertCusolver + +#ifdef AssertCusparse +# undef AssertCusparse +#endif // #ifdef AssertCusparse + +#ifdef AssertDimension +# undef AssertDimension +#endif // #ifdef AssertDimension + +#ifdef AssertIDA +# undef AssertIDA +#endif // #ifdef AssertIDA + +#ifdef AssertIndexRange +# undef AssertIndexRange +#endif // #ifdef AssertIndexRange + +#ifdef AssertIsFinite +# undef AssertIsFinite +#endif // #ifdef AssertIsFinite + +#ifdef AssertKINSOL +# undef AssertKINSOL +#endif // #ifdef AssertKINSOL + +#ifdef AssertNothrow +# undef AssertNothrow +#endif // #ifdef AssertNothrow + +#ifdef AssertNothrowCuda +# undef AssertNothrowCuda +#endif // #ifdef AssertNothrowCuda + +#ifdef AssertNothrowCusparse +# undef AssertNothrowCusparse +#endif // #ifdef AssertNothrowCusparse + +#ifdef AssertThrow +# undef AssertThrow +#endif // #ifdef AssertThrow + +#ifdef AssertThrowMPI +# undef AssertThrowMPI +#endif // #ifdef AssertThrowMPI + +#ifdef AssertVectorVectorDimension +# undef AssertVectorVectorDimension +#endif // #ifdef AssertVectorVectorDimension + +#ifdef DeclException0 +# undef DeclException0 +#endif // #ifdef DeclException0 + +#ifdef DeclException1 +# undef DeclException1 +#endif // #ifdef DeclException1 + +#ifdef DeclException2 +# undef DeclException2 +#endif // #ifdef DeclException2 + +#ifdef DeclException3 +# undef DeclException3 +#endif // #ifdef DeclException3 + +#ifdef DeclException4 +# undef DeclException4 +#endif // #ifdef DeclException4 + +#ifdef DeclException5 +# undef DeclException5 +#endif // #ifdef DeclException5 + +#ifdef DeclExceptionMsg +# undef DeclExceptionMsg +#endif // #ifdef DeclExceptionMsg diff --git a/tests/base/assertion_macros.cc b/tests/base/assertion_macros.cc new file mode 100644 index 0000000000..0066330456 --- /dev/null +++ b/tests/base/assertion_macros.cc @@ -0,0 +1,173 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2018 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE.md at +// the top level directory of deal.II. +// +// --------------------------------------------------------------------- + + +// Check that undefine_macros.h undefines all assertion macros. Check this by +// defining functions with the same names. + +#include + +#include + +#include "../tests.h" + +// must come after any deal.II headers to undefine them +#include + +int +Assert(int, int) +{ + return 42; +} +int +AssertARKode(int, int) +{ + return 42; +} + +int +AssertCuda(int, int) +{ + return 42; +} + +int +AssertCusolver(int, int) +{ + return 42; +} + +int +AssertCusparse(int, int) +{ + return 42; +} + +int +AssertDimension(int, int) +{ + return 42; +} + +int +AssertIDA(int, int) +{ + return 42; +} + +int +AssertIndexRange(int, int) +{ + return 42; +} + +int +AssertIsFinite(int, int) +{ + return 42; +} + +int +AssertKINSOL(int, int) +{ + return 42; +} + +int +AssertNothrow(int, int) +{ + return 42; +} + +int +AssertNothrowCuda(int, int) +{ + return 42; +} + +int +AssertNothrowCusparse(int, int) +{ + return 42; +} + +int +AssertThrow(int, int) +{ + return 42; +} + +int +AssertThrowMPI(int, int) +{ + return 42; +} + +int +AssertVectorVectorDimension(int, int) +{ + return 42; +} + +int +DeclException0(int, int) +{ + return 42; +} + +int +DeclException1(int, int) +{ + return 42; +} + +int +DeclException2(int, int) +{ + return 42; +} + +int +DeclException3(int, int) +{ + return 42; +} + +int +DeclException4(int, int) +{ + return 42; +} + +int +DeclException5(int, int) +{ + return 42; +} + +int +DeclExceptionMsg(int, int) +{ + return 42; +} + + +int +main() +{ + initlog(); + + deallog << "OK" << std::endl; +} diff --git a/tests/base/assertion_macros.output b/tests/base/assertion_macros.output new file mode 100644 index 0000000000..0fd8fc12f0 --- /dev/null +++ b/tests/base/assertion_macros.output @@ -0,0 +1,2 @@ + +DEAL::OK -- 2.39.5