[openssl] master update

Richard Levitte levitte at openssl.org
Fri Sep 20 10:17:39 UTC 2019


The branch master has been updated
       via  ec87a649dd2128bde780f6e34a4833d9469f6b4d (commit)
      from  6061cd541332b0917e7001814533c01f895200a8 (commit)


- Log -----------------------------------------------------------------
commit ec87a649dd2128bde780f6e34a4833d9469f6b4d
Author: Richard Levitte <levitte at openssl.org>
Date:   Mon Sep 16 16:23:25 2019 +0200

    include/openssl/macros.h: Rework OPENSSL_FUNC for div C standards
    
    OPENSSL_FUNC was defined as an alias for __FUNCTION__ with new enough
    GNU C, regardless of the language standard used.  We change this
    slightly, so this won't happen unless __STDC_VERSION is defined.
    
    Fixes #9911
    
    Reviewed-by: Paul Dale <paul.dale at oracle.com>
    (Merged from https://github.com/openssl/openssl/pull/9913)

-----------------------------------------------------------------------

Summary of changes:
 include/openssl/macros.h | 32 ++++++++++++++++++++++++--------
 1 file changed, 24 insertions(+), 8 deletions(-)

diff --git a/include/openssl/macros.h b/include/openssl/macros.h
index da5d155680..a06b869522 100644
--- a/include/openssl/macros.h
+++ b/include/openssl/macros.h
@@ -131,15 +131,31 @@
 #  endif
 # endif
 
+/*
+ * __func__ was standardized in C99, so for any compiler that claims
+ * to implement that language level or newer, we assume we can safely
+ * use that symbol.
+ *
+ * GNU C also provides __FUNCTION__ since version 2, which predates
+ * C99.  We can, however, only use this if __STDC_VERSION__ exists,
+ * as it's otherwise not allowed according to ISO C standards (C90).
+ * (compiling with GNU C's -pedantic tells us so)
+ *
+ * If none of the above applies, we check if the compiler is MSVC,
+ * and use __FUNCTION__ if that's the case.
+ *
+ * If all these possibilities are exhausted, we give up and use a
+ * static string.
+ */
 # ifndef OPENSSL_FUNC
-#  if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
-#   define OPENSSL_FUNC __func__
-#  elif defined(__STRICT_ANSI__)
-#   define OPENSSL_FUNC "(unknown function)"
-#  elif defined(_MSC_VER) || (defined(__GNUC__) && __GNUC__ >= 2)
-#   define OPENSSL_FUNC __FUNCTION__
-#  elif defined(__FUNCSIG__)
-#   define OPENSSL_FUNC __FUNCSIG__
+#  if defined(__STDC_VERSION__)
+#   if __STDC_VERSION__ >= 199901L
+#    define OPENSSL_FUNC __func__
+#   elif defined(__GNUC__) && __GNUC__ >= 2
+#    define OPENSSL_FUNC __FUNCTION__
+#   endif
+#  elif defined(_MSC_VER)
+#    define OPENSSL_FUNC __FUNCTION__
 #  else
 #   define OPENSSL_FUNC "(unknown function)"
 #  endif


More information about the openssl-commits mailing list