Skip to content

Commit

Permalink
Merge pull request CastXML#178 from iMichka/cleanup
Browse files Browse the repository at this point in the history
cleanup: remove old code related to gccxml
  • Loading branch information
iMichka authored Apr 14, 2024
2 parents 6d4544c + 4a5f371 commit f57ddbb
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 69 deletions.
2 changes: 1 addition & 1 deletion docs/install.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ These instructions are only here for historical reasons. `GCC-XML`_ was the tool
to generate the xml files before CastXML existed.

**From version v1.8.0 on, pygccxml uses CastXML by default.
The support for GCC-XML will finally be dropped in pygccxml v2.0.0.**
The support for GCC-XML was finally dropped in pygccxml v2.0.0.**

There are few different ways to install GCC-XML on your system:

Expand Down
13 changes: 4 additions & 9 deletions src/pygccxml/parser/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,16 +129,12 @@ def compiler(self, compiler):

@property
def xml_generator(self):
"""get xml_generator (gccxml or castxml)"""
"""get xml_generator"""
return self.__xml_generator

@xml_generator.setter
def xml_generator(self, xml_generator):
"""set xml_generator (gccxml or castxml)"""
if "real" in xml_generator:
# Support for gccxml.real from newer gccxml package
# Can be removed once gccxml support is dropped.
xml_generator = "gccxml"
"""set xml_generator"""
self.__xml_generator = xml_generator

@property
Expand Down Expand Up @@ -241,9 +237,8 @@ def raise_on_wrong_settings(self):
self.__ensure_dir_exists(self.working_directory, 'working directory')
for idir in self.include_paths:
self.__ensure_dir_exists(idir, 'include directory')
if self.__xml_generator not in ["castxml", "gccxml"]:
msg = ('xml_generator("%s") should either be ' +
'"castxml" or "gccxml".') % self.xml_generator
if self.__xml_generator != "castxml":
msg = f"xml_generator ({self.xml_generator}) can only be 'castxml'"
raise RuntimeError(msg)


