diff options
author | aoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-10-18 18:29:25 +0000 |
---|---|---|
committer | aoliva <aoliva@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-10-18 18:29:25 +0000 |
commit | 37632f39ea4b961dfaaaf6141c91c409936bfa78 (patch) | |
tree | 673e59e65cf4e63246e3df599bc7224a96704a11 /gcc/testsuite/gcc.dg | |
parent | 93f10b04ca36ad37324d33de23650fc0f053683b (diff) | |
download | ppe42-gcc-37632f39ea4b961dfaaaf6141c91c409936bfa78.tar.gz ppe42-gcc-37632f39ea4b961dfaaaf6141c91c409936bfa78.zip |
* gcc.dg/attr-noinline.c, gcc.dg/attr-used.c: New tests.
* gcc.dg/attr-invalid.c: Likewise.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@46335 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg')
-rw-r--r-- | gcc/testsuite/gcc.dg/attr-invalid.c | 56 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/attr-noinline.c | 66 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/attr-used.c | 13 |
3 files changed, 135 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/attr-invalid.c b/gcc/testsuite/gcc.dg/attr-invalid.c new file mode 100644 index 00000000000..768921d8b18 --- /dev/null +++ b/gcc/testsuite/gcc.dg/attr-invalid.c @@ -0,0 +1,56 @@ +/* { dg-do compile } */ +/* { dg-options "" } */ + +#define CONCAT_(A,B) A ## B +#define CONCAT(A,B) CONCAT_(A,B) + +#define ATTR __attribute__((AT)) +#define ATSYM(suf) CONCAT (AT, CONCAT_ (_, suf)) + +#define AT noinline + +typedef int ATSYM(type) ATTR; /* { dg-warning "attribute ignored" "" } */ + +typedef int (*ATSYM(fntype))(void) ATTR; /* { dg-warning "attribute ignored" "" } */ + +struct ATSYM(struct) { + char dummy ATTR; /* { dg-warning "attribute ignored" "" } */ +} ATTR; /* { dg-warning "does not apply to types" "" } */ + +int ATSYM(var) ATTR; /* { dg-warning "attribute ignored" "" } */ + +int ATSYM(fn_knrarg) (arg) + int arg ATTR; /* { dg-warning "attribute ignored" "" } */ +{} + +int ATSYM(fn_isoarg) (int arg ATTR) {} /* { dg-warning "attribute ignored" "" } */ + +int ATSYM(fn_vars) (void) { + static int svar ATTR; /* { dg-warning "attribute ignored" "" } */ + auto int lvar ATTR; /* { dg-warning "attribute ignored" "" } */ +} + + +#undef AT +#define AT used + +typedef int ATSYM(type) ATTR; /* { dg-warning "attribute ignored" "" } */ + +typedef int (*ATSYM(fntype))(void) ATTR; /* { dg-warning "attribute ignored" "" } */ + +struct ATSYM(struct) { + char dummy ATTR; /* { dg-warning "attribute ignored" "" } */ +} ATTR; /* { dg-warning "does not apply to types" "" } */ + +int ATSYM(var) ATTR; /* { dg-warning "attribute ignored" "" } */ + +int ATSYM(fn_knrarg) (arg) + int arg ATTR; /* { dg-warning "attribute ignored" "" } */ +{} + +int ATSYM(fn_isoarg) (int arg ATTR) {} /* { dg-warning "attribute ignored" "" } */ + +int ATSYM(fn_vars) (void) { + static int svar ATTR; /* { dg-warning "attribute ignored" "" } */ + auto int lvar ATTR; /* { dg-warning "attribute ignored" "" } */ +} diff --git a/gcc/testsuite/gcc.dg/attr-noinline.c b/gcc/testsuite/gcc.dg/attr-noinline.c new file mode 100644 index 00000000000..903959e09f1 --- /dev/null +++ b/gcc/testsuite/gcc.dg/attr-noinline.c @@ -0,0 +1,66 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -finline-functions" } */ + +static inline void __attribute__((__noinline__)) function_definition(void) {} /* { dg-warning "inline function \[^\n\]* given attribute noinline" "" } */ + +static inline void __attribute__((__noinline__)) function_declaration_both_before(void); /* { dg-warning "inline function \[^\n\]* given attribute noinline" "" } */ + +static void function_declaration_both_before(void) {} + +static void function_declaration_both_after(void); + +static inline void __attribute__((__noinline__)) function_declaration_both_after(void); /* { dg-warning "(inline function \[^\n\]* given attribute noinline|declared inline after its definition)" "" } */ + +static void function_declaration_both_after(void) {} + +static void function_declaration_noinline_before(void) __attribute__((__noinline__)); /* { dg-warning "previous declaration \[^\n\]* with attribute noinline" "" } */ + +static inline void function_declaration_noinline_before(void) {} /* { dg-warning "function \[^\n\]* redeclared as inline" "" } */ + +static inline void function_declaration_noinline_after(void) {} /* { dg-warning "previous declaration \[^\n\]* was inline" "" } */ + +static void function_declaration_noinline_after(void) __attribute__((__noinline__)); /* { dg-warning "function \[^\n\]* redeclared with attribute noinline" "" } */ + +static inline void function_declaration_inline_before(void); /* { dg-warning "previous declaration \[^\n\]* was inline" "" } */ + +static void __attribute__((__noinline__)) function_declaration_inline_before(void) {} /* { dg-warning "function \[^\n\]* redeclared with attribute noinline" "" } */ + +static inline void function_declaration_inline_noinline_before(void); /* { dg-warning "previous declaration \[^\n\]* was inline" "" } */ + +static void function_declaration_inline_noinline_before(void) __attribute__((__noinline__)); /* { dg-warning "function \[^\n\]* redeclared with attribute noinline" "" } */ + +static void function_declaration_inline_noinline_before(void) {} + +static inline void function_declaration_inline_noinline_after(void); + +static void function_declaration_inline_noinline_after(void) {} /* { dg-warning "previous declaration \[^\n\]* was inline" "" } */ + +static void function_declaration_inline_noinline_after(void) __attribute__((__noinline__)); /* { dg-warning "function \[^\n\]* redeclared with attribute noinline" "" } */ + +static void function_declaration_noinline_inline_before(void) __attribute__((__noinline__)); /* { dg-warning "previous declaration\[^\n\]* with attribute noinline" "" } */ + +static inline void function_declaration_noinline_inline_before(void); /* { dg-warning "function \[^\n\]* redeclared as inline" "" } */ + +static void function_declaration_noinline_inline_before(void) {} + +int f () { + function_definition (); + function_declaration_both_before (); + function_declaration_both_after (); + function_declaration_noinline_before (); + function_declaration_noinline_after (); + function_declaration_inline_before (); + function_declaration_inline_noinline_before (); + function_declaration_inline_noinline_after (); + function_declaration_noinline_inline_before (); +} + +/* { dg-final { scan-assembler "function_definition" } } */ +/* { dg-final { scan-assembler "function_declaration_both_before" } } */ +/* { dg-final { scan-assembler "function_declaration_both_after" } } */ +/* { dg-final { scan-assembler "function_declaration_noinline_before" } } */ +/* { dg-final { scan-assembler "function_declaration_noinline_after" } } */ +/* { dg-final { scan-assembler "function_declaration_inline_before" } } */ +/* { dg-final { scan-assembler "function_declaration_inline_noinline_before" } } */ +/* { dg-final { scan-assembler "function_declaration_inline_noinline_after" } } */ +/* { dg-final { scan-assembler "function_declaration_noinline_inline_before" } } */ diff --git a/gcc/testsuite/gcc.dg/attr-used.c b/gcc/testsuite/gcc.dg/attr-used.c new file mode 100644 index 00000000000..ba7705aaa77 --- /dev/null +++ b/gcc/testsuite/gcc.dg/attr-used.c @@ -0,0 +1,13 @@ +/* { dg-do compile } */ +/* { dg-options "-O3" } */ + +static void function_declaration_before(void) __attribute__((__used__)); + +static void function_declaration_before(void) {} + +static void function_declaration_after(void) {} + +static void function_declaration_after(void) __attribute__((__used__)); + +/* { dg-final { scan-assembler "function_declaration_before" } } */ +/* { dg-final { scan-assembler "function_declaration_after" } } */ |