[Clang] Add -Wtype-limits to -Wextra for GCC compatibility
authorShivam Gupta <shivam98.tkg@gmail.com>
Wed, 1 Feb 2023 03:14:04 +0000 (08:44 +0530)
committerShivam Gupta <shivam98.tkg@gmail.com>
Wed, 1 Feb 2023 13:59:16 +0000 (19:29 +0530)
GCC added the -Wtype-limits warning group to -Wextra around
GCC 4.4 and the group has some very helpful extra warnings
like tautological comparison type limit warnings
(comparingan unsigned int to see if it's positive, etc).

Fix https://github.com/llvm/llvm-project/issues/58375

Reviewed By: #clang-vendors, thesamesam

Differential Revision: https://reviews.llvm.org/D142826

clang/docs/ReleaseNotes.rst
clang/include/clang/Basic/DiagnosticGroups.td
clang/test/Sema/tautological-constant-compare.c

index 2b2ca8b..e5d09ce 100644 (file)
@@ -61,6 +61,9 @@ Bug Fixes
   templates. This fixes
   `Issue 60344 <https://github.com/llvm/llvm-project/issues/60344>`_.
 
+- ``-Wtype-limits`` was added to ``-Wextra`` for GCC compatibility. This fixes
+  `Issue 58375 <https://github.com/llvm/llvm-project/issues/58375>`_.
+
 Improvements to Clang's diagnostics
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 - We now generate a diagnostic for signed integer overflow due to unary minus
index 6c997c3..39e6c94 100644 (file)
@@ -992,6 +992,7 @@ def Extra : DiagGroup<"extra", [
     EmptyInitStatement,
     StringConcatation,
     FUseLdPath,
+    TypeLimits,
   ]>;
 
 def Most : DiagGroup<"most", [
index 04b8a14..5909418 100644 (file)
@@ -4,8 +4,8 @@
 // RUN: %clang_cc1 -triple x86_64-linux-gnu -fsyntax-only -Wtautological-type-limit-compare -DTEST -verify -x c++ %s
 // RUN: %clang_cc1 -triple x86_64-linux-gnu -fsyntax-only -Wtype-limits -DTEST -verify %s
 // RUN: %clang_cc1 -triple x86_64-linux-gnu -fsyntax-only -Wtype-limits -DTEST -verify -x c++ %s
-// RUN: %clang_cc1 -triple x86_64-linux-gnu -fsyntax-only -Wextra -Wno-sign-compare -verify=silent %s
-// RUN: %clang_cc1 -triple x86_64-linux-gnu -fsyntax-only -Wextra -Wno-sign-compare -verify=silent -x c++ %s
+// RUN: %clang_cc1 -triple x86_64-linux-gnu -fsyntax-only -Wextra -Wno-sign-compare -DTEST -verify %s
+// RUN: %clang_cc1 -triple x86_64-linux-gnu -fsyntax-only -Wextra -Wno-sign-compare -DTEST -verify -x c++ %s
 // RUN: %clang_cc1 -triple x86_64-linux-gnu -fsyntax-only -Wall -verify=silent %s
 // RUN: %clang_cc1 -triple x86_64-linux-gnu -fsyntax-only -Wall -verify=silent -x c++ %s
 // RUN: %clang_cc1 -triple x86_64-linux-gnu -fsyntax-only -verify=silent %s