Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(196)

Side by Side Diff: ppapi/generators/idl_c_proto.py

Issue 11419192: Make PPAPI headers compilable with -Wstrict-prototypes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """ Generator for C style prototypes and definitions """ 6 """ Generator for C style prototypes and definitions """
7 7
8 import glob 8 import glob
9 import os 9 import os
10 import sys 10 import sys
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 name = prefix + name + arrayspec 405 name = prefix + name + arrayspec
406 if callspec is None: 406 if callspec is None:
407 out = '%s %s' % (rtype, name) 407 out = '%s %s' % (rtype, name)
408 else: 408 else:
409 params = [] 409 params = []
410 for ptype, pname, parray, pspec in callspec: 410 for ptype, pname, parray, pspec in callspec:
411 params.append(self.Compose(ptype, pname, parray, pspec, '', True, 411 params.append(self.Compose(ptype, pname, parray, pspec, '', True,
412 ptr_prefix='', include_name=True)) 412 ptr_prefix='', include_name=True))
413 if func_as_ptr: 413 if func_as_ptr:
414 name = '(%s*%s)' % (ptr_prefix, name) 414 name = '(%s*%s)' % (ptr_prefix, name)
415 if not params:
416 params = ['void']
415 out = '%s %s(%s)' % (rtype, name, ', '.join(params)) 417 out = '%s %s(%s)' % (rtype, name, ', '.join(params))
416 self.LogExit('Exit Compose: %s' % out) 418 self.LogExit('Exit Compose: %s' % out)
417 return out 419 return out
418 420
419 # 421 #
420 # GetSignature 422 # GetSignature
421 # 423 #
422 # Returns the 'C' style signature of the object 424 # Returns the 'C' style signature of the object
423 # prefix - A prefix for the object's name 425 # prefix - A prefix for the object's name
424 # func_as_ptr - Formats a function as a function pointer 426 # func_as_ptr - Formats a function as a function pointer
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 if f.GetProperty('ERRORS') > 0: 711 if f.GetProperty('ERRORS') > 0:
710 print 'Skipping %s' % f.GetName() 712 print 'Skipping %s' % f.GetName()
711 continue 713 continue
712 for node in f.GetChildren()[2:]: 714 for node in f.GetChildren()[2:]:
713 print cgen.Define(node, comment=True, prefix='tst_') 715 print cgen.Define(node, comment=True, prefix='tst_')
714 716
715 717
716 if __name__ == '__main__': 718 if __name__ == '__main__':
717 sys.exit(Main(sys.argv[1:])) 719 sys.exit(Main(sys.argv[1:]))
718 720
OLDNEW
« no previous file with comments | « ppapi/c/private/ppb_nacl_private.h ('k') | ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698