[clang] ea7e69f - [Driver] Drop incorrect hint from err_target_unknown_triple

Fangrui Song via cfe-commits cfe-commits at lists.llvm.org
Mon May 1 18:22:54 PDT 2023


Author: Fangrui Song
Date: 2023-05-01T18:22:49-07:00
New Revision: ea7e69f392b29201502cdcb8cfa83f0f3704da34

URL: https://github.com/llvm/llvm-project/commit/ea7e69f392b29201502cdcb8cfa83f0f3704da34
DIFF: https://github.com/llvm/llvm-project/commit/ea7e69f392b29201502cdcb8cfa83f0f3704da34.diff

LOG: [Driver] Drop incorrect hint from err_target_unknown_triple

For an unknown target triple, the ", please use -triple or -arch" hint of the
diagnostic is almost always wrong.
For cc1, the error is due to a specified but unknown -triple.
For driver, -triple and -arch are not driver options.

Added: 
    

Modified: 
    clang/include/clang/Basic/DiagnosticCommonKinds.td
    clang/include/clang/Basic/DiagnosticDriverKinds.td
    clang/test/Driver/unsupported-target-arch.c
    clang/test/Misc/serialized-diags-unknown-target.c

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/Basic/DiagnosticCommonKinds.td b/clang/include/clang/Basic/DiagnosticCommonKinds.td
index bac77299671c5..da4e2b42dc2ea 100644
--- a/clang/include/clang/Basic/DiagnosticCommonKinds.td
+++ b/clang/include/clang/Basic/DiagnosticCommonKinds.td
@@ -308,7 +308,7 @@ def warn_dup_category_def : Warning<
 // Targets
 
 def err_target_unknown_triple : Error<
-  "unknown target triple '%0', please use -triple or -arch">;
+  "unknown target triple '%0'">;
 def err_target_unknown_cpu : Error<"unknown target CPU '%0'">;
 def note_valid_options : Note<"valid target CPU values are: %0">;
 def err_target_unsupported_cpu_for_micromips : Error<

diff  --git a/clang/include/clang/Basic/DiagnosticDriverKinds.td b/clang/include/clang/Basic/DiagnosticDriverKinds.td
index 1efe7573028ef..4c7d9e80338ec 100644
--- a/clang/include/clang/Basic/DiagnosticDriverKinds.td
+++ b/clang/include/clang/Basic/DiagnosticDriverKinds.td
@@ -255,6 +255,7 @@ def warn_drv_unknown_argument_clang_cl : Warning<
 def warn_drv_unknown_argument_clang_cl_with_suggestion : Warning<
   "unknown argument ignored in clang-cl '%0'; did you mean '%1'?">,
   InGroup<UnknownArgument>;
+def err_drv_unknown_target_triple : Error<"unknown target triple '%0'">;
 
 def warn_drv_ycyu_
diff erent_arg_clang_cl : Warning<
   "support for '/Yc' and '/Yu' with 
diff erent filenames not implemented yet; flags ignored">,

diff  --git a/clang/test/Driver/unsupported-target-arch.c b/clang/test/Driver/unsupported-target-arch.c
index 7c55850f49943..11be696546dbc 100644
--- a/clang/test/Driver/unsupported-target-arch.c
+++ b/clang/test/Driver/unsupported-target-arch.c
@@ -2,23 +2,23 @@
 //
 // RUN: not %clang --target=noarch-unknown-linux -o %t.o %s 2> %t.err
 // RUN: FileCheck --input-file=%t.err --check-prefix=CHECK-NOARCH-LINUX %s
-// CHECK-NOARCH-LINUX: error: unknown target triple 'noarch-unknown-linux', please use -triple or -arch
+// CHECK-NOARCH-LINUX: error: unknown target triple 'noarch-unknown-linux'{{$}}
 //
 // RUN: not %clang --target=noarch-unknown-darwin -o %t.o %s 2> %t.err
 // RUN: FileCheck --input-file=%t.err --check-prefix=CHECK-NOARCH-DARWIN %s
-// CHECK-NOARCH-DARWIN: error: unknown target triple 'unknown-unknown-macosx{{.+}}', please use -triple or -arch
+// CHECK-NOARCH-DARWIN: error: unknown target triple 'unknown-unknown-macosx{{.+}}'{{$}}
 //
 // RUN: not %clang --target=noarch-unknown-windows -o %t.o %s 2> %t.err
 // RUN: FileCheck --input-file=%t.err --check-prefix=CHECK-NOARCH-WINDOWS %s
-// CHECK-NOARCH-WINDOWS: error: unknown target triple 'noarch-unknown-windows-{{.+}}', please use -triple or -arch
+// CHECK-NOARCH-WINDOWS: error: unknown target triple 'noarch-unknown-windows-{{.+}}'{{$}}
 //
 // RUN: not %clang --target=noarch-unknown-freebsd -o %t.o %s 2> %t.err
 // RUN: FileCheck --input-file=%t.err --check-prefix=CHECK-NOARCH-FREEBSD %s
-// CHECK-NOARCH-FREEBSD: error: unknown target triple 'noarch-unknown-freebsd', please use -triple or -arch
+// CHECK-NOARCH-FREEBSD: error: unknown target triple 'noarch-unknown-freebsd'{{$}}
 //
 // RUN: not %clang --target=noarch-unknown-netbsd -o %t.o %s 2> %t.err
 // RUN: FileCheck --input-file=%t.err --check-prefix=CHECK-NOARCH-NETBSD %s
-// CHECK-NOARCH-NETBSD: error: unknown target triple 'noarch-unknown-netbsd', please use -triple or -arch
+// CHECK-NOARCH-NETBSD: error: unknown target triple 'noarch-unknown-netbsd'{{$}}
 //
 // RUN: not %clang --target=noarch-unknown-nacl -o %t.o %s 2> %t.err
 // RUN: FileCheck --input-file=%t.err --check-prefix=CHECK-NOARCH-NACL %s

diff  --git a/clang/test/Misc/serialized-diags-unknown-target.c b/clang/test/Misc/serialized-diags-unknown-target.c
index 040dfa4b2849e..c6d18811333df 100644
--- a/clang/test/Misc/serialized-diags-unknown-target.c
+++ b/clang/test/Misc/serialized-diags-unknown-target.c
@@ -1,4 +1,4 @@
 // RUN: rm -rf %t && mkdir %t
 // RUN: not %clang_cc1 %s -triple blah-unknown-unknown -serialize-diagnostic-file %t/diag -o /dev/null 2>&1 | FileCheck %s
 
-// CHECK: error: unknown target triple 'blah-unknown-unknown', please use -triple or -arch
+// CHECK: error: unknown target triple 'blah-unknown-unknown'{{$}}


        


More information about the cfe-commits mailing list