[clang] aa1cdf8 - [PS5] Ignore 'packed' on one-byte bitfields, matching PS4
Paul Robinson via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 2 14:41:26 PDT 2022
Author: Paul Robinson
Date: 2022-06-02T14:41:18-07:00
New Revision: aa1cdf87b5a97c2476a80f3aa6ac5af3e5ec0494
URL: https://github.com/llvm/llvm-project/commit/aa1cdf87b5a97c2476a80f3aa6ac5af3e5ec0494
DIFF: https://github.com/llvm/llvm-project/commit/aa1cdf87b5a97c2476a80f3aa6ac5af3e5ec0494.diff
LOG: [PS5] Ignore 'packed' on one-byte bitfields, matching PS4
Added:
Modified:
clang/lib/Sema/SemaDeclAttr.cpp
clang/test/Sema/struct-packed-align.c
Removed:
################################################################################
diff --git a/clang/lib/Sema/SemaDeclAttr.cpp b/clang/lib/Sema/SemaDeclAttr.cpp
index 466ca1b573be..b629fcb91b25 100644
--- a/clang/lib/Sema/SemaDeclAttr.cpp
+++ b/clang/lib/Sema/SemaDeclAttr.cpp
@@ -1404,9 +1404,9 @@ static void handlePackedAttr(Sema &S, Decl *D, const ParsedAttr &AL) {
FD->isBitField() &&
S.Context.getTypeAlign(FD->getType()) <= 8);
- if (S.getASTContext().getTargetInfo().getTriple().isPS4()) {
+ if (S.getASTContext().getTargetInfo().getTriple().isPS()) {
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)
<< AL << FD->getType();
else
diff --git a/clang/test/Sema/struct-packed-align.c b/clang/test/Sema/struct-packed-align.c
index 03b012e34028..2a60f368479a 100644
--- a/clang/test/Sema/struct-packed-align.c
+++ b/clang/test/Sema/struct-packed-align.c
@@ -1,6 +1,7 @@
// 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-scei-ps4 -verify
+// RUN: %clang_cc1 %s -fsyntax-only -triple=x86_64-sie-ps5 -verify
// Packed structs.
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.
struct packed_chars {
char a : 8, b : 8, c : 8, d : 4;
-#ifdef __ORBIS__
- // Test for pre-r254596 clang behavior on the PS4 target. PS4 must maintain
- // ABI backwards compatibility.
+#ifdef __SCE__
+ // Test for pre-r254596 clang behavior on the PS4/PS5 targets, which must
+ // maintain ABI backwards compatibility.
char e : 8 __attribute__((packed));
// expected-warning at -1 {{'packed' attribute ignored for field of type 'char'}}
#else
@@ -159,11 +160,11 @@ struct packed_chars {
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.
//
-// Additionally, test for pre-r254596 clang behavior on the PS4 target. PS4
-// must maintain ABI backwards compatibility.
+// Additionally, test for pre-r254596 clang behavior on the PS4/PS5 targets.
+// They must maintain ABI backwards compatibility.
extern int o1[sizeof(struct packed_chars) == 9 ? 1 : -1];
extern int o2[__alignof(struct packed_chars) == 1 ? 1 : -1];
#elif defined(_AIX)
More information about the cfe-commits
mailing list