Skip to content

Commit e906269

Browse files
committed
Merge branch 'develop'
2 parents e178aeb + ea300f6 commit e906269

File tree

8 files changed

+90
-38
lines changed

8 files changed

+90
-38
lines changed

Diff for: .github/workflows/tests.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ jobs:
7070
castxml-epic: 1
7171
cppstd: "-std=c++11"
7272

73-
- os: macos-12
73+
- os: macos-13
7474
compiler: xcode
7575
version: "default"
7676
python-version: "3.8"
@@ -96,7 +96,7 @@ jobs:
9696
run: |
9797
wget -q -O - https://data.kitware.com/api/v1/file/hashsum/sha512/bdbb67a10c5f8d1b738cd19cb074f409d4803e8077cb8c1072ef4eaf738fa871a73643f9c8282d58cae28d188df842c82ad6620b6d590b0396a0172a27438dce/download | tar zxf - -C ~/
9898
- name: Setup castxml for Mac
99-
if: matrix.os == 'macos-12'
99+
if: matrix.os == 'macos-13'
100100
run: |
101101
wget -q -O - https://data.kitware.com/api/v1/file/hashsum/sha512/5d937e938f7b882a3a3e7941e68f8312d0898aaf2082e00003dd362b1ba70b98b0a08706a1be28e71652a6a0f1e66f89768b5eaa20e5a100592d5b3deefec3f0/download | tar zxf - -C ~/
102102
- name: Run tests

Diff for: CHANGELOG.md

+9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,13 @@
11
Changes
22
=======
33

4+
Version 2.6.1
5+
-------------
6+
7+
1. Fix test_remove_template_defaults when tested on macos 13
8+
9+
2. Fix some test compilation with c++14/17
10+
411
Version 2.6.0
512
-------------
613

@@ -14,6 +21,8 @@ Version 2.6.0
1421

1522
5. Fix a bug in build_decl_string with elaborated type specifiers
1623

24+
6. Fix a bug where the declared widht of arrays args where lost (by using the original type xml tag)
25+
1726
Version 2.5.0
1827
-------------
1928

Diff for: pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ keywords = [
1818
"CastXML",
1919
"gccxml",
2020
]
21-
version = "2.6.0"
21+
version = "2.6.1"
2222

2323
classifiers = [
2424
"Development Status :: 5 - Production/Stable",

Diff for: src/pygccxml/declarations/container_traits.py

+13-13
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,16 @@
1919

2020
std_namespaces = ('std', 'stdext', '__gnu_cxx')
2121

22+
# Take into account different equivalences (with or without spaces)
23+
string_equivalences = type_traits.string_equivalences + \
24+
type_traits.normalized_string_equivalences
25+
string_equivalences = [
26+
v for v in string_equivalences if not v == "std::string"]
27+
wstring_equivalences = type_traits.wstring_equivalences + \
28+
type_traits.normalized_wstring_equivalences
29+
wstring_equivalences = [
30+
v for v in wstring_equivalences if not v == "std::wstring"]
31+
2232

2333
class defaults_eraser(object):
2434

@@ -29,20 +39,10 @@ def normalize(self, type_str):
2939
return type_str.replace(' ', '')
3040

3141
def replace_basic_string(self, cls_name):
32-
33-
# Take the lists of all possible string variations
34-
# and clean them up by replacing ::std by std.
35-
str_eq = [
36-
v.replace("::std", "std") for v in
37-
type_traits.string_equivalences]
38-
wstr_eq = [
39-
v.replace("::std", "std") for v in
40-
type_traits.wstring_equivalences]
41-
42-
# Replace all the variations of strings by the smallest one.
4342
strings = {
44-
"std::string": [v for v in str_eq if not v == "std::string"],
45-
"std::wstring": [v for v in wstr_eq if not v == "std::wstring"]}
43+
"std::string": string_equivalences,
44+
"std::wstring": wstring_equivalences
45+
}
4646

