[brlcad-commits] SF.net SVN: brlcad:[58762] brlcad/trunk
Open Source Solid Modeling CAD
Brought to you by:
brlcad
From: <sta...@us...> - 2013-12-03 15:05:05
|
Revision: 58762 http://sourceforge.net/p/brlcad/code/58762 Author: starseeker Date: 2013-12-03 15:05:01 +0000 (Tue, 03 Dec 2013) Log Message: ----------- Rework the pragma defines a bit - clang supports GCC style pragmas as a backwards compatibility measure, but we shouldn't count on that (plus we may need to fine tune options specifically for clang or GCC). Also use expanded version in src/other gdiam sources to avoid introducing need for common.h there. Modified Paths: -------------- brlcad/trunk/include/common.h brlcad/trunk/src/libged/simulate/simcollisionalgo.cpp brlcad/trunk/src/libged/simulate/simphysics.cpp brlcad/trunk/src/libpc/pcMathVM.h brlcad/trunk/src/libpc/pcNetwork.h brlcad/trunk/src/libpc/pcParser.h brlcad/trunk/src/libsysv/memset.c brlcad/trunk/src/libsysv/strchr.c brlcad/trunk/src/libsysv/strdup.c brlcad/trunk/src/libsysv/strsep.c brlcad/trunk/src/libsysv/strtok.c brlcad/trunk/src/other/libgdiam/gdiam.hpp Modified: brlcad/trunk/include/common.h =================================================================== --- brlcad/trunk/include/common.h 2013-12-03 05:45:37 UTC (rev 58761) +++ brlcad/trunk/include/common.h 2013-12-03 15:05:01 UTC (rev 58762) @@ -335,13 +335,15 @@ # define __STDC_VERSION__ 0 #endif -/* Provide a macro to indicate availability of diagnostic pragmas for +/* Provide macros to indicate availability of diagnostic pragmas for * GCC and Clang. */ -#define HAVE_DIAG_PRAGMAS \ - (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6))) \ - || (defined(__clang__) && (__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 3))) +#define HAVE_GCC_DIAG_PRAGMAS \ + (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) && !defined(__clang__)) +#define HAVE_CLANG_DIAG_PRAGMAS \ + (defined(__clang__) && (__clang_major__ > 2 || (__clang_major__ == 2 && __clang_minor__ >= 8))) + #endif /* __COMMON_H__ */ /** @} */ /* Modified: brlcad/trunk/src/libged/simulate/simcollisionalgo.cpp =================================================================== --- brlcad/trunk/src/libged/simulate/simcollisionalgo.cpp 2013-12-03 05:45:37 UTC (rev 58761) +++ brlcad/trunk/src/libged/simulate/simcollisionalgo.cpp 2013-12-03 15:05:01 UTC (rev 58762) @@ -30,10 +30,14 @@ /* system headers */ /* quell warnings */ -#if HAVE_DIAG_PRAGMAS +#if HAVE_GCC_DIAG_PRAGMAS # pragma GCC diagnostic push /* begin ignoring warnings */ # pragma GCC diagnostic ignored "-Wshadow" # pragma GCC diagnostic ignored "-Wfloat-equal" +#elif HAVE_CLANG_DIAG_PRAGMAS +# pragma clang diagnostic push /* begin ignoring warnings */ +# pragma clang diagnostic ignored "-Wshadow" +# pragma clang diagnostic ignored "-Wfloat-equal" #endif #include <BulletCollision/CollisionDispatch/btCollisionDispatcher.h> @@ -44,8 +48,10 @@ /* private headers */ #include "./simcollisionalgo.h" -#if HAVE_DIAG_PRAGMAS +#if HAVE_GCC_DIAG_PRAGMAS # pragma GCC diagnostic pop /* end ignoring warnings */ +#elif HAVE_CLANG_DIAG_PRAGMAS +# pragma clang diagnostic pop /* end ignoring warnings */ #endif #define USE_PERSISTENT_CONTACTS 1 Modified: brlcad/trunk/src/libged/simulate/simphysics.cpp =================================================================== --- brlcad/trunk/src/libged/simulate/simphysics.cpp 2013-12-03 05:45:37 UTC (rev 58761) +++ brlcad/trunk/src/libged/simulate/simphysics.cpp 2013-12-03 15:05:01 UTC (rev 58762) @@ -29,17 +29,24 @@ #include <iostream> /* quell warnings */ -#if HAVE_DIAG_PRAGMAS +#if HAVE_GCC_DIAG_PRAGMAS # pragma GCC diagnostic push /* begin ignoring warnings */ # pragma GCC diagnostic ignored "-Wshadow" # pragma GCC diagnostic ignored "-Wfloat-equal" # pragma GCC diagnostic ignored "-Wunused-parameter" +#elif HAVE_CLANG_DIAG_PRAGMAS +# pragma clang diagnostic push /* begin ignoring warnings */ +# pragma clang diagnostic ignored "-Wshadow" +# pragma clang diagnostic ignored "-Wfloat-equal" +# pragma clang diagnostic ignored "-Wunused-parameter" #endif #include <btBulletDynamicsCommon.h> -#if HAVE_DIAG_PRAGMAS +#if HAVE_GCC_DIAG_PRAGMAS # pragma GCC diagnostic pop /* end ignoring warnings */ +#elif HAVE_CLANG_DIAG_PRAGMAS +# pragma clang diagnostic pop /* end ignoring warnings */ #endif /* public headers */ Modified: brlcad/trunk/src/libpc/pcMathVM.h =================================================================== --- brlcad/trunk/src/libpc/pcMathVM.h 2013-12-03 05:45:37 UTC (rev 58761) +++ brlcad/trunk/src/libpc/pcMathVM.h 2013-12-03 15:05:01 UTC (rev 58762) @@ -35,16 +35,22 @@ #include <boost/iterator/indirect_iterator.hpp> /* for g++ to quell -Wshadow warnings */ -#if HAVE_DIAG_PRAGMAS +#if HAVE_GCC_DIAG_PRAGMAS # pragma GCC diagnostic push /* start ignoring warnings */ # pragma GCC diagnostic ignored "-Wshadow" # pragma GCC diagnostic ignored "-Wunused-parameter" +#elif HAVE_CLANG_DIAG_PRAGMAS +# pragma clang diagnostic push /* start ignoring warnings */ +# pragma clang diagnostic ignored "-Wshadow" +# pragma clang diagnostic ignored "-Wunused-parameter" #endif #include <boost/spirit/include/classic.hpp> -#if HAVE_DIAG_PRAGMAS +#if HAVE_GCC_DIAG_PRAGMAS # pragma GCC diagnostic pop /* end ignoring warnings */ +#elif HAVE_CLANG_DIAG_PRAGMAS +# pragma clang diagnostic pop /* end ignoring warnings */ #endif #include <iostream> Modified: brlcad/trunk/src/libpc/pcNetwork.h =================================================================== --- brlcad/trunk/src/libpc/pcNetwork.h 2013-12-03 05:45:37 UTC (rev 58761) +++ brlcad/trunk/src/libpc/pcNetwork.h 2013-12-03 15:05:01 UTC (rev 58762) @@ -34,17 +34,22 @@ #include <vector> /* for g++ to quell warnings */ -#if HAVE_DIAG_PRAGMAS +#if HAVE_GCC_DIAG_PRAGMAS # pragma GCC diagnostic push /* start new diagnostic pragma */ # pragma GCC diagnostic ignored "-Wshadow" +#elif HAVE_CLANG_DIAG_PRAGMAS +# pragma clang diagnostic push /* start new diagnostic pragma */ +# pragma clang diagnostic ignored "-Wshadow" #endif #include <boost/graph/graph_traits.hpp> #include <boost/graph/adjacency_list.hpp> #include <boost/graph/graphviz.hpp> -#if HAVE_DIAG_PRAGMAS +#if HAVE_GCC_DIAG_PRAGMAS # pragma GCC diagnostic pop /* end ignoring warnings */ +#elif HAVE_CLANG_DIAG_PRAGMAS +# pragma clang diagnostic pop /* end ignoring warnings */ #endif #include "pcBasic.h" Modified: brlcad/trunk/src/libpc/pcParser.h =================================================================== --- brlcad/trunk/src/libpc/pcParser.h 2013-12-03 05:45:37 UTC (rev 58761) +++ brlcad/trunk/src/libpc/pcParser.h 2013-12-03 15:05:01 UTC (rev 58762) @@ -33,16 +33,22 @@ #include <iostream> /* for g++ to quell warnings */ -#if HAVE_DIAG_PRAGMAS +#if HAVE_GCC_DIAG_PRAGMAS # pragma GCC diagnostic push /* start new diagnostic pragma */ # pragma GCC diagnostic ignored "-Wshadow" # pragma GCC diagnostic ignored "-Wunused-parameter" +#elif HAVE_CLANG_DIAG_PRAGMAS +# pragma clang diagnostic push /* start new diagnostic pragma */ +# pragma clang diagnostic ignored "-Wshadow" +# pragma clang diagnostic ignored "-Wunused-parameter" #endif #include <boost/spirit/include/classic.hpp> /* deprecated header */ -#if HAVE_DIAG_PRAGMAS +#if HAVE_GCC_DIAG_PRAGMAS # pragma GCC diagnostic pop /* end ignoring warnings */ +#elif HAVE_CLANG_DIAG_PRAGMAS +# pragma clang diagnostic pop /* end ignoring warnings */ #endif #include "pcVCSet.h" Modified: brlcad/trunk/src/libsysv/memset.c =================================================================== --- brlcad/trunk/src/libsysv/memset.c 2013-12-03 05:45:37 UTC (rev 58761) +++ brlcad/trunk/src/libsysv/memset.c 2013-12-03 15:05:01 UTC (rev 58762) @@ -27,16 +27,21 @@ #include "common.h" /* quell warnings */ -#if HAVE_DIAG_PRAGMAS +#if HAVE_GCC_DIAG_PRAGMAS # pragma GCC diagnostic push /* begin ignoring warnings */ # pragma GCC diagnostic ignored "-Wunused-const-variable" +#elif HAVE_CLANG_DIAG_PRAGMAS +# pragma clang diagnostic push /* begin ignoring warnings */ +# pragma clang diagnostic ignored "-Wunused-const-variable" #endif /* quell empty-compilation unit warnings */ static const int unused = 0; -#if HAVE_DIAG_PRAGMAS +#if HAVE_GCC_DIAG_PRAGMAS # pragma GCC diagnostic pop +#elif HAVE_CLANG_DIAG_PRAGMAS +# pragma clang diagnostic pop #endif /* Modified: brlcad/trunk/src/libsysv/strchr.c =================================================================== --- brlcad/trunk/src/libsysv/strchr.c 2013-12-03 05:45:37 UTC (rev 58761) +++ brlcad/trunk/src/libsysv/strchr.c 2013-12-03 15:05:01 UTC (rev 58762) @@ -32,16 +32,21 @@ #include "common.h" /* quell warnings */ -#if HAVE_DIAG_PRAGMAS +#if HAVE_GCC_DIAG_PRAGMAS # pragma GCC diagnostic push /* begin ignoring warnings */ # pragma GCC diagnostic ignored "-Wunused-const-variable" +#elif HAVE_CLANG_DIAG_PRAGMAS +# pragma clang diagnostic push /* begin ignoring warnings */ +# pragma clang diagnostic ignored "-Wunused-const-variable" #endif /* quell empty-compilation unit warnings */ static const int unused = 0; -#if HAVE_DIAG_PRAGMAS +#if HAVE_GCC_DIAG_PRAGMAS # pragma GCC diagnostic pop /* end ignoring warnings */ +#elif HAVE_CLANG_DIAG_PRAGMAS +# pragma clang diagnostic pop /* end ignoring warnings */ #endif /* Modified: brlcad/trunk/src/libsysv/strdup.c =================================================================== --- brlcad/trunk/src/libsysv/strdup.c 2013-12-03 05:45:37 UTC (rev 58761) +++ brlcad/trunk/src/libsysv/strdup.c 2013-12-03 15:05:01 UTC (rev 58762) @@ -29,16 +29,21 @@ #include "common.h" /* quell warnings */ -#if HAVE_DIAG_PRAGMAS +#if HAVE_GCC_DIAG_PRAGMAS # pragma GCC diagnostic push /* begin ignoring warnings */ # pragma GCC diagnostic ignored "-Wunused-const-variable" +#elif HAVE_CLANG_DIAG_PRAGMAS +# pragma clang diagnostic push /* begin ignoring warnings */ +# pragma clang diagnostic ignored "-Wunused-const-variable" #endif /* quell empty-compilation unit warnings */ static const int unused = 0; -#if HAVE_DIAG_PRAGMAS +#if HAVE_GCC_DIAG_PRAGMAS # pragma GCC diagnostic pop /* end ignoring warnings */ +#elif HAVE_CLANG_DIAG_PRAGMAS +# pragma clang diagnostic pop /* end ignoring warnings */ #endif #ifndef HAVE_STRDUP Modified: brlcad/trunk/src/libsysv/strsep.c =================================================================== --- brlcad/trunk/src/libsysv/strsep.c 2013-12-03 05:45:37 UTC (rev 58761) +++ brlcad/trunk/src/libsysv/strsep.c 2013-12-03 15:05:01 UTC (rev 58762) @@ -32,16 +32,21 @@ #include "common.h" /* quell warnings */ -#if HAVE_DIAG_PRAGMAS +#if HAVE_GCC_DIAG_PRAGMAS # pragma GCC diagnostic push /* begin ignoring warnings */ # pragma GCC diagnostic ignored "-Wunused-const-variable" +#elif HAVE_CLANG_DIAG_PRAGMAS +# pragma clang diagnostic push /* begin ignoring warnings */ +# pragma clang diagnostic ignored "-Wunused-const-variable" #endif /* quell empty-compilation unit warnings */ static const int unused = 0; -#if HAVE_DIAG_PRAGMAS +#if HAVE_GCC_DIAG_PRAGMAS # pragma GCC diagnostic pop /* end ignoring warnings */ +#elif HAVE_CLANG_DIAG_PRAGMAS +# pragma clang diagnostic pop /* end ignoring warnings */ #endif /* Modified: brlcad/trunk/src/libsysv/strtok.c =================================================================== --- brlcad/trunk/src/libsysv/strtok.c 2013-12-03 05:45:37 UTC (rev 58761) +++ brlcad/trunk/src/libsysv/strtok.c 2013-12-03 15:05:01 UTC (rev 58762) @@ -11,16 +11,21 @@ #include "common.h" /* quell warnings */ -#if HAVE_DIAG_PRAGMAS +#if HAVE_GCC_DIAG_PRAGMAS # pragma GCC diagnostic push /* begin ignoring warnings */ # pragma GCC diagnostic ignored "-Wunused-const-variable" +#elif HAVE_CLANG_DIAG_PRAGMAS +# pragma clang diagnostic push /* begin ignoring warnings */ +# pragma clang diagnostic ignored "-Wunused-const-variable" #endif /* quell empty-compilation unit warnings */ static const int unused = 0; -#if HAVE_DIAG_PRAGMAS +#if HAVE_GCC_DIAG_PRAGMAS # pragma GCC diagnostic pop /* end ignoring warnings */ +#elif HAVE_CLANG_DIAG_PRAGMAS +# pragma clang diagnostic pop /* end ignoring warnings */ #endif /* Modified: brlcad/trunk/src/other/libgdiam/gdiam.hpp =================================================================== --- brlcad/trunk/src/other/libgdiam/gdiam.hpp 2013-12-03 05:45:37 UTC (rev 58761) +++ brlcad/trunk/src/other/libgdiam/gdiam.hpp 2013-12-03 15:05:01 UTC (rev 58762) @@ -43,9 +43,6 @@ typedef gdiam_real * gdiam_point; typedef const gdiam_real * gdiam_point_cnt; -/* for HAVE_DIAG_PRAGMAS (see below): */ -#include "common.h" - #ifndef __MINMAX_DEFINED #define __MINMAX_DEFINED @@ -173,9 +170,12 @@ } /* for g++ to quell warnings */ -#if HAVE_DIAG_PRAGMAS +#if (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) && !defined(__clang__)) # pragma GCC diagnostic push /* start new diagnostic pragma */ # pragma GCC diagnostic ignored "-Wfloat-equal" +#elif (defined(__clang__) && (__clang_major__ > 2 || (__clang_major__ == 2 && __clang_minor__ >= 8))) +# pragma clang diagnostic push /* start new diagnostic pragma */ +# pragma clang diagnostic ignored "-Wfloat-equal" #endif inline bool pnt_isEqual( const gdiam_point p, @@ -186,8 +186,10 @@ && ( p[ 1 ] == q[ 1 ] ) && ( p[ 2 ] == q[ 2 ] ) ); } -#if HAVE_DIAG_PRAGMAS +#if (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) && !defined(__clang__)) # pragma GCC diagnostic pop /* end ignoring warnings */ +#elif (defined(__clang__) && (__clang_major__ > 2 || (__clang_major__ == 2 && __clang_minor__ >= 8))) +# pragma clang diagnostic pop /* end ignoring warnings */ #endif inline void pnt_scale_and_add( gdiam_point dest, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |