[clang] [Clang] Warn when an explicit alignment is weakened by other directives (PR #198417)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Fri Jun 5 07:05:44 PDT 2026


================
@@ -1098,4 +1098,9 @@ def warn_unpacked_field
 def warn_unaligned_access : Warning<
   "field %1 within %0 is less aligned than %2 and is usually due to %0 being "
   "packed, which can lead to unaligned accesses">, InGroup<UnalignedAccess>, DefaultIgnore;
+
+// -Wweakened-alignment
+def warn_explicit_alignment_weakened : Warning<
+  "explicit alignment of %0 (%1 bytes) was weakened to %2 bytes">,
+  InGroup<WeakenedAlignment>;
----------------
AaronBallman wrote:

```suggestion
  InGroup<DiagGroup<"weakened-alignment">>;
```
and then you can roll back the changes in `DiagnosticGroups.td`.

https://github.com/llvm/llvm-project/pull/198417


More information about the cfe-commits mailing list