Author: Zenong Zhang Date: 2023-05-25T14:17:29-04:00 New Revision: 9ed3d85e26d8594440bca84fe868a62ac6560ac8
URL: https://github.com/llvm/llvm-project/commit/9ed3d85e26d8594440bca84fe868a62ac6560ac8 DIFF: https://github.com/llvm/llvm-project/commit/9ed3d85e26d8594440bca84fe868a62ac6560ac8.diff LOG: [clang][diagnostics] Add -Wpacked-non-pod to -Wall Users will be informed when non-POD is not packed using -Wall. This is also consistent with GCC. Fixes https://github.com/llvm/llvm-project/issues/60832 Differential Revision: https://reviews.llvm.org/D151162 Added: clang/test/CodeGenCXX/warn-all-padded-packed-packed-non-pod.cpp Modified: clang/docs/ReleaseNotes.rst clang/include/clang/Basic/DiagnosticGroups.td clang/test/Misc/warning-wall.c Removed: clang/test/CodeGenCXX/warn-padded-packed.cpp ################################################################################ diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst index 6ee73aa3c96fe..d88d66be0c860 100644 --- a/clang/docs/ReleaseNotes.rst +++ b/clang/docs/ReleaseNotes.rst @@ -307,6 +307,8 @@ Improvements to Clang's diagnostics (`#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 ------------------------- diff --git a/clang/include/clang/Basic/DiagnosticGroups.td b/clang/include/clang/Basic/DiagnosticGroups.td index 08b8f02460c16..9944fa87aba23 100644 --- a/clang/include/clang/Basic/DiagnosticGroups.td +++ b/clang/include/clang/Basic/DiagnosticGroups.td @@ -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]>; diff --git a/clang/test/CodeGenCXX/warn-padded-packed.cpp b/clang/test/CodeGenCXX/warn-all-padded-packed-packed-non-pod.cpp similarity index 90% rename from clang/test/CodeGenCXX/warn-padded-packed.cpp rename to clang/test/CodeGenCXX/warn-all-padded-packed-packed-non-pod.cpp index c51a6c9443f6e..6ec842a38d7b0 100644 --- a/clang/test/CodeGenCXX/warn-padded-packed.cpp +++ b/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; diff --git a/clang/test/Misc/warning-wall.c b/clang/test/Misc/warning-wall.c index e57c5d6d501da..1c74759ce6161 100644 --- a/clang/test/Misc/warning-wall.c +++ b/clang/test/Misc/warning-wall.c @@ -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 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits