Skip to content

Commit

Permalink
Reapply: [clang][diagnostics] Adding -Wpacked-non-pod to -Wall
Browse files Browse the repository at this point in the history
Users will be informed when non-POD is not packed using -Wall. This
is also consistent with GCC.

Fixes PR#60832.

Differential Revision: https://reviews.llvm.org/D151162
  • Loading branch information
SlaterLatiao authored and Erich Keane committed May 25, 2023
1 parent 59ad9c3 commit 9168974
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion clang/include/clang/Basic/DiagnosticGroups.td
Original file line number Diff line number Diff line change
Expand Up @@ -1060,7 +1060,7 @@ def Consumed : DiagGroup<"consumed">;
// 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]>;
Expand Down
Original file line number Diff line number Diff line change
@@ -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
// -Wpacked-non-pod itself should not emit the "packed attribute is unnecessary" warnings.
// RUN: %clang_cc1 -triple=x86_64-none-none -Wpacked-non-pod -verify=top %s -emit-llvm-only
// -Wall should not emit the "packed attribute is unnecessary" warnings without -Wpacked.
// RUN: %clang_cc1 -triple=x86_64-none-none -Wall -verify=top %s -emit-llvm-only


struct S1 {
char c;
Expand Down
1 change: 1 addition & 0 deletions clang/test/Misc/warning-wall.c
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ CHECK-NEXT: -Wdangling-else
CHECK-NEXT: -Wswitch
CHECK-NEXT: -Wswitch-bool
CHECK-NEXT: -Wmisleading-indentation
CHECK-NEXT: -Wpacked-non-pod


CHECK-NOT:-W

0 comments on commit 9168974

Please sign in to comment.