summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--config_host.mk.in1
-rw-r--r--config_host/config_global.h.in3
-rw-r--r--configure.ac30
-rw-r--r--include/sal/types.h4
-rw-r--r--solenv/gbuild/platform/solaris.mk2
-rw-r--r--solenv/gbuild/platform/unxgcc.mk2
6 files changed, 38 insertions, 4 deletions
diff --git a/config_host.mk.in b/config_host.mk.in
index 88f3e34438f2..e72648018411 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -225,6 +225,7 @@ export HAVE_GCC_FNO_ENFORCE_EH_SPECS=@HAVE_GCC_FNO_ENFORCE_EH_SPECS@
export HAVE_GCC_FNO_INLINE=@HAVE_GCC_FNO_INLINE@
export HAVE_GCC_GGDB2=@HAVE_GCC_GGDB2@
export HAVE_GCC_NO_LONG_DOUBLE=@HAVE_GCC_NO_LONG_DOUBLE@
+export HAVE_GCC_PRAGMA_OPERATOR=@HAVE_GCC_PRAGMA_OPERATOR@
export HAVE_GCC_VISIBILITY_BROKEN=@HAVE_GCC_VISIBILITY_BROKEN@
export HAVE_GCC_VISIBILITY_FEATURE=@HAVE_GCC_VISIBILITY_FEATURE@
export HAVE_GETOPT=@HAVE_GETOPT@
diff --git a/config_host/config_global.h.in b/config_host/config_global.h.in
index 31f64e6ed54d..88b7a1f7a4ff 100644
--- a/config_host/config_global.h.in
+++ b/config_host/config_global.h.in
@@ -21,6 +21,9 @@ Any change in this header will cause a rebuild of almost everything.
#define HAVE_GCC_BUILTIN_ATOMIC 0
#define HAVE_GCC_PRAGMA_DIAGNOSTIC_MODIFY 0
#define HAVE_GCC_PRAGMA_DIAGNOSTIC_SCOPE 0
+/* _Pragma */
+#define HAVE_GCC_PRAGMA_OPERATOR 0
+#define HAVE_GCC_DEPRECATED_MESSAGE 0
#define HAVE_THREADSAFE_STATICS 0
#define HAVE_SYSLOG_H 0
/* Compiler supports __attribute__((warn_unused)). */
diff --git a/configure.ac b/configure.ac
index c623f386d883..9ed63e26137d 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5718,6 +5718,17 @@ if test "$GCC" = "yes"; then
], [AC_MSG_RESULT([no])])
CFLAGS=$save_CFLAGS
+ AC_MSG_CHECKING([whether $CC supports __attribute__((deprecated(message)))])
+ save_CFLAGS=$CFLAGS
+ CFLAGS="$CFLAGS -Werror"
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([
+ __attribute__((deprecated(test))) void f();
+ ])], [
+ AC_DEFINE([HAVE_GCC_DEPRECATED_MESSAGE],[1])
+ AC_MSG_RESULT([yes])
+ ], [AC_MSG_RESULT([no])])
+ CFLAGS=$save_CFLAGS
+
AC_MSG_CHECKING([whether $CXX declares __cxa_allocate_exception in cxxabi.h])
AC_LANG_PUSH([C++])
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
@@ -6086,6 +6097,25 @@ if test "$HAVE_CXX11" = "TRUE"; then
fi
fi
+HAVE_GCC_PRAGMA_OPERATOR=
+dnl _Pragma support (may require C++11)
+if test "$GCC" = "yes"; then
+ AC_MSG_CHECKING([whether $CXX supports _Pragma operator])
+ AC_LANG_PUSH([C++])
+ save_CXXFLAGS=$CXXFLAGS
+ CXXFLAGS="$CXXFLAGS $CXXFLAGS_CXX11 -Werror"
+ AC_COMPILE_IFELSE([AC_LANG_SOURCE([
+ _Pragma("GCC diagnostic ignored \"-Wformat\"")
+ ])], [
+ AC_DEFINE([HAVE_GCC_PRAGMA_OPERATOR],[1])
+ HAVE_GCC_PRAGMA_OPERATOR=1
+ AC_MSG_RESULT([yes])
+ ], [AC_MSG_RESULT([no])])
+ AC_LANG_POP([C++])
+ CXXFLAGS=$save_CXXFLAGS
+fi
+AC_SUBST(HAVE_GCC_PRAGMA_OPERATOR)
+
dnl ===================================================================
dnl system stl sanity tests
dnl ===================================================================
diff --git a/include/sal/types.h b/include/sal/types.h
index 9ce2cef8aa19..145d47e20d82 100644
--- a/include/sal/types.h
+++ b/include/sal/types.h
@@ -469,7 +469,7 @@ template< typename T1, typename T2 > inline T1 static_int_cast(T2 n) {
SAL_DEPRECATED("Dont use, its evil.") void doit(int nPara);
*/
-#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5))
+#if HAVE_GCC_DEPRECATED_MESSAGE
# define SAL_DEPRECATED(message) __attribute__((deprecated(message)))
#elif (__GNUC__)
# define SAL_DEPRECATED(message) __attribute__((deprecated))
@@ -501,7 +501,7 @@ template< typename T1, typename T2 > inline T1 static_int_cast(T2 n) {
SAL_WNODEPRECATED_DECLARATIONS_POP
*/
-#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) || defined(__clang__)
+#if HAVE_GCC_PRAGMA_DIAGNOSTIC_MODIFY && HAVE_GCC_PRAGMA_DIAGNOSTIC_SCOPE && HAVE_GCC_PRAGMA_OPERATOR
#define SAL_WNODEPRECATED_DECLARATIONS_PUSH \
_Pragma(SAL_STRINGIFY_ARG(GCC diagnostic push)) \
_Pragma(SAL_STRINGIFY_ARG(GCC diagnostic ignored "-Wdeprecated-declarations"))
diff --git a/solenv/gbuild/platform/solaris.mk b/solenv/gbuild/platform/solaris.mk
index 240204c91e70..58c9b6835b9d 100644
--- a/solenv/gbuild/platform/solaris.mk
+++ b/solenv/gbuild/platform/solaris.mk
@@ -98,7 +98,7 @@ gb_CXXFLAGS += -std=c++0x
#When we are using 4.6.0 we can use gcc pragmas to selectively silence auto_ptr
#warnings in isolation, but for <= 4.5.X we need to globally disable
#deprecation
-ifeq ($(gb_GccLess460),1)
+ifeq ($(HAVE_GCC_PRAGMA_OPERATOR),)
gb_CXXFLAGS += -Wno-deprecated-declarations
endif
endif
diff --git a/solenv/gbuild/platform/unxgcc.mk b/solenv/gbuild/platform/unxgcc.mk
index 5b3805f3a875..17b9eb2c413c 100644
--- a/solenv/gbuild/platform/unxgcc.mk
+++ b/solenv/gbuild/platform/unxgcc.mk
@@ -94,7 +94,7 @@ gb_CXXFLAGS += $(CXXFLAGS_CXX11)
#When we are using 4.6.0 we can use gcc pragmas to selectively silence auto_ptr
#warnings in isolation, but for <= 4.5.X we need to globally disable
#deprecation
-ifeq ($(gb_GccLess460),1)
+ifeq ($(HAVE_GCC_PRAGMA_OPERATOR),)
gb_CXXFLAGS += -Wno-deprecated-declarations
endif
endif