Avoid __GNUC__ warnings when defining DECLARE_DEPRECATED
authorRichard Levitte <levitte@openssl.org>
Mon, 9 Jul 2018 15:31:23 +0000 (17:31 +0200)
committerRichard Levitte <levitte@openssl.org>
Tue, 10 Jul 2018 14:09:25 +0000 (16:09 +0200)
We need to check that __GNUC__ is defined before trying to use it.
This demands a slightly different way to define DECLARE_DEPRECATED.

Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/6680)

include/openssl/opensslconf.h.in

index 96f791ec6cc2d573dba905f518aea79eba39fe96..200a11a8fa105167afaf5801165c664feaf5c416 100644 (file)
@@ -68,10 +68,12 @@ extern "C" {
  * still won't see them if the library has been built to disable deprecated
  * functions.
  */
-#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 0)
-# define DECLARE_DEPRECATED(f)    f __attribute__ ((deprecated));
-#else
-# define DECLARE_DEPRECATED(f)   f;
+#define DECLARE_DEPRECATED(f)   f;
+#ifdef __GNUC__
+# if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 0)
+#  undef DECLARE_DEPRECATED
+#  define DECLARE_DEPRECATED(f)    f __attribute__ ((deprecated));
+# endif
 #endif
 
 #ifndef OPENSSL_FILE