This is an archive of the discontinued LLVM Phabricator instance.

[AIX][PowerPC] Define __powerpc and __PPC macros
ClosedPublic

Authored by Jake-Egan on Aug 30 2021, 7:26 AM.

Details

Summary


This patch defines the macros __powerpc and __PPC on AIX to be consistent with XL for AIX. See: https://www.ibm.com/docs/en/xl-c-and-cpp-aix/13.1.0?topic=macros-related-platform

Note: GCC does not currently define __powerpc and __PPC so users should prefer the __powerpc__ and __PPC__ forms.

Diff Detail

Event Timeline

Jake-Egan created this revision.Aug 30 2021, 7:26 AM
Jake-Egan requested review of this revision.Aug 30 2021, 7:26 AM
Herald added a project: Restricted Project. · View Herald TranscriptAug 30 2021, 7:26 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
Jake-Egan retitled this revision from Define __powerpc and __PPC macros to [AIX] Define __powerpc and __PPC macros.Aug 30 2021, 7:33 AM
Jake-Egan edited the summary of this revision. (Show Details)
Jake-Egan added a reviewer: cebowleratibm.
cebowleratibm requested changes to this revision.Aug 31 2021, 5:48 AM

I'd like to see the rationale for adding these forms of the macros in the review and also in the extended commit message. These forms are being added primarily because the AIX XL compiler documented and defined them. The patch itself looks fine.

This revision now requires changes to proceed.Aug 31 2021, 5:48 AM
Jake-Egan edited the summary of this revision. (Show Details)Aug 31 2021, 6:30 AM
Jake-Egan retitled this revision from [AIX] Define __powerpc and __PPC macros to [PowerPC] Define __powerpc and __PPC macros.Aug 31 2021, 8:38 AM
Jake-Egan edited the summary of this revision. (Show Details)

I'd like to see the rationale for adding these forms of the macros in the review and also in the extended commit message. These forms are being added primarily because the AIX XL compiler documented and defined them. The patch itself looks fine.

If XL only defines this on AIX, so should Clang. They only go into this location if XL defines them on both Linux and AIX.

The XL compiler only defined this weird form of the macros on AIX, but not on the XL Linux on Power compiler. I think it's preferable that we define these macros only on AIX and in the source/commit messages indicate that we're only doing so for AIX XL C/C++ compatibility. Users should prefer the PPC and powerpc macros.

Jake-Egan updated this revision to Diff 369932.Sep 1 2021, 8:11 AM

Define for AIX only.

Jake-Egan retitled this revision from [PowerPC] Define __powerpc and __PPC macros to [AIX][PowerPC] Define __powerpc and __PPC macros.Sep 1 2021, 8:14 AM
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.Sep 1 2021, 9:14 AM
cebowleratibm added inline comments.
clang/test/Preprocessor/init-ppc.c
525

I suggest adding the negative test for the non AIX target for both PPC andpowerpc

This revision now requires changes to proceed.Sep 1 2021, 9:14 AM
Jake-Egan updated this revision to Diff 369992.Sep 1 2021, 10:54 AM

Add negative test.

Jake-Egan marked an inline comment as done.Sep 1 2021, 10:55 AM
This revision is now accepted and ready to land.Sep 1 2021, 1:23 PM
This revision was automatically updated to reflect the committed changes.