File: incompatible_qualifiers.c

package info (click to toggle)
frama-c 20220511-manganese-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 66,472 kB
  • sloc: ml: 278,832; ansic: 47,093; sh: 4,823; makefile: 3,618; javascript: 2,436; python: 1,919; perl: 897; lisp: 293; xml: 62
file content (100 lines) | stat: -rw-r--r-- 2,094 bytes parent folder | download | duplicates (2)
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
/* run.config
 EXIT: 1
   STDOPT:
 EXIT: 0
   STDOPT: #"-cpp-extra-args='-DNOERROR'"
 */
// Note: some of the declarations below are accepted by GCC 7.1.1 with -std=c11
// (but not -std=c99), mainly due to this warning (use -Wextra to see it):
// warning: type qualifiers ignored on function return type

int f(int a, char volatile *b);
#ifndef NOERROR
int f(int a, char *b); // conflicting types for 'f'
#endif

int g(int volatile a, char b);
int g(int a, char b); // allowed

void h(const char[]);
#ifndef NOERROR
void h(char[]); // conflicting types for 'h'
#endif

void i(int *f(int));
void i(int *const f(volatile int)); // allowed

void j(int *f(int[]));
#ifndef NOERROR
void j(int *f(int const[])); // conflicting types for 'j'
#endif

void k(int *const f(int));
const void k(int *f(volatile int)); // accepted by GCC 7.1.1 with -std=c11

typedef volatile int(*fp1)(char);
typedef int(*fp2)(const char);

fp1 *l(int *f(int));
#ifndef NOERROR
fp2 *l(const int *f(volatile int)); // conflicting types for 'l'
#endif

fp1 **const m(int *const f(int));
fp2 **m(int *f(volatile int)); // accepted by GCC 7.1.1 with -std=c11

fp1 *const *n(int *f(int, fp1 *[]));
#ifndef NOERROR
fp2 *const *n(int *f(volatile int, fp2 *const[])); // conflicting types for 'n'
#endif

void o(char r1, char r2);
#ifndef NOERROR
void o(restrict char r1, restrict char r2);
#endif

void p(const int a);
void p(int a);
void p(volatile int a);

typedef int* iptr;

void q(const iptr p);
void q(volatile iptr p); // allowed

void r(fp1 f, fp1 g);
#ifndef NOERROR
void r(restrict fp1 f, restrict fp2 g);
#endif

typedef int *restrict irptr;
void s(irptr p1, irptr p2);
#ifndef NOERROR
void s(restrict irptr p1, restrict irptr p2);
typedef int restrict* riptr;
int restrict rga[1];
int restrict *rgp;
int restrict rgi;
typedef int restrict (*fp3)(const char);
typedef int (*restrict fp4)(const char);
#endif
int *restrict *restrict iprpr;
int *restrict matrix[1];

int main() {
  f(0, 0);
  g(0, 0);
  h(0);
  i(0);
  j(0);
  k(0);
  l(0);
  m(0);
  n(0);
  o(0, 0);
  p(0);
  q(0);
  r(0, 0);
  s(0, 0);
  return 0;
}