[PS5] Ignore 'packed' on one-byte bitfields, matching PS4
This commit is contained in:
parent
4e5ce2056e
commit
aa1cdf87b5
|
@ -1404,9 +1404,9 @@ static void handlePackedAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
|
||||||
FD->isBitField() &&
|
FD->isBitField() &&
|
||||||
S.Context.getTypeAlign(FD->getType()) <= 8);
|
S.Context.getTypeAlign(FD->getType()) <= 8);
|
||||||
|
|
||||||
if (S.getASTContext().getTargetInfo().getTriple().isPS4()) {
|
if (S.getASTContext().getTargetInfo().getTriple().isPS()) {
|
||||||
if (BitfieldByteAligned)
|
if (BitfieldByteAligned)
|
||||||
// The PS4 target needs to maintain ABI backwards compatibility.
|
// The PS4/PS5 targets need to maintain ABI backwards compatibility.
|
||||||
S.Diag(AL.getLoc(), diag::warn_attribute_ignored_for_field_of_type)
|
S.Diag(AL.getLoc(), diag::warn_attribute_ignored_for_field_of_type)
|
||||||
<< AL << FD->getType();
|
<< AL << FD->getType();
|
||||||
else
|
else
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
// RUN: %clang_cc1 %s -fsyntax-only -verify
|
// RUN: %clang_cc1 %s -fsyntax-only -verify
|
||||||
// RUN: %clang_cc1 %s -fsyntax-only -triple=x86_64-windows-coff -verify
|
// RUN: %clang_cc1 %s -fsyntax-only -triple=x86_64-windows-coff -verify
|
||||||
// RUN: %clang_cc1 %s -fsyntax-only -triple=x86_64-scei-ps4 -verify
|
// RUN: %clang_cc1 %s -fsyntax-only -triple=x86_64-scei-ps4 -verify
|
||||||
|
// RUN: %clang_cc1 %s -fsyntax-only -triple=x86_64-sie-ps5 -verify
|
||||||
|
|
||||||
// Packed structs.
|
// Packed structs.
|
||||||
struct s {
|
struct s {
|
||||||
|
@ -147,9 +148,9 @@ extern int n2[__alignof(struct nS) == 1 ? 1 : -1];
|
||||||
// See the documentation of -Wpacked-bitfield-compat for more information.
|
// See the documentation of -Wpacked-bitfield-compat for more information.
|
||||||
struct packed_chars {
|
struct packed_chars {
|
||||||
char a : 8, b : 8, c : 8, d : 4;
|
char a : 8, b : 8, c : 8, d : 4;
|
||||||
#ifdef __ORBIS__
|
#ifdef __SCE__
|
||||||
// Test for pre-r254596 clang behavior on the PS4 target. PS4 must maintain
|
// Test for pre-r254596 clang behavior on the PS4/PS5 targets, which must
|
||||||
// ABI backwards compatibility.
|
// maintain ABI backwards compatibility.
|
||||||
char e : 8 __attribute__((packed));
|
char e : 8 __attribute__((packed));
|
||||||
// expected-warning@-1 {{'packed' attribute ignored for field of type 'char'}}
|
// expected-warning@-1 {{'packed' attribute ignored for field of type 'char'}}
|
||||||
#else
|
#else
|
||||||
|
@ -159,11 +160,11 @@ struct packed_chars {
|
||||||
char f : 4, g : 8, h : 8, i : 8;
|
char f : 4, g : 8, h : 8, i : 8;
|
||||||
};
|
};
|
||||||
|
|
||||||
#if (defined(_WIN32) || defined(__ORBIS__)) && !defined(__declspec) // _MSC_VER is unavailable in cc1.
|
#if (defined(_WIN32) || defined(__SCE__)) && !defined(__declspec) // _MSC_VER is unavailable in cc1.
|
||||||
// On Windows clang uses MSVC compatible layout in this case.
|
// On Windows clang uses MSVC compatible layout in this case.
|
||||||
//
|
//
|
||||||
// Additionally, test for pre-r254596 clang behavior on the PS4 target. PS4
|
// Additionally, test for pre-r254596 clang behavior on the PS4/PS5 targets.
|
||||||
// must maintain ABI backwards compatibility.
|
// They must maintain ABI backwards compatibility.
|
||||||
extern int o1[sizeof(struct packed_chars) == 9 ? 1 : -1];
|
extern int o1[sizeof(struct packed_chars) == 9 ? 1 : -1];
|
||||||
extern int o2[__alignof(struct packed_chars) == 1 ? 1 : -1];
|
extern int o2[__alignof(struct packed_chars) == 1 ? 1 : -1];
|
||||||
#elif defined(_AIX)
|
#elif defined(_AIX)
|
||||||
|
|
Loading…
Reference in New Issue