Skip to content

Commit

Permalink
[SystemZ][z/OS] exclude nasty_macros.h from check-cxx
Browse files Browse the repository at this point in the history
Need to exclude nasty_macros.h from check-cxx on z/OS due to conflicts within system headers.

Sample failure in `random_shuffle.depr_in_cxx14.verify.cpp` libcxx test.
```
error: 'error' diagnostics seen but not expected:
Line 1268: expected ')'
Line 1268: unknown type name 'This'
Line 1268: expected ')'
```

caused by the following  macros in `nasty_macros.h`
```
#define NASTY_MACRO This should not be expanded!!!
#define _E NASTY_MACRO
```
The name collision is observed in the following code snippet whre `_E` is being used as parameter name:
```
inline int iswalnum(wint_t _E) {return __iswalnum(_E);}
```

It is reasonable to exclude `nasty_macros.h` on z/OS similarly as it was done on Windows.

Reviewed By: #libc, ldionne

Differential Revision: https://reviews.llvm.org/D99378
  • Loading branch information
zibi2 committed Mar 26, 2021
1 parent bcc8d80 commit 4d47812
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
3 changes: 2 additions & 1 deletion libcxx/utils/libcxx/test/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,8 @@ def configure_compile_flags_header_includes(self):
support_path = os.path.join(self.libcxx_src_root, 'test', 'support')
self.configure_config_site_header()
if self.cxx_stdlib_under_test != 'libstdc++' and \
not self.target_info.is_windows():
not self.target_info.is_windows() and \
not self.target_info.is_zos():
self.cxx.compile_flags += [
'-include', os.path.join(support_path, 'nasty_macros.h')]
if self.cxx_stdlib_under_test == 'msvc':
Expand Down
11 changes: 11 additions & 0 deletions libcxx/utils/libcxx/test/target_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ def __init__(self, full_config):
def is_windows(self):
return False

def is_zos(self):
return False

def is_mingw(self):
return False

Expand Down Expand Up @@ -135,6 +138,13 @@ def __init__(self, full_config):
def is_windows(self):
return True

class ZOSLocalTI(DefaultTargetInfo):
def __init__(self, full_config):
super(ZOSLocalTI, self).__init__(full_config)

def is_zos(self):
return True

class MingwLocalTI(WindowsLocalTI):
def __init__(self, full_config):
super(MingwLocalTI, self).__init__(full_config)
Expand All @@ -157,4 +167,5 @@ def make_target_info(full_config):
if target_system == 'NetBSD': return NetBSDLocalTI(full_config)
if target_system == 'Linux': return LinuxLocalTI(full_config)
if target_system == 'Windows': return WindowsLocalTI(full_config)
if target_system == 'OS/390': return ZOSLocalTI(full_config)
return DefaultTargetInfo(full_config)

0 comments on commit 4d47812

Please sign in to comment.