| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-Wno-old-style-definition" } */ |
| 3 |
|
| 4 |
#define CONCAT_(A,B) A ## B |
| 5 |
#define CONCAT(A,B) CONCAT_(A,B) |
| 6 |
|
| 7 |
#define ATTR __attribute__((AT)) |
| 8 |
#define ATSYM(suf) CONCAT (AT, CONCAT_ (_, suf)) |
| 9 |
|
| 10 |
#define AT noinline |
| 11 |
|
| 12 |
typedef int ATSYM(type) ATTR; /* { dg-warning "attribute ignored" } */ |
| 13 |
|
| 14 |
typedef int (*ATSYM(fntype))(void) ATTR; /* { dg-warning "attribute ignored" } */ |
| 15 |
|
| 16 |
struct ATSYM(struct) { |
| 17 |
char dummy ATTR; /* { dg-warning "attribute ignored" } */ |
| 18 |
} ATTR; /* { dg-warning "does not apply to types" } */ |
| 19 |
|
| 20 |
int ATSYM(var) ATTR; /* { dg-warning "attribute ignored" } */ |
| 21 |
|
| 22 |
int ATSYM(fn_knrarg) (arg) |
| 23 |
int arg ATTR; /* { dg-warning "attribute ignored" } */ |
| 24 |
{ return 0; } |
| 25 |
|
| 26 |
int ATSYM(fn_isoarg) (int arg ATTR) { return 0; } /* { dg-warning "attribute ignored" } */ |
| 27 |
|
| 28 |
int ATSYM(fn_vars) (void) { |
| 29 |
static int svar ATTR; /* { dg-warning "attribute ignored" } */ |
| 30 |
auto int lvar ATTR; /* { dg-warning "attribute ignored" } */ |
| 31 |
return 0; |
| 32 |
} |
| 33 |
|
| 34 |
|
| 35 |
#undef AT |
| 36 |
#define AT used |
| 37 |
|
| 38 |
typedef int ATSYM(type) ATTR; /* used attribute is no longer |
| 39 |
ignored. */ |
| 40 |
|
| 41 |
typedef int (*ATSYM(fntype))(void) ATTR; /* used attribute is no |
| 42 |
longer ignored. */ |
| 43 |
|
| 44 |
struct ATSYM(struct) { |
| 45 |
char dummy ATTR; /* { dg-warning "attribute ignored" } */ |
| 46 |
} ATTR; /* { dg-warning "does not apply to types" } */ |
| 47 |
|
| 48 |
int ATSYM(var) ATTR; |
| 49 |
|
| 50 |
int ATSYM(fn_knrarg) (arg) |
| 51 |
int arg ATTR; /* { dg-warning "attribute ignored" } */ |
| 52 |
{ return 0; } |
| 53 |
|
| 54 |
int ATSYM(fn_isoarg) (int arg ATTR) { return 0; } /* { dg-warning "attribute ignored" } */ |
| 55 |
|
| 56 |
int ATSYM(fn_vars) (void) { |
| 57 |
static int svar ATTR; |
| 58 |
auto int lvar ATTR; /* { dg-warning "attribute ignored" } */ |
| 59 |
return 0; |
| 60 |
} |
| 61 |
|
| 62 |
|
| 63 |
/* PR 28287 */ |
| 64 |
/* These are invalid on all targets. Applying to PARM_ or FIELD_DECL |
| 65 |
also caused a tree checking ice on targets that support weak, */ |
| 66 |
#undef AT |
| 67 |
#define AT weak |
| 68 |
|
| 69 |
typedef int ATSYM(type) ATTR; /* { dg-warning "attribute ignored" } */ |
| 70 |
|
| 71 |
typedef int (*ATSYM(fntype))(void) ATTR; /* { dg-warning "attribute ignored" } */ |
| 72 |
|
| 73 |
struct ATSYM(struct) { |
| 74 |
char dummy ATTR; /* { dg-warning "attribute ignored" } */ |
| 75 |
}; |
| 76 |
|
| 77 |
int ATSYM(fn_knrarg) (arg) |
| 78 |
int arg ATTR; /* { dg-warning "attribute ignored" } */ |
| 79 |
{ return 0; } |
| 80 |
|
| 81 |
int ATSYM(fn_isoarg) (int arg ATTR) { return 0; } /* { dg-warning "attribute ignored" } */ |
| 82 |
|
| 83 |
|
| 84 |
/* PR target/28648 */ |
| 85 |
/* These are invalid on all targets. Applying to PARM_ or FIELD_DECL |
| 86 |
also caused a tree checking ice on targets that support dllimport. */ |
| 87 |
#undef AT |
| 88 |
#define AT dllimport |
| 89 |
|
| 90 |
typedef int ATSYM(type) ATTR; /* { dg-warning "attribute |directive ignored" } */ |
| 91 |
|
| 92 |
typedef int (*ATSYM(fntype))(void) ATTR; /* { dg-warning "attribute |directive ignored" } */ |
| 93 |
|
| 94 |
struct ATSYM(struct) { |
| 95 |
char dummy ATTR; /* { dg-warning "attribute |directive ignored" } */ |
| 96 |
}; |
| 97 |
|
| 98 |
int ATSYM(fn_knrarg) (arg) |
| 99 |
int arg ATTR; /* { dg-warning "attribute |directive ignored" } */ |
| 100 |
{ return 0; } |
| 101 |
|
| 102 |
int ATSYM(fn_isoarg) (int arg ATTR) { return 0; } /* { dg-warning "attribute |directive ignored" } */ |