[29913] in CVS-changelog-for-Kerberos-V5

home help back first fref pref prev next nref lref last post

krb5 commit: Fix unused finalizer function warning

daemon@ATHENA.MIT.EDU (Greg Hudson)
Fri Apr 14 12:14:40 2017

Date: Fri, 14 Apr 2017 12:14:37 -0400
From: Greg Hudson <ghudson@mit.edu>
Message-Id: <201704141614.v3EGEbqP024277@drugstore.mit.edu>
To: cvs-krb5@mit.edu
Reply-To: krbdev@mit.edu
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: cvs-krb5-bounces@mit.edu

https://github.com/krb5/krb5/commit/8815ad966df1b7c5a0120f88f656cde34290d5c1
commit 8815ad966df1b7c5a0120f88f656cde34290d5c1
Author: Robbie Harwood <rharwood@redhat.com>
Date:   Thu Apr 6 14:43:13 2017 -0400

    Fix unused finalizer function warning
    
    When we are building a static object containing a finalizer function
    (e.g. for the profile library tests), mark the finalizer as unused to
    avoid warnings in gcc and clang.
    
    [ghudson@mit.edu: commented UNUSED definition and moved it so we can
    use it elsewhere later; rewrote commit message]

 src/include/k5-platform.h |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/src/include/k5-platform.h b/src/include/k5-platform.h
index 994f463..62d1e2a 100644
--- a/src/include/k5-platform.h
+++ b/src/include/k5-platform.h
@@ -71,6 +71,13 @@
 #define CAN_COPY_VA_LIST
 #endif
 
+/* This attribute prevents unused function warnings in gcc and clang. */
+#ifdef __GNUC__
+#define UNUSED __attribute__((__unused__))
+#else
+#define UNUSED
+#endif
+
 #if defined(macintosh) || (defined(__MACH__) && defined(__APPLE__))
 #include <TargetConditionals.h>
 #endif
@@ -357,14 +364,11 @@ typedef struct { int error; unsigned char did_run; } k5_init_t;
 #if !defined(SHARED) && !defined(_WIN32)
 
 /*
- * In this case, we just don't care about finalization.
- *
- * The code will still define the function, but we won't do anything
- * with it.  Annoying: This may generate unused-function warnings.
+ * In this case, we just don't care about finalization.  The code will still
+ * define the function, but we won't do anything with it.
  */
-
 # define MAKE_FINI_FUNCTION(NAME)               \
-        static void NAME(void)
+        static void NAME(void) UNUSED
 
 #elif defined(USE_LINKER_FINI_OPTION) || defined(_WIN32)
 /* If we're told the linker option will be used, it doesn't really
_______________________________________________
cvs-krb5 mailing list
cvs-krb5@mit.edu
https://mailman.mit.edu/mailman/listinfo/cvs-krb5

home help back first fref pref prev next nref lref last post