Expand Down
33 changes: 9 additions & 24 deletions unittests/array_bug_tester.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,9 @@ def test5(self):
global_ns = declarations.get_global_namespace(
src_reader.read_string(code))
arr_type = global_ns.variable('arr').decl_type
if self.config.xml_generator == "gccxml":
self.assertTrue(
'char [4] const' == arr_type.decl_string,
arr_type.decl_string)
else:
self.assertTrue(
'char const [4]' == arr_type.decl_string,
arr_type.decl_string)
self.assertTrue(
'char const [4]' == arr_type.decl_string,
arr_type.decl_string)
self.assertTrue(
declarations.is_array(arr_type))
self.assertTrue(
Expand All @@ -81,14 +76,9 @@ def test6(self):
global_ns = declarations.get_global_namespace(
src_reader.read_string(code))
arr_type = global_ns.variable('arr').decl_type
if self.config.xml_generator == "gccxml":
self.assertTrue(
'char [4] volatile' == arr_type.decl_string,
arr_type.decl_string)
else:
self.assertTrue(
'char volatile [4]' == arr_type.decl_string,
arr_type.decl_string)
self.assertTrue(
'char volatile [4]' == arr_type.decl_string,
arr_type.decl_string)
self.assertTrue(
declarations.is_array(arr_type))
self.assertTrue(
Expand All @@ -100,14 +90,9 @@ def test7(self):
global_ns = declarations.get_global_namespace(
src_reader.read_string(code))
arr_type = global_ns.variable('arr').decl_type
if self.config.xml_generator == "gccxml":
self.assertTrue(
'char [4] const volatile' == arr_type.decl_string,
arr_type.decl_string)
else:
self.assertTrue(
'char const volatile [4]' == arr_type.decl_string,
arr_type.decl_string)
self.assertTrue(
'char const volatile [4]' == arr_type.decl_string,
arr_type.decl_string)
self.assertTrue(
declarations.is_array(arr_type))
self.assertTrue(
Expand Down
3 changes: 0 additions & 3 deletions unittests/test_argument_without_name.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ def test_argument_without_name(self):
"""

if self.config.xml_generator == "gccxml":
return

decls = parser.parse([self.header], self.config)
global_ns = declarations.get_global_namespace(decls)

Expand Down
4 changes: 0 additions & 4 deletions unittests/test_cpp_standards.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ def test(self):
"""

# Skip this test for gccxml, this is a CastXML feature.
if "gccxml" in self.config.xml_generator:
return True

parser.parse(["cpp_standards.hpp"], self.config)

if platform.system() != 'Windows':
Expand Down
3 changes: 0 additions & 3 deletions unittests/test_map_gcc5.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ def test_map_gcc5(self):
"""

if self.config.xml_generator == "gccxml":
return

decls = parser.parse([self.header], self.config)
global_ns = declarations.get_global_namespace(decls)

Expand Down
6 changes: 0 additions & 6 deletions unittests/test_pattern_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,6 @@ def test_template_split_std_vector(self):
"""

if self.config.xml_generator == "gccxml":
return

decls = parser.parse([self.header], self.config)

for decl in declarations.make_flatten(decls):
Expand All @@ -41,9 +38,6 @@ def test_matcher(self):
"""

if self.config.xml_generator == "gccxml":
return

decls = parser.parse([self.header], self.config)
global_ns = declarations.get_global_namespace(decls)
criteria = declarations.declaration_matcher(name="myClass")
Expand Down
14 changes: 0 additions & 14 deletions unittests/test_smart_pointer.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ def __init__(self, *args):
self.global_ns = None

def setUp(self):
if self.config.xml_generator == "gccxml":
return
decls = parser.parse([self.header], self.config)
self.global_ns = declarations.get_global_namespace(decls)

Expand All @@ -31,9 +29,6 @@ def test_is_smart_pointer(self):
"""

if self.config.xml_generator == "gccxml":
return

criteria = declarations.declaration_matcher(name="yes1")
decls = declarations.matcher.find(criteria, self.global_ns)
self.assertTrue(
Expand All @@ -58,9 +53,6 @@ def test_is_auto_pointer(self):
"""

if self.config.xml_generator == "gccxml":
return

criteria = declarations.declaration_matcher(name="yes2")
decls = declarations.matcher.find(criteria, self.global_ns)
self.assertTrue(
Expand All @@ -82,9 +74,6 @@ def test_smart_pointer_value_type(self):
"""

if self.config.xml_generator == "gccxml":
return

criteria = declarations.declaration_matcher(name="yes1")
decls = declarations.matcher.find(criteria, self.global_ns)
vt = declarations.smart_pointer_traits.value_type(decls[0].decl_type)
Expand All @@ -96,9 +85,6 @@ def test_auto_pointer_value_type(self):
"""

if self.config.xml_generator == "gccxml":
return

criteria = declarations.declaration_matcher(name="yes2")
decls = declarations.matcher.find(criteria, self.global_ns)
vt = declarations.auto_ptr_traits.value_type(decls[0].decl_type)
Expand Down
6 changes: 2 additions & 4 deletions unittests/test_va_list_tag_removal.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@ def __init__(self, *args):

def test_keep_va_list_tag(self):

if "gccxml" in self.config.xml_generator or \
platform.system() == 'Windows':
if platform.system() == 'Windows':
return True

self.config.flags = ["f1"]
Expand Down Expand Up @@ -89,8 +88,7 @@ def test_keep_va_list_tag(self):

def test_remove_va_list_tag(self):

if "gccxml" in self.config.xml_generator or \
platform.system() == 'Windows':
if platform.system() == 'Windows':
return True

self.config.flags = []
Expand Down
2 changes: 1 addition & 1 deletion unittests/xml_generator.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[xml_generator]
# Specify which xml generator you want to use "castxml" or "gccxml"
# Specify which xml generator you want to use. Only "castxml" if allowed (ass gccxml is not supported anymore)
# "castxml is the default"
xml_generator=
# Path to castxml or gccxml executable file
Expand Down

0 comments on commit f57ddbb

Please sign in to comment.