diff options
author | Ben Cheng <bccheng@google.com> | 2014-03-25 22:37:19 -0700 |
---|---|---|
committer | Ben Cheng <bccheng@google.com> | 2014-03-25 22:37:19 -0700 |
commit | 1bc5aee63eb72b341f506ad058502cd0361f0d10 (patch) | |
tree | c607e8252f3405424ff15bc2d00aa38dadbb2518 /gcc-4.9/gcc/testsuite/gcc.dg/attr-invalid.c | |
parent | 283a0bf58fcf333c58a2a92c3ebbc41fb9eb1fdb (diff) | |
download | toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.tar.gz toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.tar.bz2 toolchain_gcc-1bc5aee63eb72b341f506ad058502cd0361f0d10.zip |
Initial checkin of GCC 4.9.0 from trunk (r208799).
Change-Id: I48a3c08bb98542aa215912a75f03c0890e497dba
Diffstat (limited to 'gcc-4.9/gcc/testsuite/gcc.dg/attr-invalid.c')
-rw-r--r-- | gcc-4.9/gcc/testsuite/gcc.dg/attr-invalid.c | 102 |
1 files changed, 102 insertions, 0 deletions
diff --git a/gcc-4.9/gcc/testsuite/gcc.dg/attr-invalid.c b/gcc-4.9/gcc/testsuite/gcc.dg/attr-invalid.c new file mode 100644 index 000000000..f2a5887a7 --- /dev/null +++ b/gcc-4.9/gcc/testsuite/gcc.dg/attr-invalid.c @@ -0,0 +1,102 @@ +/* { 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" "" } */ +{ return 0; } + +int ATSYM(fn_isoarg) (int arg ATTR) { return 0; } /* { 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" "" } */ + return 0; +} + + +#undef AT +#define AT used + +typedef int ATSYM(type) ATTR; /* used attribute is no longer + ignored. */ + +typedef int (*ATSYM(fntype))(void) ATTR; /* used attribute is no + longer ignored. */ + +struct ATSYM(struct) { + char dummy ATTR; /* { dg-warning "attribute ignored" "" } */ +} ATTR; /* { dg-warning "does not apply to types" "" } */ + +int ATSYM(var) ATTR; + +int ATSYM(fn_knrarg) (arg) + int arg ATTR; /* { dg-warning "attribute ignored" "" } */ +{ return 0; } + +int ATSYM(fn_isoarg) (int arg ATTR) { return 0; } /* { dg-warning "attribute ignored" "" } */ + +int ATSYM(fn_vars) (void) { + static int svar ATTR; + auto int lvar ATTR; /* { dg-warning "attribute ignored" "" } */ + return 0; +} + + +/* PR 28287 */ +/* These are invalid on all targets. Applying to PARM_ or FIELD_DECL + also caused a tree checking ice on targets that support weak, */ +#undef AT +#define AT weak + +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" "" } */ +}; + +int ATSYM(fn_knrarg) (arg) + int arg ATTR; /* { dg-warning "attribute ignored" "" } */ +{ return 0; } + +int ATSYM(fn_isoarg) (int arg ATTR) { return 0; } /* { dg-warning "attribute ignored" "" } */ + + +/* PR target/28648 */ +/* These are invalid on all targets. Applying to PARM_ or FIELD_DECL + also caused a tree checking ice on targets that support dllimport. */ +#undef AT +#define AT dllimport + +typedef int ATSYM(type) ATTR; /* { dg-warning "attribute |directive ignored" "" } */ + +typedef int (*ATSYM(fntype))(void) ATTR; /* { dg-warning "attribute |directive ignored" "" } */ + +struct ATSYM(struct) { + char dummy ATTR; /* { dg-warning "attribute |directive ignored" "" } */ +}; + +int ATSYM(fn_knrarg) (arg) + int arg ATTR; /* { dg-warning "attribute |directive ignored" "" } */ +{ return 0; } + +int ATSYM(fn_isoarg) (int arg ATTR) { return 0; } /* { dg-warning "attribute |directive ignored" "" } */ |