[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / Driver / avr-toolchain.c
blobd32fe7fe931e640865662539070a3cf4ee701140
1 // UNSUPPORTED: system-windows
2 // A basic clang -cc1 command-line.
4 // RUN: %clang -### %s --target=avr --sysroot=%S/Inputs/basic_avr_tree -resource-dir=%S/Inputs/resource_dir 2>&1 | FileCheck --check-prefix=CHECK1 %s
5 // CHECK1: "-cc1" "-triple" "avr"
6 // CHECK1-SAME: "-resource-dir" "[[RESOURCE:[^"]+]]"
7 // CHECK1-SAME: "-isysroot" "[[SYSROOT:[^"]+/basic_avr_tree]]"
8 // CHECK1-SAME: "-internal-isystem"
9 // CHECK1-SAME: {{^}} "[[SYSROOT]]/usr/lib/gcc/avr/5.4.0/../../../avr/include"
10 // CHECK1-NOT: "-L
11 // CHECK1: avr-ld"
12 // CHECK1-SAME: "-o" "a.out"
13 // CHECK1-SAME: {{^}} "--gc-sections"
15 // RUN: %clang -### %s --target=avr --sysroot=%S/Inputs/basic_avr_tree_2/opt/local -S 2>&1 | FileCheck --check-prefix=CHECK2 %s
16 // CHECK2: "-cc1" "-triple" "avr"
17 // CHECK2-SAME: "-isysroot" "[[SYSROOT:[^"]+/basic_avr_tree_2/opt/local]]"
18 // CHECK2-SAME: "-internal-isystem"
19 // CHECK2-SAME: {{^}} "[[SYSROOT]]/lib/gcc/avr/10.3.0/../../../../avr/include"
21 // RUN: %clang -### %s --target=avr --sysroot=%S/Inputs/basic_avr_tree_2 -S 2>&1 | FileCheck --check-prefix=CHECK3 %s
22 // CHECK3: "-cc1" "-triple" "avr"
23 // CHECK3-SAME: "-isysroot" "[[SYSROOT:[^"]+/basic_avr_tree_2]]"
24 // CHECK3-SAME: "-internal-isystem"
25 // CHECK3-SAME: {{^}} "[[SYSROOT]]/usr/avr/include"
27 // RUN: %clang -### %s --target=avr 2>&1 | FileCheck -check-prefix=CC1 %s
28 // CC1: "-cc1" "-triple" "avr" {{.*}} "-fno-use-init-array" "-fno-use-cxa-atexit"
30 // RUN: %clang -### %s --target=avr -fuse-init-array -fuse-cxa-atexit 2>&1 | FileCheck -check-prefix=CHECK4 %s
31 // CHECK4: "-cc1" "-triple" "avr"
32 // CHECK4-NOT: "-fno-use-init-array"
33 // CHECK4-NOT: "-fno-use-cxa-atexit"
35 // RUN: %clang -### %s --target=avr --sysroot=%S/Inputs/basic_avr_tree 2>&1 -nostdinc | FileCheck --check-prefix=NOSTDINC %s
36 // RUN: %clang -### %s --target=avr --sysroot=%S/Inputs/basic_avr_tree 2>&1 -nostdlibinc | FileCheck --check-prefix=NOSTDINC %s
37 // NOSTDINC-NOT: "-internal-isystem" {{".*avr/include"}}
39 // RUN: %clang -### --target=avr --sysroot=%S/Inputs/basic_avr_tree -mmcu=atmega328 %s 2>&1 | FileCheck --check-prefix=NOWARN %s
40 // RUN: %clang -### --target=avr --sysroot=%S/Inputs/basic_avr_tree -mmcu=atmega328 -S %s 2>&1 | FileCheck --check-prefix=NOWARN %s
41 // RUN: %clang -### --target=avr --sysroot=%S/Inputs/ -mmcu=atmega328 -S %s 2>&1 | FileCheck --check-prefix=NOWARN %s
42 // NOWARN-NOT: warning:
44 // RUN: %clang -### --target=avr --sysroot=%S/Inputs/basic_avr_tree -S %s 2>&1 | FileCheck --check-prefixes=NOMCU,LINKA %s
45 // RUN: %clang -### --target=avr --sysroot=%S/Inputs/ -S %s 2>&1 | FileCheck --check-prefixes=NOMCU,LINKA %s
46 // RUN: %clang -### --target=avr --sysroot=%S/Inputs/basic_avr_tree %s 2>&1 | FileCheck --check-prefixes=NOMCU,LINKB %s
47 // NOMCU: warning: no target microcontroller specified on command line, cannot link standard libraries, please pass -mmcu=<mcu name>
48 // LINKB: warning: standard library not linked and so no interrupt vector table or compiler runtime routines will be linked
49 // LINKB: warning: support for passing the data section address to the linker for microcontroller '' is not implemented
50 // NOMCU-NOT: warning: {{.*}} avr-gcc
51 // NOMCU-NOT: warning: {{.*}} avr-libc
52 // LINKA-NOT: warning: {{.*}} interrupt vector
53 // LINKA-NOT: warning: {{.*}} data section address
55 // RUN: %clang -### --target=avr --sysroot=%S/Inputs/ -mmcu=atmega328 %s 2>&1 | FileCheck --check-prefixes=NOGCC %s
56 // NOGCC: warning: standard library not linked and so no interrupt vector table or compiler runtime routines will be linked
57 // NOGCC-NOT: warning: {{.*}} microcontroller
58 // NOGCC-NOT: warning: {{.*}} avr-libc
59 // NOGCC-NOT: warning: {{.*}} data section address
61 // RUN: %clang -### --target=avr --sysroot=%S/Inputs/basic_avr_tree -mmcu=atmega328 %s -fuse-ld=avrld 2>&1 | FileCheck --check-prefix=NOLD %s
62 // NOLD: error: invalid linker
64 // RUN: %clang -### --target=avr --sysroot=%S/Inputs/basic_avr_tree -mmcu=atmega328 %s -fuse-ld=%S/Inputs/basic_avr_tree/usr/bin/ld.lld 2>&1 | FileCheck --check-prefix=LLD %s
65 // LLD: {{".*lld"}}
66 // LLD-NOT: "avr-ld"
67 // LLD-NOT: "-mavr5"
69 // RUN: %clang -### --target=avr --sysroot=%S/Inputs/basic_avr_tree -mmcu=atmega328 %s -T avr.lds 2>&1 | FileCheck --check-prefix=LDS0 %s
70 // LDS0: "-T" "avr.lds" "-mavr5"
72 // RUN: %clang -### --target=avr --sysroot=%S/Inputs/basic_avr_tree -mmcu=atmega328 %s -fuse-ld=%S/Inputs/basic_avr_tree/usr/bin/ld.lld -T avr.lds 2>&1 | FileCheck --check-prefix=LDS1 %s
73 // LDS1: "-T" "avr.lds"
74 // LDS1-NOT: "-mavr5"
76 // RUN: %clang %s -### --target=avr -mmcu=atmega328 --sysroot=%S/Inputs/basic_avr_tree/ -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir --rtlib=libgcc 2>&1 | FileCheck --check-prefix=LIBGCC %s
77 // LIBGCC: "-lgcc"
78 // LIBGCC-NOT: libclang_rt
80 // RUN: %clang %s -### --target=avr -mmcu=atmega328 --sysroot=%S/Inputs/basic_avr_tree/ -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir --rtlib=compiler-rt 2>&1 | FileCheck --check-prefix=COMRT %s
81 // COMRT: avr/libclang_rt.builtins.a
82 // COMRT-NOT: "-lgcc"
84 // RUN: %clang %s -### --target=avr --sysroot=%S/Inputs/basic_avr_tree/ -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir --rtlib=compiler-rt 2>&1 | FileCheck --check-prefix=NOMCU %s
85 // RUN: %clang %s -### --target=avr --sysroot=%S/Inputs/basic_avr_tree/ -resource-dir=%S/Inputs/resource_dir_with_per_target_subdir --rtlib=libgcc 2>&1 | FileCheck --check-prefix=NOMCU %s
86 // NOMCU-NOT: libclang_rt
87 // NOMCU-NOT: "-lgcc"