[PATCH] D151162: Add -Wpacked-non-pod to -Wall

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu May 25 11:18:48 PDT 2023


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG9ed3d85e26d8: [clang][diagnostics] Add -Wpacked-non-pod to -Wall (authored by SlaterLatiao, committed by aaron.ballman).

Changed prior to commit:
  https://reviews.llvm.org/D151162?vs=525654&id=525708#toc

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D151162/new/

https://reviews.llvm.org/D151162

Files:
  clang/docs/ReleaseNotes.rst
  clang/include/clang/Basic/DiagnosticGroups.td
  clang/test/CodeGenCXX/warn-all-padded-packed-packed-non-pod.cpp
  clang/test/CodeGenCXX/warn-padded-packed.cpp
  clang/test/Misc/warning-wall.c


Index: clang/test/Misc/warning-wall.c
===================================================================
--- clang/test/Misc/warning-wall.c
+++ clang/test/Misc/warning-wall.c
@@ -99,6 +99,7 @@
 CHECK-NEXT:  -Wswitch
 CHECK-NEXT:  -Wswitch-bool
 CHECK-NEXT:  -Wmisleading-indentation
+CHECK-NEXT:  -Wpacked-non-pod
 
 
 CHECK-NOT:-W
Index: clang/test/CodeGenCXX/warn-all-padded-packed-packed-non-pod.cpp
===================================================================
--- clang/test/CodeGenCXX/warn-all-padded-packed-packed-non-pod.cpp
+++ clang/test/CodeGenCXX/warn-all-padded-packed-packed-non-pod.cpp
@@ -1,5 +1,10 @@
-// RUN: %clang_cc1 -triple=x86_64-none-none -Wpadded -Wpacked -verify=expected,top %s -emit-llvm-only
-// RUN: %clang_cc1 -triple=x86_64-none-none -Wpadded -Wpacked -verify=expected,abi15 -fclang-abi-compat=15 %s -emit-llvm-only
+// RUN: %clang_cc1 -Wpadded -Wpacked -verify=expected,top %s -emit-llvm-only
+// RUN: %clang_cc1 -Wpadded -Wpacked -verify=expected,abi15 -fclang-abi-compat=15 %s -emit-llvm-only
+// -Wpacked-non-pod itself should not emit the "packed attribute is unnecessary" warnings.
+// RUN: %clang_cc1 -Wpacked-non-pod -verify=top %s -emit-llvm-only
+// -Wall should not emit the "packed attribute is unnecessary" warnings without -Wpacked.
+// RUN: %clang_cc1 -Wall -verify=top %s -emit-llvm-only
+
 
 struct S1 {
   char c;
Index: clang/include/clang/Basic/DiagnosticGroups.td
===================================================================
--- clang/include/clang/Basic/DiagnosticGroups.td
+++ clang/include/clang/Basic/DiagnosticGroups.td
@@ -1060,7 +1060,7 @@
 // warning should be active _only_ when -Wall is passed in, mark it as
 // DefaultIgnore in addition to putting it here.
 def All : DiagGroup<"all", [Most, Parentheses, Switch, SwitchBool,
-                            MisleadingIndentation]>;
+                            MisleadingIndentation, PackedNonPod]>;
 
 // Warnings that should be in clang-cl /w4.
 def : DiagGroup<"CL4", [All, Extra]>;
Index: clang/docs/ReleaseNotes.rst
===================================================================
--- clang/docs/ReleaseNotes.rst
+++ clang/docs/ReleaseNotes.rst
@@ -307,6 +307,8 @@
   (`#62850: <https://github.com/llvm/llvm-project/issues/62850>`_).
 - Clang now warns when any predefined macro is undefined or redefined, instead
   of only some of them.
+- ``-Wpacked-non-pod`` is now included in ``-Wall``.
+  (`#60832: <https://github.com/llvm/llvm-project/issues/60832>`_)
 
 Bug Fixes in This Version
 -------------------------


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D151162.525708.patch
Type: text/x-patch
Size: 2551 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230525/1fa16714/attachment.bin>


More information about the cfe-commits mailing list