From: Gary Lockyer Date: Fri, 1 May 2020 03:03:10 +0000 (+1200) Subject: Fix clang 9 unused-function warnings X-Git-Tag: ldb-2.2.0~565 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=c2b0071460c09eb24d12880e54e2f80c77834ebb;p=thirdparty%2Fsamba.git Fix clang 9 unused-function warnings Signed-off-by: Gary Lockyer Reviewed-by: Andreas Schneider --- diff --git a/buildtools/wafsamba/samba_autoconf.py b/buildtools/wafsamba/samba_autoconf.py index f0491bcd36f..5534c2f6a9f 100644 --- a/buildtools/wafsamba/samba_autoconf.py +++ b/buildtools/wafsamba/samba_autoconf.py @@ -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) diff --git a/pidl/lib/Parse/Pidl/Samba4/Python.pm b/pidl/lib/Parse/Pidl/Samba4/Python.pm index 12ddd046062..e72d32db391 100644 --- a/pidl/lib/Parse/Pidl/Samba4/Python.pm +++ b/pidl/lib/Parse/Pidl/Samba4/Python.pm @@ -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: