Skip to content

Commit

Permalink
[Driver] Prepend - to option name in err_drv_unsupported_option_argum…
Browse files Browse the repository at this point in the history
…ent diagnostic
  • Loading branch information
MaskRay committed Apr 10, 2022
1 parent 5f1eb74 commit a96cbb5
Show file tree
Hide file tree
Showing 21 changed files with 33 additions and 33 deletions.
2 changes: 1 addition & 1 deletion clang/include/clang/Basic/DiagnosticDriverKinds.td
Expand Up @@ -19,7 +19,7 @@ def err_drv_unsupported_opt_for_target : Error<
def err_drv_unsupported_opt_for_language_mode : Error<
"unsupported option '%0' for language mode '%1'">;
def err_drv_unsupported_option_argument : Error<
"unsupported argument '%1' to option '%0'">;
"unsupported argument '%1' to option '-%0'">;
def err_drv_unknown_stdin_type : Error<
"-E or -x required when input is from standard input">;
def err_drv_unknown_stdin_type_clang_cl : Error<
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/Driver/SanitizerArgs.cpp
Expand Up @@ -234,7 +234,7 @@ static SanitizerMask parseSanitizeTrapArgs(const Driver &D,
SanitizerSet S;
S.Mask = InvalidValues;
D.Diag(diag::err_drv_unsupported_option_argument)
<< "-fsanitize-trap" << toString(S);
<< Arg->getOption().getName() << toString(S);
}
TrappingKinds |= expandSanitizerGroups(Add) & ~TrapRemove;
} else if (Arg->getOption().matches(options::OPT_fno_sanitize_trap_EQ)) {
Expand Down
2 changes: 1 addition & 1 deletion clang/lib/Driver/ToolChains/MSP430.cpp
Expand Up @@ -101,7 +101,7 @@ void msp430::getMSP430TargetFeatures(const Driver &D, const ArgList &Args,
Features.push_back("+hwmultf5");
} else {
D.Diag(clang::diag::err_drv_unsupported_option_argument)
<< HWMultArg->getAsString(Args) << HWMult;
<< HWMultArg->getOption().getName() << HWMult;
}
}

Expand Down
2 changes: 1 addition & 1 deletion clang/test/Driver/aarch64-sve-vector-bits.c
Expand Up @@ -51,7 +51,7 @@
// RUN: %clang -c %s -### -target aarch64-none-linux-gnu -march=armv8-a+sve \
// RUN: -msve-vector-bits=A 2>&1 | FileCheck --check-prefix=CHECK-BAD-VALUE-ERROR %s

// CHECK-BAD-VALUE-ERROR: error: unsupported argument '{{.*}}' to option 'msve-vector-bits='
// CHECK-BAD-VALUE-ERROR: error: unsupported argument '{{.*}}' to option '-msve-vector-bits='

