@@ -1360,6 +1360,8 @@ extern (C++) struct Target
1360
1360
*/
1361
1361
struct TargetC
1362
1362
{
1363
+ import dmd.declaration : BitFieldDeclaration;
1364
+
1363
1365
enum Runtime : ubyte
1364
1366
{
1365
1367
Unspecified,
@@ -1379,9 +1381,6 @@ struct TargetC
1379
1381
// / https://docs.microsoft.com/en-us/cpp/c-language/c-bit-fields?view=msvc-160
1380
1382
// / https://docs.microsoft.com/en-us/cpp/cpp/cpp-bit-fields?view=msvc-160
1381
1383
Gcc_Clang, // / gcc and clang
1382
- Gcc_Clang_ARM, // / Like `Gcc_Clang`, except that anonymous and 0-length bit fields contribute
1383
- // / to the aggregate alignment. Used for 32 & 64 bit ARM targets, except for
1384
- // / Apple ARM64.
1385
1384
}
1386
1385
bool crtDestructorsSupported = true ; // / Not all platforms support crt_destructor
1387
1386
ubyte boolsize; // / size of a C `_Bool` type
@@ -1452,6 +1451,24 @@ struct TargetC
1452
1451
crtDestructorsSupported = false ;
1453
1452
}
1454
1453
}
1454
+
1455
+ /**
1456
+ * Indicates whether the specified bit-field contributes to the alignment
1457
+ * of the containing aggregate.
1458
+ * E.g., (not all) ARM ABIs do NOT ignore anonymous (incl. 0-length)
1459
+ * bit-fields.
1460
+ */
1461
+ extern (C++ ) bool contributesToAggregateAlignment(BitFieldDeclaration bfd)
1462
+ {
1463
+ if (bitFieldStyle == BitFieldStyle.MS )
1464
+ return true ;
1465
+ if (bitFieldStyle == BitFieldStyle.Gcc_Clang)
1466
+ {
1467
+ // sufficient for DMD's currently supported architectures
1468
+ return ! bfd.isAnonymous();
1469
+ }
1470
+ assert (0 );
1471
+ }
1455
1472
}
1456
1473
1457
1474
// //////////////////////////////////////////////////////////////////////////////
0 commit comments