File: attr-invalid.c

package info (click to toggle)
gcc-riscv64-unknown-elf 8.3.0.2019.08%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 680,956 kB
  • sloc: ansic: 3,237,715; cpp: 896,882; ada: 772,854; f90: 144,254; asm: 68,788; makefile: 67,456; sh: 29,743; exp: 28,045; objc: 15,273; fortran: 11,885; python: 7,369; pascal: 5,375; awk: 3,725; perl: 2,872; yacc: 316; xml: 311; ml: 285; lex: 198; haskell: 122
file content (102 lines) | stat: -rw-r--r-- 2,928 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
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" } */