Skip to content

[clang] Remove FEM_Indeterminable #137247

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ojhunt
Copy link
Contributor

@ojhunt ojhunt commented Apr 24, 2025

Remove FEM_Indeterminable as it is unused and cannot be stored safely in an unsigned bitfield

Remove FEM_Indeterminable as it is unused and cannot be stored safely in an unsigned bitfield
@ojhunt ojhunt requested review from mstorsjo and zahiraam April 24, 2025 20:32
@ojhunt ojhunt self-assigned this Apr 24, 2025
@llvmbot llvmbot added clang Clang issues not falling into any other category clang:frontend Language frontend issues, e.g. anything involving "Sema" labels Apr 24, 2025
@llvmbot
Copy link
Member

llvmbot commented Apr 24, 2025

@llvm/pr-subscribers-clang

Author: Oliver Hunt (ojhunt)

Changes

Remove FEM_Indeterminable as it is unused and cannot be stored safely in an unsigned bitfield


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

1 Files Affected:

  • (modified) clang/include/clang/Basic/LangOptions.h (+1-4)
diff --git a/clang/include/clang/Basic/LangOptions.h b/clang/include/clang/Basic/LangOptions.h
index bbebf7af9ede3..1bfc0d8e88556 100644
--- a/clang/include/clang/Basic/LangOptions.h
+++ b/clang/include/clang/Basic/LangOptions.h
@@ -304,10 +304,7 @@ class LangOptionsBase {
   };
 
   /// Possible float expression evaluation method choices.
-  enum FPEvalMethodKind {
-    /// The evaluation method cannot be determined or is inconsistent for this
-    /// target.
-    FEM_Indeterminable = -1,
+  enum FPEvalMethodKind : unsigned {
     /// Use the declared type for fp arithmetic.
     FEM_Source = 0,
     /// Use the type double for fp arithmetic.

@ojhunt
Copy link
Contributor Author

ojhunt commented Apr 24, 2025

@zahiraam you added these originally, I can't find any use of FEM_Indeterminable, and no obvious place where any one is doing <0 or <FEM_Source so removing it seems reasonable?

Because language options, etc are stored in unsigned bitfields a negative enum will always come out wrong (the warning being emitted now that we do actually check against a stated preferred_type is correct here). I considered just making it 4 but given it's not used I'm not sure there's a reason to keep it around at all?

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.

2 participants