Skip to content

Commit

Permalink
[ARM][Driver] Change float-abi warning
Browse files Browse the repository at this point in the history
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
  • Loading branch information
mplatings committed Jul 7, 2023
1 parent 336d728 commit 7916573
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
6 changes: 3 additions & 3 deletions clang/include/clang/Basic/DiagnosticDriverKinds.td
Original file line number Diff line number Diff line change
Expand Up @@ -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<
Expand Down
2 changes: 2 additions & 0 deletions clang/include/clang/Basic/DiagnosticGroups.td
Original file line number Diff line number Diff line change
Expand Up @@ -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">;
Expand Down
7 changes: 3 additions & 4 deletions clang/test/Driver/arm-no-float-regs.c
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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:

0 comments on commit 7916573

Please sign in to comment.