[clang] 7916573 - [ARM][Driver] Change float-abi warning
Michael Platings via cfe-commits
cfe-commits at lists.llvm.org
Fri Jul 7 01:41:24 PDT 2023
Author: Michael Platings
Date: 2023-07-07T09:41:18+01:00
New Revision: 79165735e11e40e1fbbb91ccbdd4df24d6349837
URL: https://github.com/llvm/llvm-project/commit/79165735e11e40e1fbbb91ccbdd4df24d6349837
DIFF: https://github.com/llvm/llvm-project/commit/79165735e11e40e1fbbb91ccbdd4df24d6349837.diff
LOG: [ARM][Driver] Change float-abi warning
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.
Reviewed By: simon_tatham
Differential Revision: https://reviews.llvm.org/D154578
Added:
Modified:
clang/include/clang/Basic/DiagnosticDriverKinds.td
clang/include/clang/Basic/DiagnosticGroups.td
clang/test/Driver/arm-no-float-regs.c
Removed:
################################################################################
diff --git a/clang/include/clang/Basic/DiagnosticDriverKinds.td b/clang/include/clang/Basic/DiagnosticDriverKinds.td
index d8112641eaf58f..095fbfe8ba2b1d 100644
--- a/clang/include/clang/Basic/DiagnosticDriverKinds.td
+++ b/clang/include/clang/Basic/DiagnosticDriverKinds.td
@@ -416,10 +416,10 @@ def warn_drv_assuming_mfloat_abi_is : Warning<
"unknown platform, assuming -mfloat-abi=%0">;
def warn_drv_unsupported_float_abi_by_lib : Warning<
"float ABI '%0' is not supported by current library">,
- InGroup<DiagGroup<"unsupported-abi">>;
+ InGroup<UnsupportedABI>;
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<UnsupportedABI>;
def warn_ignoring_ftabstop_value : Warning<
"ignoring invalid -ftabstop value '%0', using default value %1">;
def warn_drv_overriding_flag_option : Warning<
diff --git a/clang/include/clang/Basic/DiagnosticGroups.td b/clang/include/clang/Basic/DiagnosticGroups.td
index 7f5fb2c1b1495d..8b15337fda8829 100644
--- a/clang/include/clang/Basic/DiagnosticGroups.td
+++ b/clang/include/clang/Basic/DiagnosticGroups.td
@@ -1349,6 +1349,8 @@ def OptionIgnored : DiagGroup<"option-ignored">;
def UnknownArgument : DiagGroup<"unknown-argument">;
+def UnsupportedABI : DiagGroup<"unsupported-abi">;
+
// A warning group for warnings about code that clang accepts when
// compiling OpenCL C/C++ but which is not compatible with the SPIR(-V) spec.
def SpirCompat : DiagGroup<"spir-compat">;
diff --git a/clang/test/Driver/arm-no-float-regs.c b/clang/test/Driver/arm-no-float-regs.c
index b542f7d2805fe0..b46d8fc292c916 100644
--- a/clang/test/Driver/arm-no-float-regs.c
+++ b/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:
More information about the cfe-commits
mailing list