[PATCH] D87837: [Driver] Add disabled-by-default -Wuse-ld-non-word for the deprecation warning for -fuse-ld=/abs/path

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Sep 19 09:29:11 PDT 2020


MaskRay updated this revision to Diff 292973.
MaskRay retitled this revision from "[Driver] Remove the deprecation warning for -fuse-ld=/abs/path" to "[Driver] Add disabled-by-default -Wuse-ld-non-word for the deprecation warning for -fuse-ld=/abs/path".
MaskRay edited the summary of this revision.
MaskRay added a comment.

Add a warning flag


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D87837/new/

https://reviews.llvm.org/D87837

Files:
  clang/include/clang/Basic/DiagnosticDriverKinds.td
  clang/include/clang/Basic/DiagnosticGroups.td
  clang/test/Driver/fuse-ld.c


Index: clang/test/Driver/fuse-ld.c
===================================================================
--- clang/test/Driver/fuse-ld.c
+++ clang/test/Driver/fuse-ld.c
@@ -1,10 +1,18 @@
-// RUN: %clang %s -### \
-// RUN:     -fuse-ld=/usr/local/bin/or1k-linux-ld 2>&1 \
-// RUN:     -target x86_64-unknown-linux \
-// RUN:   | FileCheck %s --check-prefix=CHECK-ABSOLUTE-LD
+/// The absolute path warning is enabled by -Wuse-ld-non-word and -Wextra.
+// RUN: %clang %s -### -target x86_64-unknown-linux -Wuse-ld-non-word \
+// RUN:   -fuse-ld=/usr/local/bin/or1k-linux-ld 2>&1 | \
+// RUN:   FileCheck %s --check-prefix=CHECK-ABSOLUTE-LD
 // CHECK-ABSOLUTE-LD: warning: '-fuse-ld=' taking a path is deprecated. Use '--ld-path=' instead
 // CHECK-ABSOLUTE-LD: /usr/local/bin/or1k-linux-ld
 
+// RUN: %clang %s -### -target x86_64-unknown-linux -Wextra \
+// RUN:   -fuse-ld=/usr/local/bin/or1k-linux-ld 2>&1 | \
+// RUN:   FileCheck %s --check-prefix=CHECK-ABSOLUTE-LD
+
+// RUN: %clang %s -### -target x86_64-unknown-linux \
+// RUN:   -fuse-ld=/usr/local/bin/or1k-linux-ld 2>&1 | \
+// RUN:   FileCheck %s --check-prefix=CHECK-NO-WARN
+// CHECK-NO-WARN-NOT: warning:
 
 // RUN: %clang %s -### \
 // RUN:     -target x86_64-unknown-freebsd 2>&1 \
Index: clang/include/clang/Basic/DiagnosticGroups.td
===================================================================
--- clang/include/clang/Basic/DiagnosticGroups.td
+++ clang/include/clang/Basic/DiagnosticGroups.td
@@ -869,6 +869,8 @@
 def PointerToIntCast : DiagGroup<"pointer-to-int-cast",
                                  [PointerToEnumCast, VoidPointerToIntCast]>;
 
+def UseLdNonWord : DiagGroup<"use-ld-non-word">;
+
 def Move : DiagGroup<"move", [
     PessimizingMove,
     RedundantMove,
@@ -887,7 +889,8 @@
     UnusedParameter,
     NullPointerArithmetic,
     EmptyInitStatement,
-    StringConcatation
+    StringConcatation,
+    UseLdNonWord,
   ]>;
 
 def Most : DiagGroup<"most", [
Index: clang/include/clang/Basic/DiagnosticDriverKinds.td
===================================================================
--- clang/include/clang/Basic/DiagnosticDriverKinds.td
+++ clang/include/clang/Basic/DiagnosticDriverKinds.td
@@ -464,7 +464,8 @@
   InGroup<DiagGroup<"msvc-not-found">>;
 
 def warn_drv_use_ld_non_word : Warning<
-  "'-fuse-ld=' taking a path is deprecated. Use '--ld-path=' instead">;
+  "'-fuse-ld=' taking a path is deprecated. Use '--ld-path=' instead">,
+  InGroup<UseLdNonWord>, DefaultIgnore;
 
 def warn_drv_fine_grained_bitfield_accesses_ignored : Warning<
   "option '-ffine-grained-bitfield-accesses' cannot be enabled together with a sanitizer; flag ignored">,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D87837.292973.patch
Type: text/x-patch
Size: 2651 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200919/93f3afe4/attachment.bin>


More information about the cfe-commits mailing list