[PATCH] D153885: [Clang][Driver] Change missing multilib error to warning

Michael Platings via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 27 08:32:57 PDT 2023


michaelplatings created this revision.
michaelplatings added a reviewer: simon_tatham.
Herald added a project: All.
michaelplatings requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay.
Herald added a project: clang.

The error could be awkward to work around when experimenting with flags
that didn't have a matching multilib. It also broke many tests when
multilib.yaml was present in the build directory.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D153885

Files:
  clang/include/clang/Basic/DiagnosticDriverKinds.td
  clang/include/clang/Basic/DiagnosticGroups.td
  clang/lib/Driver/ToolChains/BareMetal.cpp
  clang/test/Driver/baremetal-multilib.yaml


Index: clang/test/Driver/baremetal-multilib.yaml
===================================================================
--- clang/test/Driver/baremetal-multilib.yaml
+++ clang/test/Driver/baremetal-multilib.yaml
@@ -23,7 +23,7 @@
 # RUN: %T/baremetal_multilib/bin/clang -no-canonical-prefixes -x c++ %s -### -o %t.out 2>&1 \
 # RUN:     --target=thumbv7em-none-eabi -mfpu=fpv4-sp-d16 --sysroot= \
 # RUN:   | FileCheck --check-prefix=CHECK-NO-MATCH %s
-# CHECK-NO-MATCH: error: no multilib found matching flags:
+# CHECK-NO-MATCH: warning: no multilib found matching flags:
 # CHECK-NO-MATCH-SAME: --target=thumbv7em-none-unknown-eabi
 # CHECK-NO-MATCH: note: available multilibs are:
 # CHECK-NO-MATCH: --target=thumbv6m-none-unknown-eabi -mfpu=none
Index: clang/lib/Driver/ToolChains/BareMetal.cpp
===================================================================
--- clang/lib/Driver/ToolChains/BareMetal.cpp
+++ clang/lib/Driver/ToolChains/BareMetal.cpp
@@ -175,7 +175,7 @@
   Result.Multilibs = ErrorOrMultilibSet.get();
   if (Result.Multilibs.select(Flags, Result.SelectedMultilibs))
     return;
-  D.Diag(clang::diag::err_drv_no_matching_multilib) << llvm::join(Flags, " ");
+  D.Diag(clang::diag::warn_drv_no_matching_multilib) << llvm::join(Flags, " ");
   std::stringstream ss;
   for (const Multilib &Multilib : Result.Multilibs)
     ss << "\n" << llvm::join(Multilib.flags(), " ");
Index: clang/include/clang/Basic/DiagnosticGroups.td
===================================================================
--- clang/include/clang/Basic/DiagnosticGroups.td
+++ clang/include/clang/Basic/DiagnosticGroups.td
@@ -1435,3 +1435,6 @@
 
 // Warnings and fixes to support the "safe buffers" programming model.
 def UnsafeBufferUsage : DiagGroup<"unsafe-buffer-usage">;
+
+// Warnings for multilib
+def MissingMultilib : DiagGroup<"missing-multilib">;
Index: clang/include/clang/Basic/DiagnosticDriverKinds.td
===================================================================
--- clang/include/clang/Basic/DiagnosticDriverKinds.td
+++ clang/include/clang/Basic/DiagnosticDriverKinds.td
@@ -737,8 +737,9 @@
 def err_drv_expand_response_file : Error<
   "failed to expand response file: %0">;
 
-def err_drv_no_matching_multilib : Error<
-  "no multilib found matching flags: %0">;
+def warn_drv_no_matching_multilib : Warning<
+  "no multilib found matching flags: %0">,
+  InGroup<MissingMultilib>;
 def note_drv_available_multilibs : Note<
   "available multilibs are:%0">;
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D153885.535000.patch
Type: text/x-patch
Size: 2482 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230627/ebb0d126/attachment.bin>


More information about the cfe-commits mailing list