Clang Project

clang_source_code/test/Driver/gcc_forward.c
1// Check that we don't try to forward -Xclang or -mlinker-version to GCC.
2// PR12920 -- Check also we may not forward W_Group options to GCC.
3//
4// RUN: %clang -target powerpc-unknown-unknown \
5// RUN:   %s \
6// RUN:   -Wall -Wdocumentation \
7// RUN:   -Xclang foo-bar \
8// RUN:   -march=x86-64 \
9// RUN:   -mlinker-version=10 -### 2> %t
10// RUN: FileCheck < %t %s
11//
12// clang -cc1
13// CHECK: clang
14// CHECK: "-Wall" "-Wdocumentation"
15// CHECK: "-o" "{{[^"]+}}.o"
16//
17// gcc as ld.
18// CHECK: gcc{{[^"]*}}"
19// CHECK-NOT: "-mlinker-version=10"
20// CHECK-NOT: "-Xclang"
21// CHECK-NOT: "foo-bar"
22// CHECK-NOT: "-Wall"
23// CHECK-NOT: "-Wdocumentation"
24// CHECK: -march
25// CHECK-NOT: "-mlinker-version=10"
26// CHECK-NOT: "-Xclang"
27// CHECK-NOT: "foo-bar"
28// CHECK-NOT: "-Wall"
29// CHECK-NOT: "-Wdocumentation"
30// CHECK: "-o" "a.out"
31
32// Check that we're not forwarding -g options to the assembler
33// RUN: %clang -g -target x86_64-unknown-linux-gnu -no-integrated-as -c %s -### 2>&1 \
34// RUN:   | FileCheck --check-prefix=CHECK-ASM %s
35// CHECK-ASM: as
36// CHECK-ASM-NOT: "-g"
37
38// Check that we're not forwarding -mno-unaligned-access.
39// RUN: %clang -target aarch64-none-elf -mno-unaligned-access %s -### 2>&1 \
40// RUN:   | FileCheck --check-prefix=CHECK-ARM %s
41// CHECK-ARM: gcc{{[^"]*}}"
42// CHECK-ARM-NOT: -mno-unaligned-access
43