]> granicus.if.org Git - openssl/commitdiff
Avoid __GNUC__ warnings when defining DECLARE_DEPRECATED
authorRichard Levitte <levitte@openssl.org>
Tue, 10 Jul 2018 14:05:55 +0000 (16:05 +0200)
committerRichard Levitte <levitte@openssl.org>
Wed, 11 Jul 2018 13:32:15 +0000 (15:32 +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: Matthias St. Pierre <Matthias.St.Pierre@ncp-e.com>
(Merged from https://github.com/openssl/openssl/pull/6688)

include/openssl/opensslconf.h.in

index 9f8634a3a28e53e00b9b76972495c7ccf2ab2c7a..17807fb6bd374cd3e7384629941c5391c99b624e 100644 (file)
@@ -68,12 +68,18 @@ extern "C" {
  * still won't see them if the library has been built to disable deprecated
  * functions.
  */
-#if defined(OPENSSL_NO_DEPRECATED)
-# define DECLARE_DEPRECATED(f)
-#elif __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 0)
-# define DECLARE_DEPRECATED(f)    f __attribute__ ((deprecated));
-#else
-# define DECLARE_DEPRECATED(f)   f;
+#ifndef DECLARE_DEPRECATED
+# if defined(OPENSSL_NO_DEPRECATED)
+#  define DECLARE_DEPRECATED(f)
+# else
+#  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
+# endif
 #endif
 
 #ifndef OPENSSL_FILE