4747
new_name = cls_name
4848
for short_name, long_names in strings.items():

Diff for: src/pygccxml/declarations/type_traits.py

+50-18
Original file line numberDiff line numberDiff line change
@@ -480,25 +480,57 @@ def is_fundamental(type_):
480480
(cpptypes.volatile_t, cpptypes.const_t))
481481

482482

483+
def _normalize(string):
484+
return string.replace(' ', '').replace("::std", "std")
485+
486+
487+
def _normalize_equivalences(equivalences):
488+
return [_normalize(eq) for eq in equivalences]
489+
490+
483491
string_equivalences = [
484492
(
485-
'::std::basic_string<char,std::char_traits<char>,'
486-
'std::allocator<char>>'),
487-
'::std::basic_string<char>', '::std::string']
493+
'std::basic_string<char, std::char_traits<char>, '
494+
'std::allocator<char>>'
495+
),
496+
'std::basic_string<char>',
497+
'std::string'
498+
]
488499

489500
wstring_equivalences = [
490501
(
491-
'::std::basic_string<wchar_t,std::char_traits<wchar_t>,' +
492-
'std::allocator<wchar_t>>'),
493-
'::std::basic_string<wchar_t>', '::std::wstring']
502+
'std::basic_string<wchar_t, std::char_traits<wchar_t>, '
503+
'std::allocator<wchar_t>>'
504+
),
505+
'std::basic_string<wchar_t>',
506+
'std::wstring'
507+
]
494508

495509
ostream_equivalences = [
496-
'::std::basic_ostream<char,std::char_traits<char>>',
497-
'::std::basic_ostream<char>', '::std::ostream']
510+
'std::basic_ostream<char, std::char_traits<char>>',
511+
'std::basic_ostream<char>',
512+
'std::ostream'
513+
]
498514

499515
wostream_equivalences = [
500-
'::std::basic_ostream<wchar_t,std::char_traits<wchar_t>>',
501-
'::std::basic_ostream<wchar_t>', '::std::wostream']
516+
'std::basic_ostream<wchar_t, std::char_traits<wchar_t>>',
517+
'std::basic_ostream<wchar_t>',
518+
'std::wostream'
519+
]
520+
521+
522+
normalized_string_equivalences = _normalize_equivalences(
523+
string_equivalences
524+
)
525+
normalized_wstring_equivalences = _normalize_equivalences(
526+
wstring_equivalences
527+
)
528+
normalized_ostream_equivalences = _normalize_equivalences(
529+
ostream_equivalences
530+
)
531+
normalized_wostream_equivalences = _normalize_equivalences(
532+
wostream_equivalences
533+
)
502534

503535

504536
def is_std_string(type_):
@@ -508,12 +540,12 @@ def is_std_string(type_):
508540
"""
509541

510542
if isinstance(type_, str):
511-
return type_ in string_equivalences
543+
return _normalize(type_) in normalized_string_equivalences
512544

513545
type_ = remove_alias(type_)
514546
type_ = remove_reference(type_)
515547
type_ = remove_cv(type_)
516-
return type_.decl_string.replace(' ', '') in string_equivalences
548+
return _normalize(type_.decl_string) in normalized_string_equivalences
517549

518550

519551
def is_std_wstring(type_):
@@ -523,12 +555,12 @@ def is_std_wstring(type_):
523555
"""
524556

525557
if isinstance(type_, str):
526-
return type_ in wstring_equivalences
558+
return _normalize(type_) in normalized_wstring_equivalences
527559

528560
type_ = remove_alias(type_)
529561
type_ = remove_reference(type_)
530562
type_ = remove_cv(type_)
531-
return type_.decl_string.replace(' ', '') in wstring_equivalences
563+
return _normalize(type_.decl_string) in normalized_wstring_equivalences
532564

533565

