File: Wduplicate-decl-specifier.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 (63 lines) | stat: -rw-r--r-- 1,837 bytes parent folder | download | duplicates (6)
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
/* PR43651 */
/* { dg-do compile } */
/* { dg-options "-Wduplicate-decl-specifier" } */

typedef const int CT1;
#define CT2 const int
typedef volatile int VT1;
#define VT2 volatile int
typedef char *restrict RT1;
#define RT2 char *restrict

void
foo (void)
{
  const CT1 x1;
  const CT2 x2;
  CT1 const x3;
  CT2 const x4;
  const int const x5; /* { dg-warning "duplicate .const." } */
  const int *const x6;
  volatile VT1 y1;
  volatile VT2 y2;
  VT1 volatile y3;
  VT2 volatile y4;
  volatile int volatile y5; /* { dg-warning "duplicate .volatile." } */
  volatile int *volatile y6;
  RT1 restrict r1;
  RT2 restrict r2;
  restrict RT1 r3;
  /* "restrict RT2" is invalid */
  char *restrict restrict r4; /* { dg-warning "duplicate .restrict." } */
  char *restrict *restrict r5;
}

void c1(const CT1 t) { }
void c2(const CT2 t) { }
void c3(CT1 const t) { }
void c4(CT2 const t) { }
void c5(const int const t) { }  /* { dg-warning "duplicate .const." } */
void v1(volatile VT1 t) { }
void v2(volatile VT2 t) { }
void v3(VT1 volatile t) { }
void v4(VT2 volatile t) { }
void v5(volatile int volatile t) { } /* { dg-warning "duplicate .volatile." } */
void r1(restrict RT1 t) { }
void r2(RT1 restrict t) { }
void r3(RT2 restrict t) { }
void r4(char *restrict restrict t) { }  /* { dg-warning "duplicate .restrict." } */

typedef const CT1 CCT1;
typedef const CT2 CCT2;
typedef CT1 const CT1C;
typedef CT2 const CT2C;
typedef const int const CIC;    /* { dg-warning "duplicate .const." } */
typedef volatile VT1 VVT1;
typedef volatile VT2 VVT2;
typedef VT1 volatile VT1V;
typedef VT2 volatile VT2V;
typedef volatile int volatile VIV; /* { dg-warning "duplicate .volatile." } */
typedef RT1 restrict RT1R;
typedef RT2 restrict RT2R;
typedef restrict RT1 RRT1;
typedef int *restrict restrict IRR; /* { dg-warning "duplicate .restrict." } */