Mesa (master): mapi: Silence many "warning: unused parameter"

Ian Romanick idr at kemper.freedesktop.org
Sat Aug 27 06:34:26 UTC 2011


Module: Mesa
Branch: master
Commit: f40c291ed637a916414d1367de379a0980488b4b
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=f40c291ed637a916414d1367de379a0980488b4b

Author: Ian Romanick <ian.d.romanick at intel.com>
Date:   Thu Aug 25 17:27:08 2011 -0700

mapi: Silence many "warning: unused parameter"

When generating dispatch templates, emit the '(void) blah;' magic to
make GCC happy.  This reduces a lot of warning spam if you build with
-Wunused-parameter or -Wextra.

Reviewed-by: Chia-I Wu <olv at lunarg.com>

---

 src/mapi/glapi/gen/gl_apitemp.py |    7 +++++++
 src/mapi/mapi/mapi_abi.py        |   11 ++++++++++-
 2 files changed, 17 insertions(+), 1 deletions(-)

diff --git a/src/mapi/glapi/gen/gl_apitemp.py b/src/mapi/glapi/gen/gl_apitemp.py
index 41a40fb..72c2e46 100644
--- a/src/mapi/glapi/gen/gl_apitemp.py
+++ b/src/mapi/glapi/gen/gl_apitemp.py
@@ -64,6 +64,8 @@ class PrintGlOffsets(gl_XML.gl_print_base):
 
 		n = f.static_name(name)
 
+		silence = ''
+		space = ''
 		for p in f.parameterIterator():
 			if p.is_padding:
 				continue
@@ -78,6 +80,9 @@ class PrintGlOffsets(gl_XML.gl_print_base):
 			o_string = o_string + comma + cast + p.name
 			comma = ", "
 
+			silence += "%s(void) %s;" % (space, p.name);
+			space = ' '
+
 
 		if f.return_type != 'void':
 			dispatch = "RETURN_DISPATCH"
@@ -97,6 +102,8 @@ class PrintGlOffsets(gl_XML.gl_print_base):
 
 		print '%s %s KEYWORD2 NAME(%s)(%s)' % (keyword, f.return_type, n, f.get_parameter_string(name))
 		print '{'
+		if silence:
+			print '    %s' % (silence)
 		if p_string == "":
 			print '   %s(%s, (), (F, "gl%s();\\n"));' \
 				% (dispatch, f.name, name)
diff --git a/src/mapi/mapi/mapi_abi.py b/src/mapi/mapi/mapi_abi.py
index e3d3f65..c18dd82 100644
--- a/src/mapi/mapi/mapi_abi.py
+++ b/src/mapi/mapi/mapi_abi.py
@@ -503,7 +503,16 @@ class ABIPrinter(object):
 
             proto = self._c_decl(ent, prefix, False, 'static')
 
-            stmt1 = self.indent + '%s(%s);' % (self.noop_warn,
+            stmt1 = self.indent;
+            space = ''
+            for t, n, a in ent.params:
+                stmt1 += "%s(void) %s;" % (space, n)
+                space = ' '
+
+            if ent.params:
+                stmt1 += '\n';
+
+            stmt1 += self.indent + '%s(%s);' % (self.noop_warn,
                     self._c_function(ent, warn_prefix, False, True))
 
             if ent.ret:




More information about the mesa-commit mailing list