[PATCH] Suppress certain GCC warnings in auto-generated code.

Jamey Sharp jamey at minilop.net
Wed Oct 28 17:48:19 PDT 2009


- Don't warn for references to deprecated functions in xorg_symbols.
- Ignore functions generated by gl_apitemp.py that are never used.

Signed-off-by: Jamey Sharp <jamey at minilop.net>
---
Guillem Jover <guillem at hadrons.org> wrote:
> Or maybe define it in Xfuncproto.h.in as something like _X_UNUSED so
> that other files and components can use it as well?

Sorry I didn't reply, Guillem. It seems better to me to keep the definition
local rather than requiring new API from the x11proto module, particularly
since I don't want to encourage people to suppress the "possibly unused"
warnings without thinking carefully about them, so I'm resubmitting this patch
unchanged.

 glx/glapi.c                  |    7 ++++++-
 hw/xfree86/loader/sdksyms.sh |    1 +
 2 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/glx/glapi.c b/glx/glapi.c
index fa3808e..d6a568e 100644
--- a/glx/glapi.c
+++ b/glx/glapi.c
@@ -114,10 +114,15 @@ warn(void)
    }
 }
 
+#if defined(__GNUC__) && (__GNUC__ > 2)
+#define possibly_unused __attribute((unused))
+#else
+#define possibly_unused
+#endif
 
 #define KEYWORD1 static
 #define KEYWORD1_ALT static
-#define KEYWORD2 GLAPIENTRY
+#define KEYWORD2 GLAPIENTRY possibly_unused
 #define NAME(func)  NoOp##func
 
 #define F NULL
diff --git a/hw/xfree86/loader/sdksyms.sh b/hw/xfree86/loader/sdksyms.sh
index 1186547..eea0240 100755
--- a/hw/xfree86/loader/sdksyms.sh
+++ b/hw/xfree86/loader/sdksyms.sh
@@ -2,6 +2,7 @@
 
 cat > sdksyms.c << EOF
 /* This file is automatically generated by sdksyms.sh. */
+#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
 
 #ifdef HAVE_XORG_CONFIG_H
 #include <xorg-config.h>
-- 
1.6.3.3



More information about the xorg-devel mailing list