genxml: Silence about a billion unused parameter warnings
authorIan Romanick <ian.d.romanick@intel.com>
Thu, 15 Jun 2017 01:59:09 +0000 (18:59 -0700)
committerIan Romanick <ian.d.romanick@intel.com>
Wed, 28 Jun 2017 21:50:14 +0000 (14:50 -0700)
v2: Use textwrap.dedent to make the source line a lot shorter.
Shortening (?) the line was requested by Jason.

v3: Simplify the texwrap.dedent usage.  Suggested by Dylan.

Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
src/intel/genxml/gen_pack_header.py

index fefbc9a..9021f00 100644 (file)
@@ -8,6 +8,7 @@ import xml.parsers.expat
 import re
 import sys
 import copy
+import textwrap
 
 license =  """/*
  * Copyright (C) 2016 Intel Corporation
@@ -578,8 +579,12 @@ class Parser(object):
 
     def emit_pack_function(self, name, group):
         name = self.gen_prefix(name)
-        print("static inline void\n%s_pack(__gen_user_data *data, void * restrict dst,\n%sconst struct %s * restrict values)\n{" %
-              (name, ' ' * (len(name) + 6), name))
+        print(textwrap.dedent("""\
+            static inline void
+            %s_pack(__attribute__((unused)) __gen_user_data *data,
+                  %s__attribute__((unused)) void * restrict dst,
+                  %s__attribute__((unused)) const struct %s * restrict values)
+            {""") % (name, ' ' * len(name), ' ' * len(name), name))
 
         (dwords, length) = group.collect_dwords_and_length()
         if length: