Skip to content

[Driver] Fix erroneous warning for -fcx-limited-range and -fcx-fortran-rules. #79821

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

Merged
merged 3 commits into from
Jan 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion clang/lib/Driver/ToolChains/Clang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2705,7 +2705,7 @@ static StringRef EnumComplexRangeToStr(LangOptions::ComplexRangeKind Range) {
static void EmitComplexRangeDiag(const Driver &D,
LangOptions::ComplexRangeKind Range1,
LangOptions::ComplexRangeKind Range2) {
if (Range1 != LangOptions::ComplexRangeKind::CX_Full)
if (Range1 != Range2 && Range1 != LangOptions::ComplexRangeKind::CX_None)
D.Diag(clang::diag::warn_drv_overriding_option)
<< EnumComplexRangeToStr(Range1) << EnumComplexRangeToStr(Range2);
}
Expand Down
6 changes: 6 additions & 0 deletions clang/test/Driver/range.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@
// RUN: %clang -### -target x86_64 -ffast-math -fno-cx-limited-range -c %s 2>&1 \
// RUN: | FileCheck --check-prefix=FULL %s

// RUN: %clang -### -Werror -target x86_64 -fcx-limited-range -c %s 2>&1 \
// RUN: | FileCheck --check-prefix=LMTD %s

// RUN: %clang -### -Werror -target x86_64 -fcx-fortran-rules -c %s 2>&1 \
// RUN: | FileCheck --check-prefix=FRTRN %s

// LMTD: -complex-range=limited
// FULL: -complex-range=full
// LMTD-NOT: -complex-range=fortran
Expand Down