Fix clang 9 unused-function warnings
authorGary Lockyer <gary@catalyst.net.nz>
Fri, 1 May 2020 03:03:10 +0000 (15:03 +1200)
committerAndreas Schneider <asn@cryptomilk.org>
Fri, 8 May 2020 09:31:31 +0000 (09:31 +0000)
Signed-off-by: Gary Lockyer <gary@catalyst.net.nz>
Reviewed-by: Andreas Schneider <asn@samba.org>
buildtools/wafsamba/samba_autoconf.py
pidl/lib/Parse/Pidl/Samba4/Python.pm

index f0491bcd36fe45cb9a35549d0bd5d89092648f97..5534c2f6a9fef5be65139f9b0e95a15cba5291f8 100644 (file)
@@ -794,7 +794,6 @@ int main(void) {
             conf.ADD_NAMED_CFLAGS('PICKY_CFLAGS', '-Wno-error=format-nonliteral', testflags=True)
             conf.ADD_NAMED_CFLAGS('PICKY_CFLAGS', '-Wno-error=for-loop-analysis', testflags=True)
             conf.ADD_NAMED_CFLAGS('PICKY_CFLAGS', '-Wno-error=missing-field-initializers', testflags=True)
-            conf.ADD_NAMED_CFLAGS('PICKY_CFLAGS', '-Wno-error=unused-function', testflags=True)
 
     if Options.options.fatal_errors:
         conf.ADD_CFLAGS('-Wfatal-errors', testflags=True)
index 12ddd0460623497ccc6f688571753a9e02f076fa..e72d32db3919829173c082a453e9c117c58caca8 100644 (file)
@@ -2294,6 +2294,17 @@ sub Parse($$$$$)
 #include \"$hdr\"
 $ndr_hdr_include
 
+/*
+ * Suppress compiler warnings if the generated code does not call these
+ * functions
+ */
+#ifndef _MAYBE_UNUSED_
+#ifdef HAVE___ATTRIBUTE__
+#define _MAYBE_UNUSED_ __attribute__ ((unused))
+#else
+#define _MAYBE_UNUSED_
+#endif
+#endif
 /*
  * These functions are here to ensure they can be optimized out by
  * the compiler based on the constant input values
@@ -2315,7 +2326,7 @@ static inline unsigned long long ndr_sizeof2uintmax(size_t var_size)
        return 0;
 }
 
-static inline long long ndr_sizeof2intmax(size_t var_size)
+static inline _MAYBE_UNUSED_ long long ndr_sizeof2intmax(size_t var_size)
 {
        switch (var_size) {
        case 8: