diff options
author | Johan Dahlin <johan@gnome.org> | 2008-08-22 21:24:47 +0000 |
---|---|---|
committer | Johan Dahlin <johan@src.gnome.org> | 2008-08-22 21:24:47 +0000 |
commit | d1fd7fbea2949f3e90d75342c26459578bab50d8 (patch) | |
tree | 45a57edc255c91eb5521e78d97a430b4da859e24 /giscanner/sourcescanner.py | |
parent | da26182ec67f950157e8c72efc06770a7b5f1bf5 (diff) | |
download | gobject-introspection-d1fd7fbea2949f3e90d75342c26459578bab50d8.tar.gz |
Send in undefs/defines via writing it directly to stdin of cpp instead of
2008-08-22 Johan Dahlin <johan@gnome.org>
* gir/Makefile.am:
* giscanner/sourcescanner.py:
Send in undefs/defines via writing it directly to stdin
of cpp instead of via arguments.
svn path=/trunk/; revision=463
Diffstat (limited to 'giscanner/sourcescanner.py')
-rw-r--r-- | giscanner/sourcescanner.py | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/giscanner/sourcescanner.py b/giscanner/sourcescanner.py index 092fda31..4315cdca 100644 --- a/giscanner/sourcescanner.py +++ b/giscanner/sourcescanner.py @@ -223,20 +223,18 @@ class SourceScanner(object): if not filenames: return - cpp_args = [ - 'cpp', - '-C', - '-U__GNUC__', - '-D__GI_SCANNER__', - # libintl.h has no types we care about and breaks - # cpp on some systems - '-D_LIBINTL_H', - '-I.', - ] + defines = ['__GI_SCANNER__'] + undefs = ['__GNUC__'] + cpp_args = ['cpp', '-C', '-I.'] + + # libintl.h has no types we care about and breaks + # cpp on some systems + defines.append('_LIBINTL_H') # Do not parse the normal glibconfig.h, use the # one we provide instead - cpp_args.append('-D__G_LIBCONFIG_H__') + defines.append('__G_LIBCONFIG_H__') + dirname = os.path.dirname(os.path.abspath(__file__)) includedir = os.path.join(dirname, '..', 'giscanner') if not os.path.exists(includedir): @@ -247,7 +245,12 @@ class SourceScanner(object): proc = subprocess.Popen(cpp_args, stdin=subprocess.PIPE, stdout=subprocess.PIPE) - + for define in defines: + proc.stdin.write('#ifndef %s\n' % (define, )) + proc.stdin.write('# define %s\n' % (define, )) + proc.stdin.write('#endif\n') + for undef in undefs: + proc.stdin.write('#undef %s\n' % (undef, )) for filename in filenames: filename = os.path.abspath(filename) proc.stdin.write('#include <%s>\n' % (filename, )) |