diff options
author | Ted Kremenek <kremenek@apple.com> | 2007-11-13 18:37:02 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2007-11-13 18:37:02 +0000 |
commit | db87bca211deed14f8d5bb9ef25b8e9ee5c8e139 (patch) | |
tree | 5703930f1d2150e941f791accf4b6df5085256f7 /Driver/clang.cpp | |
parent | a36c48676c0a48953c1a0885fa333be5851bbf94 (diff) |
Added -Wfloat-equal option to the driver. This makes warnings about
floating point comparisons using == or != an opt-in rather than a default
warning.
Updated test case to use -Wfloat-equal.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@44053 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'Driver/clang.cpp')
-rw-r--r-- | Driver/clang.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Driver/clang.cpp b/Driver/clang.cpp index f568302444..5897da32a3 100644 --- a/Driver/clang.cpp +++ b/Driver/clang.cpp @@ -356,6 +356,10 @@ static llvm::cl::opt<bool> WarnUnusedMacros("Wunused_macros", llvm::cl::desc("Warn for unused macros in the main translation unit")); +static llvm::cl::opt<bool> +WarnFloatEqual("Wfloat-equal", + llvm::cl::desc("Warn about equality comparisons of floating point values.")); + /// InitializeDiagnostics - Initialize the diagnostic object, based on the /// current command line option settings. static void InitializeDiagnostics(Diagnostic &Diags) { @@ -366,6 +370,10 @@ static void InitializeDiagnostics(Diagnostic &Diags) { // Silence the "macro is not used" warning unless requested. if (!WarnUnusedMacros) Diags.setDiagnosticMapping(diag::pp_macro_not_used, diag::MAP_IGNORE); + + // Silence "floating point comparison" warnings unless requested. + if (!WarnFloatEqual) + Diags.setDiagnosticMapping(diag::warn_floatingpoint_eq, diag::MAP_IGNORE); } //===----------------------------------------------------------------------===// |