[gtk-doc] scan: enable the new exception
- From: Stefan Sauer <stefkost src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk-doc] scan: enable the new exception
- Date: Sun, 14 Jul 2019 06:18:12 +0000 (UTC)
commit 58094106b0e41dec2414f6318d13c0e8381ac10e
Author: Stefan Sauer <ensonic users sf net>
Date: Sat Jul 13 23:15:23 2019 -0700
scan: enable the new exception
Fixed one test and removed the other one as is was non-sense one. Add code
to handle the exception one level up.
gtkdoc/scan.py | 27 +++++++++++++++------------
tests/scan.py | 14 ++++++--------
2 files changed, 21 insertions(+), 20 deletions(-)
---
diff --git a/gtkdoc/scan.py b/gtkdoc/scan.py
index f6d62fb..2a7214d 100644
--- a/gtkdoc/scan.py
+++ b/gtkdoc/scan.py
@@ -313,20 +313,24 @@ def ScanHeader(input_file, section_list, decl_list, get_types, seen_headers, opt
with open(input_file, 'r', encoding='utf-8') as hdr:
input_lines = hdr.readlines()
- slist, doc_comments = ScanHeaderContent(input_lines, decl_list, get_types, options)
+ try:
+ slist, doc_comments = ScanHeaderContent(input_lines, decl_list, get_types, options)
+ logging.info("Scanning %s done", input_file)
- logging.info("Scanning %s done", input_file)
-
- liststr = SeparateSubSections(slist, doc_comments)
- if liststr != '':
- if file_basename not in section_list:
- section_list[file_basename] = ''
- section_list[file_basename] += "<SECTION>\n<FILE>%s</FILE>\n%s</SECTION>\n\n" % (file_basename,
liststr)
+ liststr = SeparateSubSections(slist, doc_comments)
+ if liststr != '':
+ if file_basename not in section_list:
+ section_list[file_basename] = ''
+ section_list[file_basename] += "<SECTION>\n<FILE>%s</FILE>\n%s</SECTION>\n\n" % (file_basename,
liststr)
+ except RuntimeError as e:
+ common.LogWarning(input_file, 0, str(e))
# Scan the the given content lines.
# Returns: a list of symbols found and a set of symbols for which we have a
# doc-comment
+
+
def ScanHeaderContent(input_lines, decl_list, get_types, options):
# Holds the resulting list of declarations.
slist = []
@@ -918,10 +922,9 @@ def ScanHeaderContent(input_lines, decl_list, get_types, options):
pre_previous_line = previous_line
previous_line = line
- # here we want in_declaration=='', otherwise we have a partial symbol
- # TODO: this breaks two tests, fix that first and then enable
- #if in_declaration != '':
- # raise RuntimeError('partial declaration (%s) : %s ' % (in_declaration, decl))
+ # here we want in_declaration=='', otherwise we have a partial declaration
+ if in_declaration != '':
+ raise RuntimeError('partial declaration (%s) : %s ' % (in_declaration, decl))
# print remaining forward declarations
for symbol in sorted(forward_decls.keys()):
diff --git a/tests/scan.py b/tests/scan.py
index 55d675a..57b4603 100755
--- a/tests/scan.py
+++ b/tests/scan.py
@@ -456,7 +456,7 @@ class ScanHeaderContentStructs(ScanHeaderContentTestCase):
slist, doc_comments = self.scanHeaderContent([header])
self.assertNoDeclFound(slist)
- def test_IgnoresPrivteStruct(self):
+ def test_IgnoresPrivateStruct(self):
header = 'struct _x;'
slist, doc_comments = self.scanHeaderContent([header])
self.assertNoDeclFound(slist)
@@ -515,8 +515,8 @@ class ScanHeaderContentUnions(ScanHeaderContentTestCase):
slist, doc_comments = self.scanHeaderContent([header])
self.assertNoDeclFound(slist)
- def test_IgnoresPrivteStruct(self):
- header = 'union _x x;'
+ def test_IgnoresPrivateUnion(self):
+ header = 'union _x;'
slist, doc_comments = self.scanHeaderContent([header])
self.assertNoDeclFound(slist)
@@ -663,11 +663,6 @@ class ScanHeaderContentTypedefs(ScanHeaderContentTestCase):
slist, doc_comments = self.scanHeaderContent([header])
self.assertDecl('uint', header, slist)
- def test_SkipsEnumTypedefDifferentName(self):
- header = 'typedef enum data dateenum;'
- slist, doc_comments = self.scanHeaderContent([header])
- self.assertNoDeclFound(slist)
-
def test_SkipsEnumTypedefUnderscoreName(self):
header = 'typedef enum _data data;'
slist, doc_comments = self.scanHeaderContent([header])
@@ -771,6 +766,9 @@ class SeparateSubSections(ScanHeaderContentTestCase):
if __name__ == '__main__':
+ from gtkdoc import common
+ common.setup_logging()
+
unittest.main()
# from gtkdoc import common
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]