// Error if using attribute without -msve-vector-bits=<bits> or if using -msve-vector-bits=<bits>+ syntax
// -----------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion clang/test/Driver/arm-implicit-it.s
Expand Up @@ -21,4 +21,4 @@
// CHECK-THUMB: "-arm-implicit-it=thumb"
// CHECK-NEVER: "-arm-implicit-it=never"
// CHECK-ALWAYS: "-arm-implicit-it=always"
// CHECK-INVALID: error: unsupported argument 'thisisnotavalidoption' to option 'mimplicit-it='
// CHECK-INVALID: error: unsupported argument 'thisisnotavalidoption' to option '-mimplicit-it='
4 changes: 2 additions & 2 deletions clang/test/Driver/arm-target-as-mimplicit-it.s
Expand Up @@ -47,5 +47,5 @@
// NEVER-NOT: "-arm-implicit-it={{.*}}"
// ARM: "-mllvm" "-arm-implicit-it=arm"
// THUMB: "-mllvm" "-arm-implicit-it=thumb"
// INVALID: error: unsupported argument '-mimplicit-it=foo' to option 'Wa,'
// XINVALID: error: unsupported argument '-mimplicit-it=foo' to option 'Xassembler'
// INVALID: error: unsupported argument '-mimplicit-it=foo' to option '-Wa,'
// XINVALID: error: unsupported argument '-mimplicit-it=foo' to option '-Xassembler'
6 changes: 3 additions & 3 deletions clang/test/Driver/clang_f_opts.c
Expand Up @@ -197,12 +197,12 @@
// CHECK-ROUNDING-MATH-NOT: "-fno-rounding-math"
// RUN: %clang -### -S %s 2>&1 | FileCheck -check-prefix=CHECK-ROUNDING-MATH-NOT %s
// RUN: %clang -### -S -ffp-model=imprecise %s 2>&1 | FileCheck -check-prefix=CHECK-FPMODEL %s
// CHECK-FPMODEL: unsupported argument 'imprecise' to option 'ffp-model='
// CHECK-FPMODEL: unsupported argument 'imprecise' to option '-ffp-model='
// RUN: %clang -### -S -ffp-model=precise %s 2>&1 | FileCheck -check-prefix=IGNORE %s
// RUN: %clang -### -S -ffp-model=strict %s 2>&1 | FileCheck -check-prefix=IGNORE %s
// RUN: %clang -### -S -ffp-model=fast %s 2>&1 | FileCheck -check-prefix=IGNORE %s
// RUN: %clang -### -S -ffp-exception-behavior=trap %s 2>&1 | FileCheck -check-prefix=CHECK-FPEB %s
// CHECK-FPEB: unsupported argument 'trap' to option 'ffp-exception-behavior='
// CHECK-FPEB: unsupported argument 'trap' to option '-ffp-exception-behavior='
// RUN: %clang -### -S -ffp-exception-behavior=maytrap %s 2>&1 | FileCheck -check-prefix=IGNORE %s
// RUN: %clang -### -S -ffp-exception-behavior=ignore %s 2>&1 | FileCheck -check-prefix=IGNORE %s
// RUN: %clang -### -S -ffp-exception-behavior=strict %s 2>&1 | FileCheck -check-prefix=IGNORE %s
Expand Down Expand Up @@ -393,7 +393,7 @@
// CHECK-WARNING-DAG: optimization flag '-ftracer' is not supported
// CHECK-WARNING-DAG: optimization flag '-funroll-all-loops' is not supported
// CHECK-WARNING-DAG: optimization flag '-funswitch-loops' is not supported
// CHECK-WARNING-DAG: unsupported argument '1' to option 'flto='
// CHECK-WARNING-DAG: unsupported argument '1' to option '-flto='
// CHECK-WARNING-DAG: optimization flag '-falign-labels' is not supported
// CHECK-WARNING-DAG: optimization flag '-falign-labels=100' is not supported
// CHECK-WARNING-DAG: optimization flag '-falign-loops' is not supported
Expand Down
2 changes: 1 addition & 1 deletion clang/test/Driver/compress-noias.c
Expand Up @@ -29,5 +29,5 @@

// RUN: %clang -### -target i686-unknown-linux-gnu -fno-integrated-as -gz=invalid -x assembler -c %s 2>&1 | FileCheck -check-prefix CHECK-OPT_GZ_EQ_INVALID %s
// RUN: %clang -### -target i686-unknown-linux-gnu -fno-integrated-as -gz=invalid -c %s 2>&1 | FileCheck -check-prefix CHECK-OPT_GZ_EQ_INVALID %s
// CHECK-OPT_GZ_EQ_INVALID: error: unsupported argument 'invalid' to option 'gz='
// CHECK-OPT_GZ_EQ_INVALID: error: unsupported argument 'invalid' to option '-gz='

2 changes: 1 addition & 1 deletion clang/test/Driver/compress.c
Expand Up @@ -31,4 +31,4 @@

// RUN: %clang -### -fintegrated-as -gz=invalid -x assembler -c %s 2>&1 | FileCheck -check-prefix CHECK-OPT_GZ_EQ_INVALID %s
// RUN: %clang -### -fintegrated-as -gz=invalid -c %s 2>&1 | FileCheck -check-prefix CHECK-OPT_GZ_EQ_INVALID %s
// CHECK-OPT_GZ_EQ_INVALID: error: unsupported argument 'invalid' to option 'gz='
// CHECK-OPT_GZ_EQ_INVALID: error: unsupported argument 'invalid' to option '-gz='
2 changes: 1 addition & 1 deletion clang/test/Driver/fprofile-update.c
Expand Up @@ -12,4 +12,4 @@

// RUN: not %clang %s -c -fprofile-update=unknown 2>&1 | FileCheck %s --check-prefix=ERROR