534566
def is_std_ostream(type_):
@@ -538,12 +570,12 @@ def is_std_ostream(type_):
538570
"""
539571

540572
if isinstance(type_, str):
541-
return type_ in ostream_equivalences
573+
return _normalize(type_) in normalized_ostream_equivalences
542574

543575
type_ = remove_alias(type_)
544576
type_ = remove_reference(type_)
545577
type_ = remove_cv(type_)
546-
return type_.decl_string.replace(' ', '') in ostream_equivalences
578+
return _normalize(type_.decl_string) in normalized_ostream_equivalences
547579

548580

549581
def is_std_wostream(type_):
@@ -553,9 +585,9 @@ def is_std_wostream(type_):
553585
"""
554586

555587
if isinstance(type_, str):
556-
return type_ in wostream_equivalences
588+
return _normalize(type_) in normalized_wostream_equivalences
557589

558590
type_ = remove_alias(type_)
559591
type_ = remove_reference(type_)
560592
type_ = remove_cv(type_)
561-
return type_.decl_string.replace(' ', '') in wostream_equivalences
593+
return _normalize(type_.decl_string) in normalized_wostream_equivalences

Diff for: tests/data/core_types.hpp

+1-3
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,11 @@ typedef EFavoriteDrinks typedef_EFavoriteDrinks;
4848

4949
typedef int (*function_ptr)(int, double);
5050

51-
struct exception{};
52-
5351
struct members_pointers_t{
5452
int some_function( double hi, int i ){
5553
return 0;
5654
}
57-
int some_function( double hi) const throw( exception ){
55+
int some_function( double hi) const {
5856
return 0;
5957
};
6058
int m_some_const_member;

Diff for: tests/test_remove_template_defaults.py

+8-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
# Distributed under the Boost Software License, Version 1.0.
44
# See http://www.boost.org/LICENSE_1_0.txt
55

6+
import platform
7+
68
import pytest
79

810
from . import autoconfig
@@ -20,7 +22,12 @@
2022
def global_ns():
2123
COMPILATION_MODE = parser.COMPILATION_MODE.ALL_AT_ONCE
2224
config = autoconfig.cxx_parsers_cfg.config.clone()
23-
config.cflags = "-std=c++11"
25+
if platform.system() == "Darwin":
26+
config.cflags = "-std=c++11 -Dat_quick_exit=atexit -Dquick_exit=exit"
27+
# https://fr.mathworks.com/matlabcentral/answers/2013982-clibgen-generatelibrarydefinition-error-the-global-scope-has-no-quick_exit-on-mac-m2#answer_1439856
28+
# https://github.com/jetbrains/kotlin/commit/d50f585911dedec5723213da8835707ac95e1c01
29+
else:
30+
config.cflags = "-std=c++11"
2431
decls = parser.parse(TEST_FILES, config, COMPILATION_MODE)
2532
global_ns = declarations.get_global_namespace(decls)
2633
global_ns.init_optimizer()

Diff for: tests/test_source_reader.py

+6
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
# Distributed under the Boost Software License, Version 1.0.
44
# See http://www.boost.org/LICENSE_1_0.txt
55

6+
import platform
7+
68
import pytest
79

810
from . import autoconfig
@@ -19,6 +21,10 @@
1921
def global_ns():
2022
COMPILATION_MODE = parser.COMPILATION_MODE.ALL_AT_ONCE
2123
config = autoconfig.cxx_parsers_cfg.config.clone()
24+
if platform.system() == "Darwin":
25+
config.cflags = "-Dat_quick_exit=atexit -Dquick_exit=exit"
26+
# https://fr.mathworks.com/matlabcentral/answers/2013982-clibgen-generatelibrarydefinition-error-the-global-scope-has-no-quick_exit-on-mac-m2#answer_1439856
27+
# https://github.com/jetbrains/kotlin/commit/d50f585911dedec5723213da8835707ac95e1c01
2228
decls = parser.parse(TEST_FILES, config, COMPILATION_MODE)
2329
global_ns = declarations.get_global_namespace(decls)
2430
global_ns.init_optimizer()

0 commit comments

Comments
 (0)