================
@@ -2730,17 +2730,38 @@ static void
CollectArgsForIntegratedAssembler(Compilation &C,
}
}
-static std::string ComplexArithmeticStr(LangOptions::ComplexRangeKind Range) {
- return (Range == LangOptions::ComplexRangeKind::CX_None)
- ? ""
- : "-fcomplex-arithmetic=" + complexRangeKindToStr(Range);
-}
+static void EmitComplexRangeDiag(const Driver &D, StringRef LastOpt,
+ LangOptions::ComplexRangeKind Range,
+ StringRef NewOpt,
+ LangOptions::ComplexRangeKind NewRange) {
+ // Do not emit a warning if NewOpt overrides LastOpt in the following cases.
+ //
+ // | LastOpt | NewOpt |
+ // |-----------------------|-----------------------|
+ // | -fcx-limited-range | -fno-cx-limited-range |
+ // | -fno-cx-limited-range | -fcx-limited-range |
+ // | -fcx-fortran-rules | -fno-cx-fortran-rules |
+ // | -fno-cx-fortran-rules | -fcx-fortran-rules |
+ // | -ffast-math | -fno-fast-math |
+ // | -ffp-model= | -fno-fast-math |
+ // | -ffp-model= | -ffp-model= |
+ // | -fcomplex-arithmetic= | -fcomplex-arithmetic= |
+ if (LastOpt == NewOpt || NewOpt.empty() || LastOpt.empty() ||
+ (LastOpt == "-fcx-limited-range" && NewOpt == "-fno-cx-limited-range") ||
+ (LastOpt == "-fno-cx-limited-range" && NewOpt == "-fcx-limited-range") ||
+ (LastOpt == "-fcx-fortran-rules" && NewOpt == "-fno-cx-fortran-rules") ||
+ (LastOpt == "-fno-cx-fortran-rules" && NewOpt == "-fcx-fortran-rules") ||
+ (LastOpt == "-ffast-math" && NewOpt == "-fno-fast-math") ||
+ (LastOpt.starts_with("-ffp-model=") && NewOpt == "-fno-fast-math") ||
----------------
s-watanabe314 wrote:
Thank you for your feedback. I will add `LastOpt.starts_with("-ffp-model=") &&
NewOpt == "-ffast-math"` to the conditions that do not issue a warning. If the
order is reversed, such as `-ffast-math -ffp-model=strict`, should a warning be
issued?
> This (LastOpt.starts_with("-ffp-model=") &&
> NewOpt.starts_with("-ffp-model=")) generates already a warning.
Yes, in this case, a warning will be issued
[here](https://github.com/llvm/llvm-project/blob/018dc1b3977bb249d55a6808bb45802a10f818fa/clang/lib/Driver/ToolChains/Clang.cpp#L2981-L2984),
so I believe there is no need to issue a warning about the complex range.
https://github.com/llvm/llvm-project/pull/154899
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits