File: attributes-declarations-definitions.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 (63 lines) | stat: -rw-r--r-- 1,479 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
/* run.config
   STDOPT:
   EXIT: 1
   STDOPT: #"-cpp-extra-args=-DUNSUPPORTED"
*/
//@ requires p1 >= 1;
int __attribute__((tret1)) f(int __attribute__((arg1)) p1) __attribute__((f1));

//@ requires p2 >= 1; // identical to previous contract
int __attribute__((tret2)) f(int __attribute__((arg2)) const volatile p2) __attribute__((f2));

//@ requires p3 >= 3;
int __attribute__((tret3)) f(int __attribute__((arg3)) const p3)
// note: GCC forbids declaring function attributes in function definitions,
// so we cannot add '__attribute__((f3))' here
{
  return p3;
}

//@ requires p4 >= 4;
int __attribute__((tret4)) f(int __attribute__((arg4)) volatile p4) __attribute__((f4));

int __attribute__((tret5)) f() __attribute__((f5));

typedef int __attribute__((a1)) aint;

aint g();

aint g(const aint i1);

volatile aint g(volatile aint i2);

aint g(int __attribute__((a2)) i3) {
  return i3;
}


typedef int __attribute__((p1))* __attribute__((p2)) iptr;

iptr volatile h(const iptr ip1);

iptr const h();

iptr h(volatile iptr ip2) {
  return 0;
}

iptr volatile h(const iptr ip3);

void test(void) {
  int a, __attribute__((unused)) b;
}

int __attribute__((o)) one_letter_attribute;

int __attribute__((_n)) one_letter_attribute_with_underscore;

int __attribute__((e_)) one_letter_attribute_with_underscore_after;

#ifdef UNSUPPORTED
// explicitly unsupported attributes must cause errors
typedef char V __attribute__((vector_size (64))); // vector_size is unsupported
#endif