Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Oct 14, 2023

Conversation

carlosgalvezp
Copy link
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
Copy link
Member

llvmbot commented Sep 27, 2023

@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
Copy link
Contributor Author

carlosgalvezp commented Sep 27, 2023

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
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
Collaborator

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
Contributor Author

Friendly ping @AaronBallman @shafik

Copy link
Collaborator

@AaronBallman AaronBallman left a comment

Choose a reason for hiding this comment

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

LGTM!

Carlos Gálvez added 2 commits October 14, 2023 12:14
…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
Copy link
Collaborator

smeenai commented Oct 16, 2023

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

@shafik
Copy link
Collaborator

shafik commented Oct 25, 2023

Thank you for doing this work.

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.

7 participants