summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGustavo Noronha Silva <gustavo.noronha@collabora.co.uk>2010-08-17 11:31:17 -0300
committerGustavo Noronha Silva <gns@gnome.org>2010-08-17 11:43:31 -0300
commit5e45b27c31df528672134961e4655d5fca08cbc7 (patch)
tree7cf55185817927d1717d042f4fa3de3a722967aa
parent883a5aed32e80eb57c8b3089faa58768be2d7364 (diff)
downloadgobject-introspection-5e45b27c31df528672134961e4655d5fca08cbc7.tar.gz
[scanner] Also parse C++ files
This is to support cases such as WebKitGTK+, that have C API implemented in C++ files. Do note this does not mean we support proper C++ parsing. https://bugzilla.gnome.org/show_bug.cgi?id=627152
-rw-r--r--giscanner/scannermain.py8
-rw-r--r--giscanner/sourcescanner.py3
2 files changed, 8 insertions, 3 deletions
diff --git a/giscanner/scannermain.py b/giscanner/scannermain.py
index 363f6f6d..36942826 100644
--- a/giscanner/scannermain.py
+++ b/giscanner/scannermain.py
@@ -266,8 +266,12 @@ def scanner_main(args):
filenames = []
for arg in args:
- if (arg.endswith('.c') or
- arg.endswith('.h')):
+ # We don't support real C++ parsing yet, but we should be able
+ # to understand C API implemented in C++ files.
+ if (arg.endswith('.c') or arg.endswith('.cpp') or
+ arg.endswith('.cc') or arg.endswith('.cxx') or
+ arg.endswith('.h') or arg.endswith('.hpp') or
+ arg.endswith('.hxx')):
if not os.path.exists(arg):
_error('%s: no such a file or directory' % (arg, ))
# Make absolute, because we do comparisons inside scannerparser.c
diff --git a/giscanner/sourcescanner.py b/giscanner/sourcescanner.py
index ae3d29d2..cd7a4321 100644
--- a/giscanner/sourcescanner.py
+++ b/giscanner/sourcescanner.py
@@ -220,7 +220,8 @@ class SourceScanner(object):
headers = []
for filename in filenames:
- if filename.endswith('.c'):
+ if (filename.endswith('.c') or filename.endswith('.cpp') or
+ filename.endswith('.cc') or filename.endswith('.cxx')):
filename = os.path.abspath(filename)
self._scanner.lex_filename(filename)
else: