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

Side by Side Diff: tools/generate_shim_headers/generate_shim_headers.py

Issue 12224030: Linux: add option to use system tcmalloc (off by default) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 10 months 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
« no previous file with comments | « content/renderer/devtools/devtools_agent.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 """ 6 """
7 Generates shim headers that mirror the directory structure of bundled headers, 7 Generates shim headers that mirror the directory structure of bundled headers,
8 but just forward to the system ones. 8 but just forward to the system ones.
9 9
10 This allows seamless compilation against system headers with no changes 10 This allows seamless compilation against system headers with no changes
(...skipping 11 matching lines...) Expand all
22 #error shim headers must not be used in official builds! 22 #error shim headers must not be used in official builds!
23 #endif 23 #endif
24 """ 24 """
25 25
26 26
27 def GeneratorMain(argv): 27 def GeneratorMain(argv):
28 parser = optparse.OptionParser() 28 parser = optparse.OptionParser()
29 parser.add_option('--headers-root', action='append') 29 parser.add_option('--headers-root', action='append')
30 parser.add_option('--define', action='append') 30 parser.add_option('--define', action='append')
31 parser.add_option('--output-directory') 31 parser.add_option('--output-directory')
32 parser.add_option('--prefix', default='')
32 parser.add_option('--use-include-next', action='store_true') 33 parser.add_option('--use-include-next', action='store_true')
33 parser.add_option('--outputs', action='store_true') 34 parser.add_option('--outputs', action='store_true')
34 parser.add_option('--generate', action='store_true') 35 parser.add_option('--generate', action='store_true')
35 36
36 options, args = parser.parse_args(argv) 37 options, args = parser.parse_args(argv)
37 38
38 if not options.headers_root: 39 if not options.headers_root:
39 parser.error('Missing --headers-root parameter.') 40 parser.error('Missing --headers-root parameter.')
40 if not options.output_directory: 41 if not options.output_directory:
41 parser.error('Missing --output-directory parameter.') 42 parser.error('Missing --output-directory parameter.')
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 # This non-standard push_macro extension is supported 74 # This non-standard push_macro extension is supported
74 # by compilers we support (GCC, clang). 75 # by compilers we support (GCC, clang).
75 f.write('#pragma push_macro("%s")\n' % key) 76 f.write('#pragma push_macro("%s")\n' % key)
76 f.write('#undef %s\n' % key) 77 f.write('#undef %s\n' % key)
77 f.write('#define %s %s\n' % (key, value)) 78 f.write('#define %s %s\n' % (key, value))
78 79
79 if include_before: 80 if include_before:
80 for header in include_before.split(':'): 81 for header in include_before.split(':'):
81 f.write('#include %s\n' % header) 82 f.write('#include %s\n' % header)
82 83
84 include_target = options.prefix + header_filename
83 if options.use_include_next: 85 if options.use_include_next:
84 f.write('#include_next <%s>\n' % header_filename) 86 f.write('#include_next <%s>\n' % include_target)
85 else: 87 else:
86 f.write('#include <%s>\n' % header_filename) 88 f.write('#include <%s>\n' % include_target)
87 89
88 if include_after: 90 if include_after:
89 for header in include_after.split(':'): 91 for header in include_after.split(':'):
90 f.write('#include %s\n' % header) 92 f.write('#include %s\n' % header)
91 93
92 if options.define: 94 if options.define:
93 for define in options.define: 95 for define in options.define:
94 key, value = define.split('=', 1) 96 key, value = define.split('=', 1)
95 # This non-standard pop_macro extension is supported 97 # This non-standard pop_macro extension is supported
96 # by compilers we support (GCC, clang). 98 # by compilers we support (GCC, clang).
97 f.write('#pragma pop_macro("%s")\n' % key) 99 f.write('#pragma pop_macro("%s")\n' % key)
98 100
99 101
100 def DoMain(argv): 102 def DoMain(argv):
101 return '\n'.join(GeneratorMain(argv)) 103 return '\n'.join(GeneratorMain(argv))
102 104
103 105
104 if __name__ == '__main__': 106 if __name__ == '__main__':
105 DoMain(sys.argv[1:]) 107 DoMain(sys.argv[1:])
OLDNEW
« no previous file with comments | « content/renderer/devtools/devtools_agent.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698