krb5 commit: Make public headers work with gcc -Wundef

Greg Hudson ghudson at mit.edu
Wed Feb 14 17:28:11 EST 2018


https://github.com/krb5/krb5/commit/4737a11fbb746519bb7cbd040546f799fbfb3a0f
commit 4737a11fbb746519bb7cbd040546f799fbfb3a0f
Author: Greg Hudson <ghudson at mit.edu>
Date:   Sat Feb 10 00:31:45 2018 -0500

    Make public headers work with gcc -Wundef
    
    The C standard allows undefined symbols in #if statements, giving them
    the value 0 (C99 section 6.10.1).  However, some software builds with
    gcc -Wundef, which issues a warning on undefined symbols in
    preprocessor expressions.  Make the public headers safe for that
    environment by using #ifdef instead of #if for TARGET_OS_MAC.
    Reported by Ben Kaduk.
    
    ticket: 8641 (new)

 src/include/krb5/krb5.hin         |    4 ++--
 src/lib/gssapi/generic/gssapi.hin |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/include/krb5/krb5.hin b/src/include/krb5/krb5.hin
index c86e782..55135fc 100644
--- a/src/include/krb5/krb5.hin
+++ b/src/include/krb5/krb5.hin
@@ -106,7 +106,7 @@
 
 KRB5INT_BEGIN_DECLS
 
-#if TARGET_OS_MAC
+#if defined(TARGET_OS_MAC) && TARGET_OS_MAC
 #    pragma pack(push,2)
 #endif
 
@@ -8481,7 +8481,7 @@ krb5_set_kdc_recv_hook(krb5_context context, krb5_post_recv_fn recv_hook,
                        void *data);
 
 
-#if TARGET_OS_MAC
+#if defined(TARGET_OS_MAC) && TARGET_OS_MAC
 #    pragma pack(pop)
 #endif
 
diff --git a/src/lib/gssapi/generic/gssapi.hin b/src/lib/gssapi/generic/gssapi.hin
index 59cd93e..5049fbd 100644
--- a/src/lib/gssapi/generic/gssapi.hin
+++ b/src/lib/gssapi/generic/gssapi.hin
@@ -39,7 +39,7 @@
 extern "C" {
 #endif /* __cplusplus */
 
-#if TARGET_OS_MAC
+#if defined(TARGET_OS_MAC) && TARGET_OS_MAC
 #    pragma pack(push,2)
 #endif
 
@@ -816,7 +816,7 @@ gss_set_neg_mechs(
     gss_cred_id_t,      /* cred_handle */
     const gss_OID_set); /* mech_set */
 
-#if TARGET_OS_MAC
+#if defined(TARGET_OS_MAC) && TARGET_OS_MAC
 #    pragma pack(pop)
 #endif
 


More information about the cvs-krb5 mailing list