// ERROR: error: unsupported argument 'unknown' to option 'fprofile-update='
// ERROR: error: unsupported argument 'unknown' to option '-fprofile-update='
2 changes: 1 addition & 1 deletion clang/test/Driver/fsanitize-address-destructor.c
Expand Up @@ -17,4 +17,4 @@
// RUN: %clang -target x86_64-apple-macosx10.15-gnu -fsanitize=address \
// RUN: -fsanitize-address-destructor=bad_arg %s -### 2>&1 | \
// RUN: FileCheck -check-prefix=CHECK-INVALID-ARG %s
// CHECK-INVALID-ARG: error: unsupported argument 'bad_arg' to option 'fsanitize-address-destructor='
// CHECK-INVALID-ARG: error: unsupported argument 'bad_arg' to option '-fsanitize-address-destructor='
2 changes: 1 addition & 1 deletion clang/test/Driver/fsanitize-coverage.c
Expand Up @@ -54,7 +54,7 @@
// CHECK-MASK-NOT: -fsanitize-coverage-

// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=foobar %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-INVALID-VALUE
// CHECK-INVALID-VALUE: error: unsupported argument 'foobar' to option 'fsanitize-coverage='
// CHECK-INVALID-VALUE: error: unsupported argument 'foobar' to option '-fsanitize-coverage='

// RUN: %clang -target x86_64-linux-gnu -fsanitize=address -fsanitize-coverage=func -fsanitize-coverage=edge %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-INCOMPATIBLE
// CHECK-INCOMPATIBLE: error: invalid argument '-fsanitize-coverage=func' not allowed with '-fsanitize-coverage=edge'
Expand Down
2 changes: 1 addition & 1 deletion clang/test/Driver/fsanitize-use-after-return.c
Expand Up @@ -27,4 +27,4 @@
// RUN: %clang -target x86_64-apple-macosx10.15-gnu -fsanitize=address \
// RUN: -fsanitize-address-use-after-return=bad_arg %s -### 2>&1 | \
// RUN: FileCheck -check-prefix=CHECK-INVALID-ARG %s
// CHECK-INVALID-ARG: error: unsupported argument 'bad_arg' to option 'fsanitize-address-use-after-return='
// CHECK-INVALID-ARG: error: unsupported argument 'bad_arg' to option '-fsanitize-address-use-after-return='
18 changes: 9 additions & 9 deletions clang/test/Driver/fsanitize.c
Expand Up @@ -84,7 +84,7 @@
// CHECK-BOUNDS: "-fsanitize={{((array-bounds|local-bounds),?){2}"}}

// RUN: %clang -target x86_64-linux-gnu -fsanitize=all %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-FSANITIZE-ALL
// CHECK-FSANITIZE-ALL: error: unsupported argument 'all' to option 'fsanitize='
// CHECK-FSANITIZE-ALL: error: unsupported argument 'all' to option '-fsanitize='

// RUN: %clang -target x86_64-linux-gnu -fsanitize=address,undefined -fno-sanitize=all -fsanitize=thread %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-FNO-SANITIZE-ALL
// CHECK-FNO-SANITIZE-ALL: "-fsanitize=thread"
Expand Down Expand Up @@ -366,16 +366,16 @@
// CHECK-RECOVER-ASAN: "-fsanitize-recover=address"

// RUN: %clang -target x86_64-linux-gnu %s -fsanitize=undefined -fsanitize-recover=foobar,object-size,unreachable -### 2>&1 | FileCheck %s --check-prefix=CHECK-DIAG-RECOVER
// CHECK-DIAG-RECOVER: unsupported argument 'foobar' to option 'fsanitize-recover='
// CHECK-DIAG-RECOVER: unsupported argument 'unreachable' to option 'fsanitize-recover='
// CHECK-DIAG-RECOVER: unsupported argument 'foobar' to option '-fsanitize-recover='
// CHECK-DIAG-RECOVER: unsupported argument 'unreachable' to option '-fsanitize-recover='

// RUN: %clang -target x86_64-linux-gnu %s -fsanitize=undefined -fsanitize-recover -fno-sanitize-recover -### 2>&1 | FileCheck %s --check-prefix=CHECK-DEPRECATED-RECOVER
// CHECK-DEPRECATED-RECOVER-NOT: is deprecated

