[PATCH] D154578: [ARM][Driver] Change float-abi warning

Michael Platings via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 6 01:35:18 PDT 2023


michaelplatings created this revision.
michaelplatings added a reviewer: simon_tatham.
Herald added a subscriber: kristof.beyls.
Herald added a project: All.
michaelplatings requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Previously the warning stated "flag ignored" which is only partially
true - the invalid flag would prevent -feature +soft-float-abi from
being emitted which resulted in user-visible behaviour like
__ARM_PCS_VFP being defined.

Rather than attempt to coerce invalid flags into valid behaviour, don't
describe the expected behaviour.

Ideally the warning would be an error, as it is in GCC. However there
are tests in llvm-project that trigger the warning. Therefore one has to
assume that making the warning an error would break other code that
already exists in the wild.

Also apply test improvements suggested by @MaskRay on D150902 <https://reviews.llvm.org/D150902>.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D154578

Files:
  clang/include/clang/Basic/DiagnosticDriverKinds.td
  clang/test/Driver/arm-no-float-regs.c


Index: clang/test/Driver/arm-no-float-regs.c
===================================================================
--- clang/test/Driver/arm-no-float-regs.c
+++ clang/test/Driver/arm-no-float-regs.c
@@ -1,7 +1,6 @@
-// REQUIRES: arm-registered-target
-
 // Check that -mfloat-abi=hard gives a warning if FP registers aren't available.
-// RUN: %clang --target=arm-none-eabi -mcpu=cortex-m0 -mfloat-abi=hard -### -c %s 2>&1
+// RUN: %clang --target=arm-none-eabi -mcpu=cortex-m0 -mfloat-abi=hard -### -c %s 2>&1 \
+// RUN:   | FileCheck %s
 
 // RUN: %clang --target=arm-none-eabi -mcpu=cortex-m0 -mhard-float -### -c %s 2>&1 \
 // RUN:   | FileCheck -check-prefix=HARDFLOAT %s
@@ -20,4 +19,4 @@
 
 // CHECK: warning: '-mfloat-abi=hard': selected processor lacks floating point registers
 // HARDFLOAT: warning: '-mhard-float': selected processor lacks floating point registers
-// NOWARN-NOT: selected processor lacks floating point registers
+// NOWARN-NOT: warning:
Index: clang/include/clang/Basic/DiagnosticDriverKinds.td
===================================================================
--- clang/include/clang/Basic/DiagnosticDriverKinds.td
+++ clang/include/clang/Basic/DiagnosticDriverKinds.td
@@ -418,8 +418,8 @@
   "float ABI '%0' is not supported by current library">,
   InGroup<DiagGroup<"unsupported-abi">>;
 def warn_drv_no_floating_point_registers: Warning<
-  "'%0': selected processor lacks floating point registers; flag ignored">,
-  InGroup<OptionIgnored>;
+  "'%0': selected processor lacks floating point registers">,
+  InGroup<DiagGroup<"unsupported-abi">>;
 def warn_ignoring_ftabstop_value : Warning<
   "ignoring invalid -ftabstop value '%0', using default value %1">;
 def warn_drv_overriding_flag_option : Warning<


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D154578.537621.patch
Type: text/x-patch
Size: 1745 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230706/d6ebe4af/attachment.bin>


More information about the cfe-commits mailing list