Skip to content

Commit c0beee8

Browse files
authored
Merge pull request #250 from CastXML/va
fix: remove f1 flag, cleanup problematic declarations correctly
2 parents 446e873 + e303401 commit c0beee8

File tree

3 files changed

+13
-128
lines changed

3 files changed

+13
-128
lines changed

docs/faq.rst

+3
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@ Currently this adds the support for elaborated type specifiers.
9898
\_\_va_list_tag and other hidden declarations (f1)
9999
--------------------------------------------------
100100

101+
!!! This flag has been removed from pygccxml > 2.6
102+
We will now always remove these declarations
103+
101104
When parsing with CastXML, the XML tree can contain declarations named
102105
``__va_list_tag``. If the compiler is llvm 3.9, ``__NSConstantString_tag``
103106
and ``__NSConstantString`` declarations may also be present.

src/pygccxml/parser/scanner.py

+10-12
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,15 @@ def __init__(self, xml_file, decl_factory, config, *args):
197197
"__vr_offs",
198198
]
199199

200+
# With CastXML and clang some __va_list_tag declarations are
201+
# present in the tree
202+
# With llvm 3.9 there is a __NSConstantString(_tag) in the tree
203+
self.__declarations_to_skip = [
204+
"__va_list_tag",
205+
"__NSConstantString_tag",
206+
"__NSConstantString"
207+
]
208+
200209
self.__xml_generator_from_xml_file = None
201210

202211
@property
@@ -297,21 +306,10 @@ def startElement(self, name, attrs):
297306
self.__read_access(attrs)
298307
element_id = attrs.get(XML_AN_ID)
299308

300-
# With CastXML and clang some __va_list_tag declarations are
301-
# present in the tree: we do not want to have these in the tree.
302-
# With llvm 3.9 there is a __NSConstantString(_tag) in the tree
303-
# We hide these declarations by default
304-
rm1 = "f1" not in self.config.flags
305-
names = [
306-
"__va_list_tag",
307-
"__NSConstantString_tag",
308-
"__NSConstantString"]
309-
310309
if isinstance(obj, declarations.declaration_t):
311310

312-
if rm1 and str(obj.name) in names:
311+
if obj.name in self.__declarations_to_skip:
313312
return
314-
315313
self.__update_membership(attrs)
316314
self.__declarations[element_id] = obj
317315
if not isinstance(obj, declarations.namespace_t):

tests/test_va_list_tag_removal.py

-116
This file was deleted.

0 commit comments

Comments
 (0)