This is an archive of the discontinued LLVM Phabricator instance.

[AIX] Define __TOS_AIX__ predefined macro
ClosedPublic

Authored by Jake-Egan on Jun 2 2021, 8:48 PM.

Details

Summary


Transfer the predefined macro, __TOS_AIX__, from the AIX XL C/C++ compilers.

__TOS_AIX__ indicates that the target operating system is AIX.

Diff Detail

Event Timeline

Jake-Egan created this revision.Jun 2 2021, 8:48 PM
Jake-Egan requested review of this revision.Jun 2 2021, 8:48 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 2 2021, 8:48 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
Jake-Egan retitled this revision from Add AIX predefined macros to [AIX] Transfer predefined macros.Jun 2 2021, 8:53 PM
Jake-Egan edited the summary of this revision. (Show Details)
Jake-Egan edited the summary of this revision. (Show Details)
cebowleratibm requested changes to this revision.Jun 3 2021, 7:09 AM

Please rework the test update into init-ppc.c

clang/lib/Basic/Targets/PPC.cpp
95 ↗(On Diff #349445)

The XL compilers define this macro for Power but GCC does not. The macro is redundant and I recommend we not carry it forward to Linux. There's probably a case to define it on AIX where the prevalent XL compilers have always defined it.

clang/test/Preprocessor/init-aix.c
1 ↗(On Diff #349445)

There are some AIX macro tests already in init-ppc.c. Note the target triple should be specified or this test will break when run on a non AIX host.

This revision now requires changes to proceed.Jun 3 2021, 7:09 AM
Jake-Egan updated this revision to Diff 349557.EditedJun 3 2021, 8:33 AM
Jake-Egan edited the summary of this revision. (Show Details)

Removed

__THW_PPC__

and moved tests to init-ppc.c

Jake-Egan updated this revision to Diff 349564.EditedJun 3 2021, 8:48 AM
Jake-Egan marked an inline comment as done.

Fix diff

cebowleratibm requested changes to this revision.Jun 3 2021, 10:22 AM
cebowleratibm added inline comments.
clang/lib/Basic/Targets/OSTargets.h
680

Should set these macros in C11 and higher levels.

clang/test/Preprocessor/init-ppc.c
544

I think it's sufficient to test the STDC_NO_ATOMICS and STDC_NO_THREADS only as you've added below where the -std is explicitly controlled. I prefer to avoid expecting these macros for the -std default, which may change.

751

suggest adding the negative test for pre C11 modes.

This revision now requires changes to proceed.Jun 3 2021, 10:22 AM
Jake-Egan updated this revision to Diff 349638.Jun 3 2021, 12:10 PM

Set macros for C11 and higher. Add negative test for pre C11.

Jake-Egan edited the summary of this revision. (Show Details)Jun 3 2021, 12:41 PM
cebowleratibm added inline comments.Jun 3 2021, 2:29 PM
clang/lib/Basic/Targets/OSTargets.h
680

I think LangStandard::isC11() does what you want. You wouldn't want to update this code every time a new C standard comes out.

clang/test/Preprocessor/init-ppc.c
766

I didn't mean to suggest adding all of them. One negative test on c99 would suffice.

Jake-Egan updated this revision to Diff 349854.Jun 4 2021, 6:34 AM
Jake-Egan marked 3 inline comments as done.
This comment was removed by Jake-Egan.
Jake-Egan updated this revision to Diff 349855.Jun 4 2021, 6:42 AM

Use LangStandard::isC11() and one C99 test.

cebowleratibm requested changes to this revision.Jun 4 2021, 7:26 AM

I think it makes sense to split the STDC macro changes and TOS_AIX__ into different patches.

This revision now requires changes to proceed.Jun 4 2021, 7:26 AM
Jake-Egan retitled this revision from [AIX] Transfer predefined macros to [AIX] Transfer __TOS_AIX__ predefined macro.Jun 4 2021, 10:22 AM
Jake-Egan edited the summary of this revision. (Show Details)
Jake-Egan edited the summary of this revision. (Show Details)
Jake-Egan updated this revision to Diff 349913.EditedJun 4 2021, 10:29 AM


Use this patch to target only __TOS_AIX__.

Jake-Egan retitled this revision from [AIX] Transfer __TOS_AIX__ predefined macro to [AIX] Define __TOS_AIX__ predefined macro.Jun 4 2021, 11:56 AM
This revision is now accepted and ready to land.Jul 6 2021, 7:03 AM
This revision was automatically updated to reflect the committed changes.