File: type_redef.i

package info (click to toggle)
frama-c 20201209%2Btitanium-4.1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 55,200 kB
  • sloc: ml: 260,374; ansic: 51,885; sh: 3,578; makefile: 3,111; python: 1,029; perl: 897; lisp: 259; xml: 62; asm: 46
file content (68 lines) | stat: -rw-r--r-- 1,481 bytes parent folder | download
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
/* run.config
   STDOPT:
   STDOPT: #"-c11"
*/ // Note: redefinition of local typedefs is currently unsupported

typedef int myint;
typedef int myint; //valid in C11 only

typedef int list[2];
typedef int list[2]; //valid in C11 only

typedef struct { int a; } st;
typedef struct { int a; } st; //invalid

typedef st st1; //valid

typedef union { int a; } u;
typedef union { int a; } u; //invalid

typedef enum {A} e;
typedef enum {A} e; // invalid

typedef enum {B} e1;
typedef enum {B} e2; // invalid (B redefined)

typedef struct {int a;} st1; //invalid

typedef int I;
void f() {
  typedef int I; //valid (not same scope)
  { typedef int I; }//valid (not same scope)
}

typedef int vi;
typedef volatile int vi; //invalid

typedef int ci;
typedef const int ci; //invalid

typedef __attribute__((aligned(8))) int ai;
typedef int ai; //valid in C11 only

typedef int *ftest_t;
typedef double ftest_t; //invalid

// tests of valid composite type redefinitions
typedef struct _stt { int a; } stt;
typedef struct _stt stt; //valid in C11 only
typedef struct _stt2 stt; //invalid
typedef struct _stt stt2; //valid

void g() {
  typedef struct _stt { int a; } stt; //valid
}

void h() {
  typedef struct _stt stt; //valid
}

typedef int magic;
void i() {
  typedef void (*magic)(void); //valid
  { typedef struct {int obj;} magic; } //valid
  magic m = (magic) g; //valid (test scoping of local typedef)
}
magic m = 2; //valid (test scoping of local typedef)

void main(ftest_t i) { }