[Mesa-dev] [PATCH 07/41] glapi: remove useless returns from python code

Dylan Baker baker.dylan.c at gmail.com
Tue Apr 19 23:06:00 UTC 2016


Quoting Ian Romanick (2016-04-19 14:49:19)
> I think I did that because it made emacs do-the-right-thing with the
> indentation.  The return told it to move up a level.  Either way, this
> patch is

It doesn't surprise me that emacs would want the return (or did, they
might have fixed it in the intervening years...). Python doesn't fit the
expectations that most editors have for how a language works.

> 
> Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>
> 
> On 03/31/2016 05:04 PM, Dylan Baker wrote:
> > In python functions return None by default, and it's uncommon to use an
> > explicit return statement without a return value unless it's to return
> > early. It's also uncommon to return None explicitly unless it's an
> > alternate to another possible return value.
> > 
> > This patch changes the code to only use returns when they return a real
> > value, or are used for early returns.
> > 
> > Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
> > ---
> >  src/mapi/glapi/gen/glX_XML.py          |  7 -------
> >  src/mapi/glapi/gen/glX_proto_recv.py   | 13 -------------
> >  src/mapi/glapi/gen/glX_proto_send.py   | 19 -------------------
> >  src/mapi/glapi/gen/glX_proto_size.py   | 10 ----------
> >  src/mapi/glapi/gen/glX_server_table.py |  6 ------
> >  src/mapi/glapi/gen/gl_SPARC_asm.py     |  4 ----
> >  src/mapi/glapi/gen/gl_XML.py           | 26 +-------------------------
> >  src/mapi/glapi/gen/gl_apitemp.py       |  5 -----
> >  src/mapi/glapi/gen/gl_enums.py         |  3 ---
> >  src/mapi/glapi/gen/gl_gentable.py      |  6 ------
> >  src/mapi/glapi/gen/gl_procs.py         |  3 ---
> >  src/mapi/glapi/gen/gl_table.py         |  7 -------
> >  src/mapi/glapi/gen/gl_x86-64_asm.py    | 12 ------------
> >  src/mapi/glapi/gen/gl_x86_asm.py       |  5 -----
> >  src/mapi/glapi/gen/remap_helper.py     |  3 ---
> >  src/mapi/glapi/gen/typeexpr.py         |  8 --------
> >  16 files changed, 1 insertion(+), 136 deletions(-)
> > 
> > diff --git a/src/mapi/glapi/gen/glX_XML.py b/src/mapi/glapi/gen/glX_XML.py
> > index f1f7087..ec2e412 100644
> > --- a/src/mapi/glapi/gen/glX_XML.py
> > +++ b/src/mapi/glapi/gen/glX_XML.py
> > @@ -67,8 +67,6 @@ class glx_enum(gl_XML.gl_enum):
> >                  if not self.functions.has_key(n):
> >                      self.functions[ n ] = [c, mode]
> >  
> > -        return
> > -
> >  
> >  class glx_function(gl_XML.gl_function):
> >      def __init__(self, element, context):
> > @@ -104,7 +102,6 @@ class glx_function(gl_XML.gl_function):
> >          self.offsets_calculated = 0
> >  
> >          gl_XML.gl_function.__init__(self, element, context)
> > -        return
> >  
> >      def process_element(self, element):
> >          gl_XML.gl_function.process_element(self, element)
> > @@ -177,8 +174,6 @@ class glx_function(gl_XML.gl_function):
> >              if param.is_output and self.glx_rop != 0:
> >                  raise RuntimeError("Render / RenderLarge commands cannot have outputs (%s)." % (self.name))
> >  
> > -        return
> > -
> >      def has_variable_size_request(self):
> >          """Determine if the GLX request packet is variable sized.
> >  
> > @@ -258,7 +253,6 @@ class glx_function(gl_XML.gl_function):
> >                      offset += 4
> >  
> >              self.offsets_calculated = 1
> > -        return
> >  
> >      def offset_of(self, param_name):
> >          self.calculate_offsets()
> > @@ -511,7 +505,6 @@ class glx_function_iterator(object):
> >      """Class to iterate over a list of glXFunctions"""
> >      def __init__(self, context):
> >          self.iterator = context.functionIterateByOffset()
> > -        return
> >  
> >      def __iter__(self):
> >          return self
> > diff --git a/src/mapi/glapi/gen/glX_proto_recv.py b/src/mapi/glapi/gen/glX_proto_recv.py
> > index 344eb09..148d04d 100644
> > --- a/src/mapi/glapi/gen/glX_proto_recv.py
> > +++ b/src/mapi/glapi/gen/glX_proto_recv.py
> > @@ -42,14 +42,12 @@ class PrintGlxDispatch_h(gl_XML.gl_print_base):
> >          self.license = license.bsd_license_template % ( "(C) Copyright IBM Corporation 2005", "IBM")
> >  
> >          self.header_tag = "_INDIRECT_DISPATCH_H_"
> > -        return
> >  
> >      def printRealHeader(self):
> >          print '#  include <X11/Xfuncproto.h>'
> >          print ''
> >          print 'struct __GLXclientStateRec;'
> >          print ''
> > -        return
> >  
> >      def printBody(self, api):
> >          for func in api.functionIterateAll():
> > @@ -66,8 +64,6 @@ class PrintGlxDispatch_h(gl_XML.gl_print_base):
> >                          print 'extern _X_HIDDEN int __glXDisp_%s(struct __GLXclientStateRec *, GLbyte *);' % (n)
> >                          print 'extern _X_HIDDEN _X_COLD int __glXDispSwap_%s(struct __GLXclientStateRec *, GLbyte *);' % (n)
> >  
> > -        return
> > -
> >  
> >  class PrintGlxDispatchFunctions(glX_proto_common.glx_print_proto):
> >      def __init__(self, do_swap):
> > @@ -77,7 +73,6 @@ class PrintGlxDispatchFunctions(glX_proto_common.glx_print_proto):
> >  
> >          self.real_types = [ '', '', 'uint16_t', '', 'uint32_t', '', '', '', 'uint64_t' ]
> >          self.do_swap = do_swap
> > -        return
> >  
> >      def printRealHeader(self):
> >          print '#include <inttypes.h>'
> > @@ -100,7 +95,6 @@ class PrintGlxDispatchFunctions(glX_proto_common.glx_print_proto):
> >          print ''
> >          print 'static const unsigned dummy_answer[2] = {0, 0};'
> >          print ''
> > -        return
> >  
> >      def printBody(self, api):
> >          if self.do_swap:
> > @@ -112,8 +106,6 @@ class PrintGlxDispatchFunctions(glX_proto_common.glx_print_proto):
> >                  if func.glx_sop and func.glx_vendorpriv:
> >                      self.printFunction(func, func.glx_vendorpriv_names[0])
> >  
> > -        return
> > -
> >      def fptrType(self, name):
> >       fptr = "pfngl" + name + "proc"
> >       return fptr.upper()
> > @@ -147,7 +139,6 @@ class PrintGlxDispatchFunctions(glX_proto_common.glx_print_proto):
> >  
> >          print '}'
> >          print ''
> > -        return
> >  
> >      def swap_name(self, bytes):
> >          return 'bswap_%u_array' % (8 * bytes)
> > @@ -351,8 +342,6 @@ class PrintGlxDispatchFunctions(glX_proto_common.glx_print_proto):
> >          if need_blank:
> >              print ''
> >  
> > -        return
> > -
> >      def printSingleFunction(self, f, name):
> >          if name not in f.glx_vendorpriv_names:
> >              print '    xGLXSingleReq * const req = (xGLXSingleReq *) pc;'
> > @@ -452,7 +441,6 @@ class PrintGlxDispatchFunctions(glX_proto_common.glx_print_proto):
> >          print '    }'
> >          print ''
> >          print '    return error;'
> > -        return
> >  
> >      def printRenderFunction(self, f):
> >          # There are 4 distinct phases in a rendering dispatch function.
> > @@ -494,7 +482,6 @@ class PrintGlxDispatchFunctions(glX_proto_common.glx_print_proto):
> >              print ''
> >  
> >          self.emit_function_call(f, "", "")
> > -        return
> >  
> >  
> >  def _parser():
> > diff --git a/src/mapi/glapi/gen/glX_proto_send.py b/src/mapi/glapi/gen/glX_proto_send.py
> > index d83d519..c4349ce 100644
> > --- a/src/mapi/glapi/gen/glX_proto_send.py
> > +++ b/src/mapi/glapi/gen/glX_proto_send.py
> > @@ -150,7 +150,6 @@ class glx_pixel_function_stub(glX_XML.glx_function):
> >          self.count_parameter_list = func.count_parameter_list
> >          self.counter_list = func.counter_list
> >          self.offsets_calculated = 0
> > -        return
> >  
> >  
> >  class PrintGlxProtoStubs(glX_proto_common.glx_print_proto):
> > @@ -163,7 +162,6 @@ class PrintGlxProtoStubs(glX_proto_common.glx_print_proto):
> >          self.generic_sizes = [3, 4, 6, 8, 12, 16, 24, 32]
> >          self.pixel_stubs = {}
> >          self.debug = 0
> > -        return
> >  
> >      def printRealHeader(self):
> >          print ''
> > @@ -312,7 +310,6 @@ class PrintGlxProtoStubs(glX_proto_common.glx_print_proto):
> >  
> >          for size in self.generic_sizes:
> >              self.print_generic_function(size)
> > -        return
> >  
> >      def printBody(self, api):
> >  
> > @@ -350,7 +347,6 @@ class PrintGlxProtoStubs(glX_proto_common.glx_print_proto):
> >                  self.printFunction(func, func.glx_vendorpriv_names[0])
> >  
> >          self.printGetProcAddress(api)
> > -        return
> >  
> >      def printGetProcAddress(self, api):
> >          procs = {}
> > @@ -400,7 +396,6 @@ class PrintGlxProtoStubs(glX_proto_common.glx_print_proto):
> >  
> >              #endif /* GLX_SHARED_GLAPI */
> >          """)
> > -        return
> >  
> >      def printFunction(self, func, name):
> >          footer = '}\n'
> > @@ -450,7 +445,6 @@ class PrintGlxProtoStubs(glX_proto_common.glx_print_proto):
> >              print "/* Missing GLX protocol for %s. */" % (name)
> >  
> >          print footer
> > -        return
> >  
> >      def print_generic_function(self, n):
> >          size = (n + 3) & ~3
> > @@ -467,7 +461,6 @@ class PrintGlxProtoStubs(glX_proto_common.glx_print_proto):
> >                  if (__builtin_expect(gc->pc > gc->limit, 0)) { (void) __glXFlushRenderBuffer(gc, gc->pc); }
> >              }
> >          """ % (n, size + 4, size))
> > -        return
> >  
> >      def common_emit_one_arg(self, p, pc, adjust, extra_offset):
> >          if p.is_array():
> > @@ -499,8 +492,6 @@ class PrintGlxProtoStubs(glX_proto_common.glx_print_proto):
> >                      else:
> >                          extra_offset = temp
> >  
> > -        return
> > -
> >      def pixel_emit_args(self, f, pc, large):
> >          """Emit the arguments for a pixel function.  This differs from
> >          common_emit_args in that pixel functions may require padding
> > @@ -554,7 +545,6 @@ class PrintGlxProtoStubs(glX_proto_common.glx_print_proto):
> >                  else:
> >                      print '__glXSendLargeImage(gc, compsize, %s, %s, %s, %s, %s, %s, %s, %s, %s);' % (dim_str, width, height, depth, param.img_format, param.img_type, param.name, pcPtr, pixHeaderPtr)
> >  
> > -        return
> >  
> >      def large_emit_begin(self, f, op_name = None):
> >          if not op_name:
> > @@ -565,7 +555,6 @@ class PrintGlxProtoStubs(glX_proto_common.glx_print_proto):
> >          print 'GLubyte * const pc = __glXFlushRenderBuffer(gc, gc->pc);'
> >          print '(void) memcpy((void *)(pc + 0), (void *)(&cmdlenLarge), 4);'
> >          print '(void) memcpy((void *)(pc + 4), (void *)(&op), 4);'
> > -        return
> >  
> >      def common_func_print_just_start(self, f, name):
> >          print '    struct glx_context * const gc = __glXGetCurrentContext();'
> > @@ -791,7 +780,6 @@ class PrintGlxProtoStubs(glX_proto_common.glx_print_proto):
> >  
> >          print '    }'
> >          print '    return%s;' % (return_name)
> > -        return
> >  
> >      def printPixelFunction(self, f):
> >          if self.pixel_stubs.has_key( f.name ):
> > @@ -848,7 +836,6 @@ class PrintGlxProtoStubs(glX_proto_common.glx_print_proto):
> >              print '}'
> >  
> >          if trailer: print trailer
> > -        return
> >  
> >      def printRenderFunction(self, f):
> >          # There is a class of GL functions that take a single pointer
> > @@ -902,7 +889,6 @@ class PrintGlxProtoStubs(glX_proto_common.glx_print_proto):
> >              print 'printf( "Exit %%s.\\n", "gl%s" );' % (f.name)
> >  
> >          if trailer: print trailer
> > -        return
> >  
> >  
> >  class PrintGlxProtoInit_c(gl_XML.gl_print_base):
> > @@ -915,7 +901,6 @@ class PrintGlxProtoInit_c(gl_XML.gl_print_base):
> >                  Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas.
> >                  (C) Copyright IBM Corporation 2004"""),
> >              "PRECISION INSIGHT, IBM")
> > -        return
> >  
> >      def printRealHeader(self):
> >          print textwrap.dedent("""\
> > @@ -975,7 +960,6 @@ class PrintGlxProtoInit_c(gl_XML.gl_print_base):
> >  
> >              #endif
> >          """)
> > -        return
> >  
> >      def printBody(self, api):
> >          for [name, number] in api.categoryIterate():
> > @@ -997,8 +981,6 @@ class PrintGlxProtoInit_c(gl_XML.gl_print_base):
> >                          print '    assert(o > 0);'
> >                          print '    table[o] = (_glapi_proc) __indirect_gl{0};'.format(func.name)
> >  
> > -        return
> > -
> >  
> >  class PrintGlxProtoInit_h(gl_XML.gl_print_base):
> >      def __init__(self):
> > @@ -1013,7 +995,6 @@ class PrintGlxProtoInit_h(gl_XML.gl_print_base):
> >          self.header_tag = "_INDIRECT_H_"
> >  
> >          self.last_category = ""
> > -        return
> >  
> >      def printRealHeader(self):
> >          print textwrap.dedent("""\
> > diff --git a/src/mapi/glapi/gen/glX_proto_size.py b/src/mapi/glapi/gen/glX_proto_size.py
> > index 7403b8b..0f505a2 100644
> > --- a/src/mapi/glapi/gen/glX_proto_size.py
> > +++ b/src/mapi/glapi/gen/glX_proto_size.py
> > @@ -90,8 +90,6 @@ class glx_enum_function(object):
> >                      self.enums[ e.value ] = [ e ]
> >                      self.count[ count ].append( e.value )
> >  
> > -        return
> > -
> >      def signature( self ):
> >          if self.sig == None:
> >              self.sig = ""
> > @@ -238,7 +236,6 @@ class glx_server_enum_function(glx_enum_function):
> >          glx_enum_function.__init__(self, func.name, enum_dict)
> >  
> >          self.function = func
> > -        return
> >  
> >      def signature( self ):
> >          if self.sig == None:
> > @@ -301,7 +298,6 @@ class PrintGlxSizeStubs_common(gl_XML.gl_print_base):
> >  
> >          self.emit_set = ((which_functions & PrintGlxSizeStubs_common.do_set) != 0)
> >          self.emit_get = ((which_functions & PrintGlxSizeStubs_common.do_get) != 0)
> > -        return
> >  
> >  
> >  class PrintGlxSizeStubs_c(PrintGlxSizeStubs_common):
> > @@ -503,8 +499,6 @@ class PrintGlxReqSize_c(PrintGlxReqSize_common):
> >          for [alias_name, real_name] in aliases:
> >              print 'ALIAS( %s, %s )' % (alias_name, real_name)
> >  
> > -        return
> > -
> >      def common_emit_fixups(self, fixup):
> >          """Utility function to emit conditional byte-swaps."""
> >  
> > @@ -514,14 +508,11 @@ class PrintGlxReqSize_c(PrintGlxReqSize_common):
> >                  print '        %s = bswap_32(%s);' % (name, name)
> >              print '    }'
> >  
> > -        return
> > -
> >      def common_emit_one_arg(self, p, pc, adjust):
> >          offset = p.offset
> >          dst = p.string()
> >          src = '(%s *)' % (p.type_string())
> >          print '%-18s = *%11s(%s + %u);' % (dst, src, pc, offset + adjust)
> > -        return
> >  
> >      def common_func_print_just_header(self, f):
> >          print 'int'
> > @@ -570,7 +561,6 @@ class PrintGlxReqSize_c(PrintGlxReqSize_common):
> >          print '                          skip_rows, alignment);'
> >          print '}'
> >          print ''
> > -        return
> >  
> >      def printCountedFunction(self, f):
> >  
> > diff --git a/src/mapi/glapi/gen/glX_server_table.py b/src/mapi/glapi/gen/glX_server_table.py
> > index 37ed971..b88c5e3 100644
> > --- a/src/mapi/glapi/gen/glX_server_table.py
> > +++ b/src/mapi/glapi/gen/glX_server_table.py
> > @@ -69,7 +69,6 @@ class function_table:
> >          # Minimum number of opcodes in a leaf node.
> >          self.min_op_bits = 3
> >          self.min_op_count = (1 << self.min_op_bits)
> > -        return
> >  
> >      def append(self, opcode, func):
> >          self.functions[opcode] = func
> > @@ -84,7 +83,6 @@ class function_table:
> >  
> >                  self.max_bits = bits
> >                  self.next_opcode_threshold = 1 << bits
> > -        return
> >  
> >      def divide_group(self, min_opcode, total):
> >          """Divide the group starting min_opcode into subgroups.
> > @@ -334,7 +332,6 @@ class function_table:
> >              print '    NULL,'
> >              print '    NULL'
> >          print '};\n'
> > -        return
> >  
> >  
> >  class PrintGlxDispatchTables(glX_proto_common.glx_print_proto):
> > @@ -346,7 +343,6 @@ class PrintGlxDispatchTables(glX_proto_common.glx_print_proto):
> >          self.rop_functions = function_table("Render", 1)
> >          self.sop_functions = function_table("Single", 0)
> >          self.vop_functions = function_table("VendorPriv", 0)
> > -        return
> >  
> >      def printRealHeader(self):
> >          print '#include <inttypes.h>'
> > @@ -356,7 +352,6 @@ class PrintGlxDispatchTables(glX_proto_common.glx_print_proto):
> >          print '#include "indirect_reqsize.h"'
> >          print '#include "indirect_table.h"'
> >          print ''
> > -        return
> >  
> >      def printBody(self, api):
> >          for f in api.functionIterateAll():
> > @@ -371,7 +366,6 @@ class PrintGlxDispatchTables(glX_proto_common.glx_print_proto):
> >          self.sop_functions.Print()
> >          self.rop_functions.Print()
> >          self.vop_functions.Print()
> > -        return
> >  
> >  
> >  def _parser():
> > diff --git a/src/mapi/glapi/gen/gl_SPARC_asm.py b/src/mapi/glapi/gen/gl_SPARC_asm.py
> > index 954b637..b72caac 100644
> > --- a/src/mapi/glapi/gen/gl_SPARC_asm.py
> > +++ b/src/mapi/glapi/gen/gl_SPARC_asm.py
> > @@ -214,14 +214,12 @@ class PrintGenericStubs(gl_XML.gl_print_base):
> >          print '    HIDDEN(gl_dispatch_functions_start)'
> >          print 'gl_dispatch_functions_start:'
> >          print ''
> > -        return
> >  
> >      def printRealFooter(self):
> >          print ''
> >          print '    .globl    gl_dispatch_functions_end'
> >          print '    HIDDEN(gl_dispatch_functions_end)'
> >          print 'gl_dispatch_functions_end:'
> > -        return
> >  
> >      def printBody(self, api):
> >          for f in api.functionIterateByOffset():
> > @@ -247,8 +245,6 @@ class PrintGenericStubs(gl_XML.gl_print_base):
> >                          else:
> >                              print text
> >  
> > -        return
> > -
> >  
> >  def _parser():
> >      """Parse arguments and return a namespace."""
> > diff --git a/src/mapi/glapi/gen/gl_XML.py b/src/mapi/glapi/gen/gl_XML.py
> > index c28ab61..8477341 100644
> > --- a/src/mapi/glapi/gen/gl_XML.py
> > +++ b/src/mapi/glapi/gen/gl_XML.py
> > @@ -116,13 +116,11 @@ class gl_print_base(object):
> >          # the header file.
> >  
> >          self.undef_list = []
> > -        return
> >  
> >      def Print(self, api):
> >          self.printHeader()
> >          self.printBody(api)
> >          self.printFooter()
> > -        return
> >  
> >      def printHeader(self):
> >          """Print the header associated with all files and call the printRealHeader method."""
> > @@ -139,7 +137,6 @@ class gl_print_base(object):
> >              print '#  define %s' % (self.header_tag)
> >              print ''
> >          self.printRealHeader()
> > -        return
> >  
> >      def printFooter(self):
> >          """Print the header associated with all files and call the printRealFooter method."""
> > @@ -160,14 +157,12 @@ class gl_print_base(object):
> >  
> >          In the base class, this function is empty.  All derived
> >          classes should over-ride this function."""
> > -        return
> >  
> >      def printRealFooter(self):
> >          """Print the "real" footer for the created file.
> >  
> >          In the base class, this function is empty.  All derived
> >          classes should over-ride this function."""
> > -        return
> >  
> >      def printPure(self):
> >          """Conditionally define `PURE' function attribute.
> > @@ -187,7 +182,6 @@ class gl_print_base(object):
> >              #    define PURE
> >              #  endif
> >          """)
> > -        return
> >  
> >      def printFastcall(self):
> >          """Conditionally define `FASTCALL' function attribute.
> > @@ -208,7 +202,6 @@ class gl_print_base(object):
> >              #    define FASTCALL
> >              #  endif
> >          """)
> > -        return
> >  
> >      def printVisibility(self, S, s):
> >          """Conditionally define visibility function attribute.
> > @@ -229,7 +222,6 @@ class gl_print_base(object):
> >              #    define %s
> >              #  endif
> >          """ % (S, s, S))
> > -        return
> >  
> >      def printNoinline(self):
> >          """Conditionally define `NOINLINE' function attribute.
> > @@ -250,7 +242,7 @@ class gl_print_base(object):
> >              #    define NOINLINE
> >              #  endif
> >          """)
> > -        return
> > +
> >  
> >  def real_function_name(element):
> >      name = element.get( "name" )
> > @@ -327,8 +319,6 @@ class gl_item(object):
> >          self.name = element.get( "name" )
> >          self.category = real_category_name( category )
> >  
> > -        return
> > -
> >  
> >  class gl_type( gl_item ):
> >      def __init__(self, element, context, category):
> > @@ -345,7 +335,6 @@ class gl_type( gl_item ):
> >          te.set_base_type_node( tn )
> >  
> >          self.type_expr = te
> > -        return
> >  
> >  
> >      def get_type_expression(self):
> > @@ -368,8 +357,6 @@ class gl_enum( gl_item ):
> >  
> >              self.default_count = c
> >  
> > -        return
> > -
> >  
> >      def priority(self):
> >          """Calculate a 'priority' for this enum name.
> > @@ -466,7 +453,6 @@ class gl_parameter(object):
> >          self.img_send_null      = is_attr_true( element, 'img_send_null' )
> >  
> >          self.is_padding = is_attr_true( element, 'padding' )
> > -        return
> >  
> >      def compatible(self, other):
> >          return 1
> > @@ -626,8 +612,6 @@ class gl_function( gl_item ):
> >  
> >          self.process_element( element )
> >  
> > -        return
> > -
> >      def process_element(self, element):
> >          name = element.get( "name" )
> >          alias = element.get( "alias" )
> > @@ -721,8 +705,6 @@ class gl_function( gl_item ):
> >          else:
> >              self.entry_point_parameters[name] = []
> >  
> > -        return
> > -
> >      def filter_entry_points(self, entry_point_list):
> >          """Filter out entry points not in entry_point_list."""
> >          if not self.initialized:
> > @@ -843,7 +825,6 @@ class gl_api(object):
> >          self.next_offset = 0
> >  
> >          typeexpr.create_initial_types()
> > -        return
> >  
> >      def filter_functions(self, entry_point_list):
> >          """Filter out entry points not in entry_point_list."""
> > @@ -877,7 +858,6 @@ class gl_api(object):
> >          element = doc.getroot()
> >          if element.tag == "OpenGLAPI":
> >              self.process_OpenGLAPI(file_name, element)
> > -        return
> >  
> >      def process_OpenGLAPI(self, file_name, element):
> >          for child in element.getchildren():
> > @@ -890,8 +870,6 @@ class gl_api(object):
> >                  href = os.path.join(os.path.dirname(file_name), href)
> >                  self.parse_file(href)
> >  
> > -        return
> > -
> >      def process_category(self, cat):
> >          cat_name = cat.get( "name" )
> >          cat_number = cat.get( "number" )
> > @@ -923,8 +901,6 @@ class gl_api(object):
> >                  t = self.factory.create_type( child, self, cat_name )
> >                  self.types_by_name[ "GL" + t.name ] = t
> >  
> > -        return
> > -
> >      def functionIterateByCategory(self, cat = None):
> >          """Iterate over functions by category.
> >  
> > diff --git a/src/mapi/glapi/gen/gl_apitemp.py b/src/mapi/glapi/gen/gl_apitemp.py
> > index ebe6600..ceede11 100644
> > --- a/src/mapi/glapi/gen/gl_apitemp.py
> > +++ b/src/mapi/glapi/gen/gl_apitemp.py
> > @@ -117,7 +117,6 @@ class PrintGlOffsets(gl_XML.gl_print_base):
> >                      % (dispatch, f.name, p_string, name, t_string, o_string)
> >          print '}'
> >          print ''
> > -        return
> >  
> >      def printRealHeader(self):
> >          print ''
> > @@ -169,7 +168,6 @@ class PrintGlOffsets(gl_XML.gl_print_base):
> >              #error RETURN_DISPATCH must be defined
> >              #endif
> >          """)
> > -        return
> >  
> >      def printInitDispatch(self, api):
> >          print textwrap.dedent("""\
> > @@ -204,7 +202,6 @@ class PrintGlOffsets(gl_XML.gl_print_base):
> >          print '};'
> >          print '#endif /* DISPATCH_TABLE_NAME */'
> >          print ''
> > -        return
> >  
> >      def printAliasedTable(self, api):
> >          print textwrap.dedent("""\
> > @@ -245,7 +242,6 @@ class PrintGlOffsets(gl_XML.gl_print_base):
> >          print '};'
> >          print '#endif /*UNUSED_TABLE_NAME*/'
> >          print ''
> > -        return
> >  
> >      def classifyEntryPoints(self, func):
> >          normal_names = []
> > @@ -300,7 +296,6 @@ class PrintGlOffsets(gl_XML.gl_print_base):
> >  
> >          self.printInitDispatch(api)
> >          self.printAliasedTable(api)
> > -        return
> >  
> >  
> >  def _parser():
> > diff --git a/src/mapi/glapi/gen/gl_enums.py b/src/mapi/glapi/gen/gl_enums.py
> > index a55479c..b2bda99 100644
> > --- a/src/mapi/glapi/gen/gl_enums.py
> > +++ b/src/mapi/glapi/gen/gl_enums.py
> > @@ -60,7 +60,6 @@ class PrintGlEnums(gl_XML.gl_print_base):
> >          print '   int n;'
> >          print '} enum_elt;'
> >          print ''
> > -        return
> >  
> >      def print_code(self):
> >          print textwrap.dedent("""\
> > @@ -140,7 +139,6 @@ class PrintGlEnums(gl_XML.gl_print_base):
> >                    return "invalid mode";
> >              }
> >          """)
> > -        return
> >  
> >      def printBody(self, xml):
> >          self.process_enums(xml)
> > @@ -180,7 +178,6 @@ class PrintGlEnums(gl_XML.gl_print_base):
> >          print ''
> >  
> >          self.print_code()
> > -        return
> >  
> >      def add_enum_provider(self, name, priority):
> >          value = self.string_to_int[name]
> > diff --git a/src/mapi/glapi/gen/gl_gentable.py b/src/mapi/glapi/gen/gl_gentable.py
> > index 82be310..e8d45fb 100644
> > --- a/src/mapi/glapi/gen/gl_gentable.py
> > +++ b/src/mapi/glapi/gen/gl_gentable.py
> > @@ -163,8 +163,6 @@ class PrintCode(gl_XML.gl_print_base):
> >                  (C) Copyright Apple Inc 2011"""),
> >              "BRIAN PAUL, IBM")
> >  
> > -        return
> > -
> >      def get_stack_size(self, f):
> >          size = 0
> >          for p in f.parameterIterator():
> > @@ -177,11 +175,9 @@ class PrintCode(gl_XML.gl_print_base):
> >  
> >      def printRealHeader(self):
> >          print header
> > -        return
> >  
> >      def printRealFooter(self):
> >          print footer
> > -        return
> >  
> >      def printBody(self, api):
> >  
> > @@ -211,8 +207,6 @@ class PrintCode(gl_XML.gl_print_base):
> >              print "    /* %5d */ \"%s\"," % (i, funcnames[i])
> >          print "};"
> >  
> > -        return
> > -
> >  
> >  def _parser():
> >      """Parse arguments and return a namespace object."""
> > diff --git a/src/mapi/glapi/gen/gl_procs.py b/src/mapi/glapi/gen/gl_procs.py
> > index 608ca40..eb4e846 100644
> > --- a/src/mapi/glapi/gen/gl_procs.py
> > +++ b/src/mapi/glapi/gen/gl_procs.py
> > @@ -70,12 +70,10 @@ class PrintGlProcs(gl_XML.gl_print_base):
> >              #  define NAME_FUNC_OFFSET(n,f1,f2,f3,o) { n , (_glapi_proc) f3 , o }
> >              #endif
> >          """)
> > -        return
> >  
> >      def printRealFooter(self):
> >          print ''
> >          print '#undef NAME_FUNC_OFFSET'
> > -        return
> >  
> >      def printFunctionString(self, name):
> >          print '    "gl%s\\0"' % (name)
> > @@ -161,7 +159,6 @@ class PrintGlProcs(gl_XML.gl_print_base):
> >  
> >          print '    NAME_FUNC_OFFSET(-1, NULL, NULL, NULL, 0)'
> >          print '};'
> > -        return
> >  
> >  
> >  def _parser():
> > diff --git a/src/mapi/glapi/gen/gl_table.py b/src/mapi/glapi/gen/gl_table.py
> > index 0cc0493..52e5d08 100644
> > --- a/src/mapi/glapi/gen/gl_table.py
> > +++ b/src/mapi/glapi/gen/gl_table.py
> > @@ -46,7 +46,6 @@ class PrintGlTable(gl_XML.gl_print_base):
> >                  (C) Copyright IBM Corporation 2004"""),
> >              "BRIAN PAUL, IBM")
> >          self.ifdef_emitted = False
> > -        return
> >  
> >      def printBody(self, api):
> >          for f in api.functionIterateByOffset():
> > @@ -71,11 +70,9 @@ class PrintGlTable(gl_XML.gl_print_base):
> >          print ''
> >          print 'struct _glapi_table'
> >          print '{'
> > -        return
> >  
> >      def printRealFooter(self):
> >          print '};'
> > -        return
> >  
> >  
> >  class PrintRemapTable(gl_XML.gl_print_base):
> > @@ -86,7 +83,6 @@ class PrintRemapTable(gl_XML.gl_print_base):
> >          self.name = "gl_table.py (from Mesa)"
> >          self.license = license.bsd_license_template % (
> >              "(C) Copyright IBM Corporation 2005", "IBM")
> > -        return
> >  
> >      def printRealHeader(self):
> >          print textwrap.dedent("""\
> > @@ -101,7 +97,6 @@ class PrintRemapTable(gl_XML.gl_print_base):
> >               * named function in the specified dispatch table.
> >               */
> >          """)
> > -        return
> >  
> >      def printBody(self, api):
> >          print '#define CALL_by_offset(disp, cast, offset, parameters) \\'
> > @@ -169,8 +164,6 @@ class PrintRemapTable(gl_XML.gl_print_base):
> >              print '}'
> >              print
> >  
> > -        return
> > -
> >  
> >  def _parser():
> >      """Parse arguments and return a namespace."""
> > diff --git a/src/mapi/glapi/gen/gl_x86-64_asm.py b/src/mapi/glapi/gen/gl_x86-64_asm.py
> > index bdb9a0f..d0e8f8e 100644
> > --- a/src/mapi/glapi/gen/gl_x86-64_asm.py
> > +++ b/src/mapi/glapi/gen/gl_x86-64_asm.py
> > @@ -62,7 +62,6 @@ def save_all_regs(registers):
> >  
> >      for [reg, stack_offset] in registers:
> >          save_reg( reg, stack_offset, adjust_stack )
> > -    return
> >  
> >  
> >  def restore_all_regs(registers):
> > @@ -77,7 +76,6 @@ def restore_all_regs(registers):
> >  
> >      if adjust_stack:
> >          print '    addq    $%u, %%rsp' % (adjust_stack)
> > -    return
> >  
> >  
> >  def save_reg(reg, offset, use_move):
> > @@ -89,8 +87,6 @@ def save_reg(reg, offset, use_move):
> >      else:
> >          print '    pushq    %s' % (reg)
> >  
> > -    return
> > -
> >  
> >  def restore_reg(reg, offset, use_move):
> >      if use_move:
> > @@ -101,8 +97,6 @@ def restore_reg(reg, offset, use_move):
> >      else:
> >          print '    popq    %s' % (reg)
> >  
> > -    return
> > -
> >  
> >  class PrintGenericStubs(gl_XML.gl_print_base):
> >      def __init__(self):
> > @@ -110,7 +104,6 @@ class PrintGenericStubs(gl_XML.gl_print_base):
> >  
> >          self.name = "gl_x86-64_asm.py (from Mesa)"
> >          self.license = license.bsd_license_template % ("(C) Copyright IBM Corporation 2005", "IBM")
> > -        return
> >  
> >      def get_stack_size(self, f):
> >          size = 0
> > @@ -168,14 +161,12 @@ class PrintGenericStubs(gl_XML.gl_print_base):
> >          print ''
> >          print '#endif'
> >          print ''
> > -        return
> >  
> >      def printRealFooter(self):
> >          print ''
> >          print '#if defined (__ELF__) && defined (__linux__)'
> >          print '      .section .note.GNU-stack,"",%progbits'
> >          print '#endif'
> > -        return
> >  
> >      def printFunction(self, f):
> >  
> > @@ -258,7 +249,6 @@ class PrintGenericStubs(gl_XML.gl_print_base):
> >  
> >          print '    .size    GL_PREFIX(%s), .-GL_PREFIX(%s)' % (name, name)
> >          print ''
> > -        return
> >  
> >      def printBody(self, api):
> >          for f in api.functionIterateByOffset():
> > @@ -278,8 +268,6 @@ class PrintGenericStubs(gl_XML.gl_print_base):
> >                          else:
> >                              print text
> >  
> > -        return
> > -
> >  
> >  def _parser():
> >      """Parse arguments and return a namespace."""
> > diff --git a/src/mapi/glapi/gen/gl_x86_asm.py b/src/mapi/glapi/gen/gl_x86_asm.py
> > index 6d7c15d..f2825cf 100644
> > --- a/src/mapi/glapi/gen/gl_x86_asm.py
> > +++ b/src/mapi/glapi/gen/gl_x86_asm.py
> > @@ -44,7 +44,6 @@ class PrintGenericStubs(gl_XML.gl_print_base):
> >                  Copyright (C) 1999-2001  Brian Paul   All Rights Reserved.
> >                  (C) Copyright IBM Corporation 2004, 2005"""),
> >              "BRIAN PAUL, IBM")
> > -        return
> >  
> >      def get_stack_size(self, f):
> >          size = 0
> > @@ -173,7 +172,6 @@ class PrintGenericStubs(gl_XML.gl_print_base):
> >          print '        HIDDEN(GLNAME(gl_dispatch_functions_start))'
> >          print 'GLNAME(gl_dispatch_functions_start):'
> >          print ''
> > -        return
> >  
> >      def printRealFooter(self):
> >          print ''
> > @@ -185,7 +183,6 @@ class PrintGenericStubs(gl_XML.gl_print_base):
> >          print '#if defined (__ELF__) && defined (__linux__)'
> >          print '      .section .note.GNU-stack,"",%progbits'
> >          print '#endif'
> > -        return
> >  
> >      def printBody(self, api):
> >          for f in api.functionIterateByOffset():
> > @@ -216,8 +213,6 @@ class PrintGenericStubs(gl_XML.gl_print_base):
> >                          else:
> >                              print text
> >  
> > -        return
> > -
> >  
> >  def _parser():
> >      parser = argparse.ArgumentParser()
> > diff --git a/src/mapi/glapi/gen/remap_helper.py b/src/mapi/glapi/gen/remap_helper.py
> > index 1e99884..e2fa0e8 100644
> > --- a/src/mapi/glapi/gen/remap_helper.py
> > +++ b/src/mapi/glapi/gen/remap_helper.py
> > @@ -64,13 +64,11 @@ class PrintGlRemap(gl_XML.gl_print_base):
> >  
> >          self.name = "remap_helper.py (from Mesa)"
> >          self.license = license.bsd_license_template % ("Copyright (C) 2009 Chia-I Wu <olv at 0xlab.org>", "Chia-I Wu")
> > -        return
> >  
> >      def printRealHeader(self):
> >          print '#include "main/dispatch.h"'
> >          print '#include "main/remap.h"'
> >          print ''
> > -        return
> >  
> >      def printBody(self, api):
> >          pool_indices = {}
> > @@ -162,7 +160,6 @@ class PrintGlRemap(gl_XML.gl_print_base):
> >          print '   {    -1, -1 }'
> >          print '};'
> >          print ''
> > -        return
> >  
> >  
> >  def _parser():
> > diff --git a/src/mapi/glapi/gen/typeexpr.py b/src/mapi/glapi/gen/typeexpr.py
> > index e48a6eb..75fb9d9 100644
> > --- a/src/mapi/glapi/gen/typeexpr.py
> > +++ b/src/mapi/glapi/gen/typeexpr.py
> > @@ -42,7 +42,6 @@ class type_node(object):
> >  
> >          self.name = None
> >          self.size = 0     # type's size in bytes
> > -        return
> >  
> >      def string(self):
> >          """Return string representation of this type_node."""
> > @@ -70,11 +69,9 @@ class type_node(object):
> >  class type_table(object):
> >      def __init__(self):
> >          self.types_by_name = {}
> > -        return
> >  
> >      def add_type(self, type_expr):
> >          self.types_by_name[ type_expr.get_base_name() ] = type_expr
> > -        return
> >  
> >      def find_type(self, name):
> >          if name in self.types_by_name:
> > @@ -106,7 +103,6 @@ def create_initial_types():
> >          tt.add_type( te )
> >  
> >      type_expression.built_in_types = tt
> > -    return
> >  
> >  
> >  class type_expression(object):
> > @@ -184,8 +180,6 @@ class type_expression(object):
> >          if signed:
> >              raise RuntimeError("Invalid type expression (dangling unsigned)")
> >  
> > -        return
> > -
> >      def set_base_type(self, type_name, signed, unsigned, const, extra_types):
> >          te = type_expression.built_in_types.find_type( type_name )
> >          if not te:
> > @@ -205,13 +199,11 @@ class type_expression(object):
> >  
> >      def set_base_type_node(self, tn):
> >          self.expr = [tn]
> > -        return
> >  
> >      def set_elements(self, count):
> >          tn = self.expr[0]
> >  
> >          tn.elements = count
> > -        return
> >  
> >      def string(self):
> >          s = ""
> > 
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: signature
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20160419/571aef47/attachment-0001.sig>


More information about the mesa-dev mailing list