Allow empty deprecation macros to be passed as macro arguments
authorMatt Caswell <matt@openssl.org>
Fri, 23 Oct 2020 13:26:48 +0000 (14:26 +0100)
committerMatt Caswell <matt@openssl.org>
Fri, 30 Oct 2020 14:56:29 +0000 (14:56 +0000)
The OSSL_DEPRECATEDIN_3_0 macro introduced in PR #13074 is intended to
be passed as a parameter to the various PEM declaration macros. However,
in some cases OSSL_DEPRECATEDIN_3_0 is defined to be empty, and it is
not allowed to pass empty macro arguments in C90. Therefore we ensure
these macros are always defined. In the case where they were empty
previously we use a no-op value instead.

Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Paul Dale <paul.dale@oracle.com>
(Merged from https://github.com/openssl/openssl/pull/13227)

include/openssl/macros.h

index 24fad673bd420528c9fdb88f38807c0137ad8586..87cfde49201285a4170b919617d3d0b69a725a53 100644 (file)
 #  endif
 # endif
 
-/* Still not defined?  Then define empty macros */
+/*
+ * Still not defined?  Then define no-op macros. This means these macros
+ * are unsuitable for use in a typedef.
+ */
 # ifndef OSSL_DEPRECATED
-#  define OSSL_DEPRECATED(since)
-#  define OSSL_DEPRECATED_FOR(since, message)
+#  define OSSL_DEPRECATED(since)                extern
+#  define OSSL_DEPRECATED_FOR(since, message)   extern
 # endif
 
 /*