llvm-project/clang/test/Driver/munaligned-access-unused.c
Fangrui Song cd071253c7
[Driver] Don't alias -mstrict-align to -mno-unaligned-access
GCC ports only supports one of the options, with -mstrict-align
preferred by newer ports. They reject adding -m[no-]unaligned-access to
newer ports that use -m[no-]strict-align.
(https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111555).

We should not support aliases, either. Since the behavior has been
long-time for ARM (a146a48349c965932dcf304ffb8155b25307f245), support
both forms for ARM for now but remove -m[no-]unaligned-access for
RISC-V/LoongArch (see also
https://github.com/riscv-non-isa/riscv-c-api-doc/pull/62).

While here, add TargetSpecific to ensure errors on unsupported targets
(https://reviews.llvm.org/D151590) and remove unneeded CC1 options.

Pull Request: https://github.com/llvm/llvm-project/pull/85350
2024-03-15 10:50:21 -07:00

10 lines
729 B
C

/// Check -m[no-]unaligned-access and -m[no-]strict-align are errored on a target that does not support them.
// RUN: not %clang --target=x86_64 -munaligned-access -fsyntax-only %s -### 2>&1 | FileCheck %s -DOPTION=unaligned-access
// RUN: not %clang --target=x86_64 -mno-unaligned-access -fsyntax-only %s -### 2>&1 | FileCheck %s -DOPTION=no-unaligned-access
// RUN: not %clang --target=x86_64 -mno-strict-align -mstrict-align -fsyntax-only %s -### 2>&1 | FileCheck %s --check-prefix=ALIGN
// CHECK: error: unsupported option '-m{{(no-)?}}unaligned-access' for target '{{.*}}'
// ALIGN: error: unsupported option '-mno-strict-align' for target '{{.*}}'
// ALIGN: error: unsupported option '-mstrict-align' for target '{{.*}}'