Skip to content

[clang] Enable Wenum-constexpr-conversion also in system headers and … - #67528

Merged
carlosgalvezp merged 2 commits into
llvm:mainfrom
carlosgalvezp:enum_constexpr_system_header
Oct 14, 2023
Merged

carlosgalvezp merged 2 commits into
llvm:mainfrom
carlosgalvezp:enum_constexpr_system_header

Conversation

@carlosgalvezp

Copy link
Copy Markdown
Contributor

…macros

As per review comments on https://reviews.llvm.org/D150226, we should allow for one more release before turning this warning into a hard error, by making it visible in system headers and macros, so that people are aware of it and can work on it.

@llvmbot llvmbot added clang Clang issues not falling into any other category clang:frontend Language frontend issues, e.g. anything involving "Sema" labels Sep 27, 2023
@llvmbot

llvmbot commented Sep 27, 2023

Copy link
Copy Markdown
Member

@llvm/pr-subscribers-clang

Changes

…macros

As per review comments on https://reviews.llvm.org/D150226, we should allow for one more release before turning this warning into a hard error, by making it visible in system headers and macros, so that people are aware of it and can work on it.


Full diff: https://github.com/llvm/llvm-project/pull/67528.diff

2 Files Affected:

  • (modified) clang/docs/ReleaseNotes.rst (+3)
  • (modified) clang/include/clang/Basic/DiagnosticASTKinds.td (+2-1)
diff --git a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst
index 477a40630f11097..3b6cfa776c85e46 100644
--- a/clang/docs/ReleaseNotes.rst
+++ b/clang/docs/ReleaseNotes.rst
@@ -67,6 +67,9 @@ C++ Specific Potentially Breaking Changes
   (`#49884 <https://github.com/llvm/llvm-project/issues/49884>`_), and
   (`#61273 <https://github.com/llvm/llvm-project/issues/61273>`_)
 
+- The warning `-Wenum-constexpr-conversion` is now also enabled by default on system headers and
+  macros. It will be turned into a hard (non-downgradable) error in the next Clang release.
+
 ABI Changes in This Version
 ---------------------------
 - Following the SystemV ABI for x86-64, ``__int128`` arguments will no longer
diff --git a/clang/include/clang/Basic/DiagnosticASTKinds.td b/clang/include/clang/Basic/DiagnosticASTKinds.td
index d2656310e79c9b8..0019553233fdef6 100644
--- a/clang/include/clang/Basic/DiagnosticASTKinds.td
+++ b/clang/include/clang/Basic/DiagnosticASTKinds.td
@@ -405,7 +405,8 @@ def warn_fixedpoint_constant_overflow : Warning<
   InGroup<DiagGroup<"fixed-point-overflow">>;
 def warn_constexpr_unscoped_enum_out_of_range : Warning<
   "integer value %0 is outside the valid range of values [%1, %2] for the "
-  "enumeration type %3">, DefaultError, InGroup<DiagGroup<"enum-constexpr-conversion">>;
+  "enumeration type %3">, DefaultError, ShowInSystemHeader, ShowInSystemMacro,
+  InGroup<DiagGroup<"enum-constexpr-conversion">>;
 
 // This is a temporary diagnostic, and shall be removed once our
 // implementation is complete, and like the preceding constexpr notes belongs

@carlosgalvezp

carlosgalvezp commented Sep 27, 2023 •

Copy link
Copy Markdown
Contributor Author

I would need some help with the failing pre-merge test, I don't really understand why that failure would be related to this patch...

/var/lib/buildkite-agent/builds/linux-56-7f758798dd-v9p4k-1/llvm-project/clang-ci/clang/unittests/Analysis/FlowSensitive/DebugSupportTest.cpp:111: Failure
--
  | Value of: Actual
  | Expected: is equal to "((Y & V2) \| (X \| V3))"
  | Actual: "((Y & V3) \| (X \| V2))"

Pinging @gribozavr @ymand @sgatev as Code Owners for the Analysis folder, does the above error signature look familiar/related to this change? Thanks!

@carlosgalvezp
carlosgalvezp force-pushed the enum_constexpr_system_header branch from 43e5902 to 8887959 Compare October 1, 2023 13:54
@carlosgalvezp

Copy link
Copy Markdown
Contributor Author

It seems checks are broken on trunk, I see commits merged with failing pre-merge tests. They seem to be unrelated to this patch though.

Is there anything else you'd like fixed before merging? @dwblaikie @AaronBallman @shafik

@dwblaikie

Copy link
Copy Markdown
Contributor

It seems checks are broken on trunk, I see commits merged with failing pre-merge tests. They seem to be unrelated to this patch though.

Is there anything else you'd like fixed before merging? @dwblaikie @AaronBallman @shafik

Nothing further from me, at least. But maybe wait for approval from one of the other two.

@carlosgalvezp

Copy link
Copy Markdown
Contributor Author

Friendly ping @AaronBallman @shafik

@AaronBallman AaronBallman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

…macros

As per review comments on https://reviews.llvm.org/D150226, we should
allow for one more release before turning this warning into a hard
error, by making it visible in system headers and macros, so that
people are aware of it and can work on it.
@carlosgalvezp
carlosgalvezp force-pushed the enum_constexpr_system_header branch from 8887959 to 83d8ad3 Compare October 14, 2023 12:15
@carlosgalvezp
carlosgalvezp merged commit e7a6171 into llvm:main Oct 14, 2023
@carlosgalvezp
carlosgalvezp deleted the enum_constexpr_system_header branch October 14, 2023 12:19
@smeenai

smeenai commented Oct 16, 2023

Copy link
Copy Markdown
Contributor

boostorg/mpl#69 is still a problem, unfortunately.

@shafik

shafik commented Oct 25, 2023

Copy link
Copy Markdown
Contributor

Thank you for doing this work.

paleauraaaa pushed a commit to paleauraaaa/llvm-project that referenced this pull request Oct 7, 2026
llvm#67528)

…macros

As per review comments on https://reviews.llvm.org/D150226, we should
allow for one more release before turning this warning into a hard
error, by making it visible in system headers and macros, so that people
are aware of it and can work on it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang:frontend Language frontend issues, e.g. anything involving "Sema" clang Clang issues not falling into any other category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants