brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.2 KiB · 8b580e6 Raw
35 lines · c
1// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fsyntax-only -verify %s2// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -fsyntax-only -verify %s -DNO_CALLER_SAVED_REGISTERS=13// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -target-feature -x87 -target-feature -mmx -target-feature -sse -fsyntax-only -verify %s -DGPRONLY=14 5#if defined(NO_CALLER_SAVED_REGS) || defined(GPRONLY)6// expected-no-diagnostics7#else8#define EXPECT_WARNING9#endif10 11#ifdef NO_CALLER_SAVED_REGS12__attribute__((no_caller_saved_registers))13#endif14#ifdef EXPECT_WARNING15// expected-note@+3 {{'foo' declared here}}16// expected-note@+2 {{'foo' declared here}}17#endif18extern void foo(void *);19 20__attribute__((no_caller_saved_registers))21void no_caller_saved_registers(void *arg) {22#ifdef EXPECT_WARNING23// expected-warning@+2 {{function with attribute 'no_caller_saved_registers' should only call a function with attribute 'no_caller_saved_registers' or be compiled with '-mgeneral-regs-only'}}24#endif25    foo(arg);26}27 28__attribute__((interrupt))29void interrupt(void *arg) {30#ifdef EXPECT_WARNING31// expected-warning@+2 {{interrupt service routine should only call a function with attribute 'no_caller_saved_registers' or be compiled with '-mgeneral-regs-only'}}32#endif33    foo(arg);34}35