// RUN: %clang -target x86_64-linux-gnu %s -fsanitize=kernel-address -fno-sanitize-recover=kernel-address -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-RECOVER-KASAN
// RUN: %clang -target x86_64-linux-gnu %s -fsanitize=kernel-hwaddress -fno-sanitize-recover=kernel-hwaddress -### 2>&1 | FileCheck %s --check-prefix=CHECK-NO-RECOVER-KHWASAN
// CHECK-NO-RECOVER-KASAN: unsupported argument 'kernel-address' to option 'fno-sanitize-recover='
// CHECK-NO-RECOVER-KHWASAN: unsupported argument 'kernel-hwaddress' to option 'fno-sanitize-recover='
// CHECK-NO-RECOVER-KASAN: unsupported argument 'kernel-address' to option '-fno-sanitize-recover='
// CHECK-NO-RECOVER-KHWASAN: unsupported argument 'kernel-hwaddress' to option '-fno-sanitize-recover='

// RUN: %clang -target x86_64-linux-gnu -fsanitize=leak %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-SANL
// CHECK-SANL: "-fsanitize=leak"
Expand Down Expand Up @@ -440,8 +440,8 @@
// CHECK-ASAN: "-fno-assume-sane-operator-new"

// RUN: %clang -target x86_64-linux-gnu -fsanitize=zzz %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-DIAG1
// CHECK-DIAG1: unsupported argument 'zzz' to option 'fsanitize='
// CHECK-DIAG1-NOT: unsupported argument 'zzz' to option 'fsanitize='
// CHECK-DIAG1: unsupported argument 'zzz' to option '-fsanitize='
// CHECK-DIAG1-NOT: unsupported argument 'zzz' to option '-fsanitize='

// RUN: %clang -target x86_64-apple-darwin10 -fsanitize=memory %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-MSAN-DARWIN
// CHECK-MSAN-DARWIN: unsupported option '-fsanitize=memory' for target 'x86_64-apple-darwin10'
Expand Down Expand Up @@ -605,10 +605,10 @@
// CHECK-CFI-ICALL-MIPS: unsupported option '-fsanitize=cfi-icall' for target 'mips-unknown-linux'

// RUN: %clang -target x86_64-linux-gnu -fsanitize-trap=address -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-ASAN-TRAP
// CHECK-ASAN-TRAP: error: unsupported argument 'address' to option '-fsanitize-trap'
// CHECK-ASAN-TRAP: error: unsupported argument 'address' to option '-fsanitize-trap='

// RUN: %clang -target x86_64-linux-gnu -fsanitize-trap=hwaddress -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-HWASAN-TRAP
// CHECK-HWASAN-TRAP: error: unsupported argument 'hwaddress' to option '-fsanitize-trap'
// CHECK-HWASAN-TRAP: error: unsupported argument 'hwaddress' to option '-fsanitize-trap='

// RUN: %clang -target x86_64-apple-darwin10 -mmacosx-version-min=10.7 -flto -fsanitize=cfi-vcall -fno-sanitize-trap=cfi -c %s -### 2>&1 | FileCheck %s --check-prefix=CHECK-CFI-NOTRAP-OLD-MACOS
// CHECK-CFI-NOTRAP-OLD-MACOS: error: unsupported option '-fno-sanitize-trap=cfi-vcall' for target 'x86_64-apple-darwin10'
Expand Down
2 changes: 1 addition & 1 deletion clang/test/Driver/hexagon-hvx.c
Expand Up @@ -218,7 +218,7 @@

// Invalid HVX length:

// CHECK-HVX-BAD-LENGTH: error: unsupported argument '{{.*}}' to option 'mhvx-length='
// CHECK-HVX-BAD-LENGTH: error: unsupported argument '{{.*}}' to option '-mhvx-length='

// RUN: %clang -c %s -### -target hexagon-unknown-elf -mhvx -mhvx-length=B \
// RUN: 2>&1 | FileCheck -check-prefix=CHECK-HVX-BAD-LENGTH %s
Expand Down
2 changes: 1 addition & 1 deletion clang/test/Driver/masm.c
Expand Up @@ -9,7 +9,7 @@ int f() {
// CHECK-INTEL: -inline-asm=intel
// CHECK-ATT: -x86-asm-syntax=att
// CHECK-ATT: -inline-asm=att
// CHECK-SOMEREQUIRED: error: unsupported argument 'somerequired' to option 'masm='
// CHECK-SOMEREQUIRED: error: unsupported argument 'somerequired' to option '-masm='
// CHECK-ARM: warning: argument unused during compilation: '-masm=intel'
// CHECK-CL: -x86-asm-syntax=intel
// CHECK-CL-NOT: -inline-asm=intel
Expand Down
2 changes: 1 addition & 1 deletion clang/test/Driver/masm.s
Expand Up @@ -5,7 +5,7 @@

// CHECK-INTEL: -x86-asm-syntax=intel
// CHECK-ATT: -x86-asm-syntax=att
// CHECK-SOMEREQUIRED: error: unsupported argument 'somerequired' to option 'masm='
// CHECK-SOMEREQUIRED: error: unsupported argument 'somerequired' to option '-masm='
// CHECK-ARM: warning: argument unused during compilation: '-masm=intel'
.text
mov al, 0
2 changes: 1 addition & 1 deletion clang/test/Driver/mbig-obj.c
Expand Up @@ -3,4 +3,4 @@
// RUN: %clang --target=x86_64-linux -c -Wa,-mbig-obj %s -### 2>&1 | FileCheck %s --check-prefix=LINUX
// RUN: %clang --target=x86_64-linux -c -Xassembler -mbig-obj %s -### 2>&1 | FileCheck %s --check-prefix=LINUX
// WINDOWS-NOT: argument unused during compilation
// LINUX: unsupported argument '-mbig-obj' to option '{{(Wa,|Xassembler)}}'
// LINUX: unsupported argument '-mbig-obj' to option '-{{(Wa,|Xassembler)}}'
2 changes: 1 addition & 1 deletion clang/test/Driver/msp430-hwmult.c
Expand Up @@ -24,7 +24,7 @@
// CHECK-F5: "-target-feature" "+hwmultf5"

// RUN: %clang -### -target msp430 %s -mhwmult=rrr 2>&1 | FileCheck --check-prefix=INVL-ARG %s
// INVL-ARG: error: unsupported argument 'rrr' to option '-mhwmult=rrr'
// INVL-ARG: error: unsupported argument 'rrr' to option '-mhwmult='

// RUN: %clang -### -target msp430 %s -mhwmult=auto 2>&1 | FileCheck --check-prefix=WRN-NODEV %s
// WRN-NODEV: warning: no MCU device specified, but '-mhwmult' is set to 'auto',
Expand Down
2 changes: 1 addition & 1 deletion clang/test/Driver/windows-cross.c
Expand Up @@ -69,7 +69,7 @@
// RUN: %clang -### -target armv7-windows-itanium --sysroot %S/Inputs/Windows/ARM/8.1 -B %S/Inputs/Windows/ARM/8.1/usr/bin -fuse-ld=lld-link2 -shared -o shared.dll -fsanitize=tsan -x c++ %s 2>&1 \
// RUN: | FileCheck %s --check-prefix CHECK-SANITIZE-TSAN

// CHECK-SANITIZE-TSAN: error: unsupported argument 'tsan' to option 'fsanitize='
// CHECK-SANITIZE-TSAN: error: unsupported argument 'tsan' to option '-fsanitize='
// CHECK-SANITIZE-TSAN-NOT: "-fsanitize={{.*}}"

// RUN: %clang -### -target armv7-windows-itanium -isystem-after "Windows Kits/10/Include/10.0.10586.0/ucrt" -isystem-after "Windows Kits/10/Include/10.0.10586.0/um" -isystem-after "Windows Kits/10/Include/10.0.10586.0/shared" -c %s -o /dev/null 2>&1 \
Expand Down
4 changes: 2 additions & 2 deletions clang/test/OpenMP/linking.c
Expand Up @@ -58,12 +58,12 @@
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: -fopenmp=lib -target i386-unknown-linux \
// RUN: | FileCheck --check-prefix=CHECK-LIB-LD-32 %s
// CHECK-LIB-LD-32: error: unsupported argument 'lib' to option 'fopenmp='
// CHECK-LIB-LD-32: error: unsupported argument 'lib' to option '-fopenmp='
//
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: -fopenmp=lib -target x86_64-unknown-linux \
// RUN: | FileCheck --check-prefix=CHECK-LIB-LD-64 %s
// CHECK-LIB-LD-64: error: unsupported argument 'lib' to option 'fopenmp='
// CHECK-LIB-LD-64: error: unsupported argument 'lib' to option '-fopenmp='
//
// RUN: %clang -no-canonical-prefixes %s -### -o %t.o 2>&1 \
// RUN: -fopenmp -fopenmp=libgomp -target i386-unknown-linux \
Expand Down

0 comments on commit a96cbb5

Please sign in to comment.