Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store the typedef identifier in the symbol_type (cleaned up) #358

Merged
merged 14 commits into from
Apr 4, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions regression/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ DIRS = ansi-c \
cbmc-java \
goto-analyzer \
goto-instrument \
goto-instrument-typedef \
test-script \
# Empty last line

Expand Down
12 changes: 11 additions & 1 deletion regression/ansi-c/gcc_types_compatible_p1/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ double d;
typedef enum T1 { hot, dog, poo, bear } dingos;
typedef enum T2 { janette, laura, amanda } cranberry;

typedef enum AnonEnum { jim, bob, fred } names;

typedef dingos altdingos;
typedef dingos diffdingos;

typedef names altnames;
typedef names diffnames;

typedef float same1;
typedef float same2;

Expand Down Expand Up @@ -52,6 +60,9 @@ STATIC_ASSERT(__builtin_types_compatible_p(typeof (dingos), unsigned)); // ha!
STATIC_ASSERT(__builtin_types_compatible_p(typeof (hot), typeof (laura)));
STATIC_ASSERT(__builtin_types_compatible_p(int[5], int[]));
STATIC_ASSERT(__builtin_types_compatible_p(same1, same2));
STATIC_ASSERT(__builtin_types_compatible_p(dingos, altdingos));
STATIC_ASSERT(__builtin_types_compatible_p(diffdingos, altdingos));
STATIC_ASSERT(__builtin_types_compatible_p(diffnames, altnames));
STATIC_ASSERT(__builtin_types_compatible_p(typeof (hot) *, int *));
STATIC_ASSERT(__builtin_types_compatible_p(typeof (hot), typeof (janette)));
STATIC_ASSERT(__builtin_types_compatible_p(__int128, signed __int128));
Expand Down Expand Up @@ -84,7 +95,6 @@ STATIC_ASSERT(!__builtin_types_compatible_p(__float128, long double));
STATIC_ASSERT(!__builtin_types_compatible_p(__float128, double));
STATIC_ASSERT(!__builtin_types_compatible_p(__int128, unsigned __int128));
#endif

#endif

int main(void)
Expand Down
27 changes: 27 additions & 0 deletions regression/ansi-c/gcc_types_compatible_p4/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#define STATIC_ASSERT(condition) \
int some_array[(condition) ? 1 : -1];

typedef struct struct_tag
{
int x;
float y;
} struct_typedef;

typedef struct struct_tag alt_typedef;
typedef struct_typedef another_typedef;

#ifdef __GNUC__


STATIC_ASSERT(__builtin_types_compatible_p(struct struct_tag, struct_typedef));
STATIC_ASSERT(__builtin_types_compatible_p(struct struct_tag, alt_typedef));
STATIC_ASSERT(__builtin_types_compatible_p(struct struct_tag, another_typedef));
STATIC_ASSERT(__builtin_types_compatible_p(struct_typedef, alt_typedef));
STATIC_ASSERT(__builtin_types_compatible_p(struct_typedef, another_typedef));
STATIC_ASSERT(__builtin_types_compatible_p(alt_typedef, another_typedef));

#endif

int main(void)
{
}
8 changes: 8 additions & 0 deletions regression/ansi-c/gcc_types_compatible_p4/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CORE
main.c

^EXIT=0$
^SIGNAL=0$
--
^warning: ignoring
^CONVERSION ERROR$
11 changes: 11 additions & 0 deletions regression/cbmc/typedef-anon-struct1/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

typedef struct
{
int x;
float y;
} MYSTRUCT;

void fun()
{
MYSTRUCT mystruct_var = {.x = 3, .y = 2.1f};
}
10 changes: 10 additions & 0 deletions regression/cbmc/typedef-anon-struct1/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
CORE
main.c
--show-symbol-table --function fun
// Enable multi-line checking
activate-multi-line-match
EXIT=0
SIGNAL=0
Base name\.+: mystruct_var\nMode\.+: C\nType\.+: MYSTRUCT
--
warning: ignoring
11 changes: 11 additions & 0 deletions regression/cbmc/typedef-anon-struct2/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

typedef struct
{
int x;
float y;
} MYSTRUCT;

void fun()
{
MYSTRUCT mystruct_var = {.x = 10, .y = 3.1f}, another_mystruct_var = {.x = 3, .y = 2.1f};
}
11 changes: 11 additions & 0 deletions regression/cbmc/typedef-anon-struct2/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
CORE
main.c
--show-symbol-table --function fun
// Enable multi-line checking
activate-multi-line-match
EXIT=0
SIGNAL=0
Base name\.+: mystruct_var\nMode\.+: C\nType\.+: MYSTRUCT
Base name\.+: another_mystruct_var\nMode\.+: C\nType\.+: MYSTRUCT
--
warning: ignoring
11 changes: 11 additions & 0 deletions regression/cbmc/typedef-anon-union1/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

typedef union
{
int x;
float y;
} MYUNION;

void fun()
{
MYUNION myunion_var = {.y = 2.1f};
}
10 changes: 10 additions & 0 deletions regression/cbmc/typedef-anon-union1/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
CORE
main.c
--show-symbol-table --function fun
// Enable multi-line checking
activate-multi-line-match
EXIT=0
SIGNAL=0
Base name\.+: myunion_var\nMode\.+: C\nType\.+: MYUNION
--
warning: ignoring
11 changes: 11 additions & 0 deletions regression/cbmc/typedef-anon-union2/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

typedef union
{
int x;
float y;
} MYUNION;

void fun()
{
MYUNION myunion_var = {.y = 2.1f}, another_myunion_var = {.y = 2.1f};
}
11 changes: 11 additions & 0 deletions regression/cbmc/typedef-anon-union2/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
CORE
main.c
--show-symbol-table --function fun
// Enable multi-line checking
activate-multi-line-match
EXIT=0
SIGNAL=0
Base name\.+: myunion_var\nMode\.+: C\nType\.+: MYUNION
Base name\.+: another_myunion_var\nMode\.+: C\nType\.+: MYUNION
--
warning: ignoring
12 changes: 12 additions & 0 deletions regression/cbmc/typedef-const-struct1/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

typedef struct tag_struct_name
{
int x;
float y;
} MYSTRUCT;

void fun()
{
const struct tag_struct_name tag_struct_var = {.x = 1, .y = 3.14f};
const MYSTRUCT mystruct_var = {.x = 3, .y = 2.1f};
}
11 changes: 11 additions & 0 deletions regression/cbmc/typedef-const-struct1/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
CORE
main.c
--show-symbol-table --function fun
// Enable multi-line checking
activate-multi-line-match
EXIT=0
SIGNAL=0
Base name\.+: tag_struct_var\nMode\.+: C\nType\.+: const struct tag_struct_name
Base name\.+: mystruct_var\nMode\.+: C\nType\.+: const MYSTRUCT
--
warning: ignoring
8 changes: 8 additions & 0 deletions regression/cbmc/typedef-const-type1/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

typedef int MYINT;

void fun()
{
const int int_var = 3;
const MYINT myint_var = 5;
}
11 changes: 11 additions & 0 deletions regression/cbmc/typedef-const-type1/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
CORE
main.c
--show-symbol-table --function fun
// Enable multi-line checking
activate-multi-line-match
EXIT=0
SIGNAL=0
Base name\.+: int_var\nMode\.+: C\nType\.+: const signed int
Base name\.+: myint_var\nMode\.+: C\nType\.+: const MYINT
--
warning: ignoring
12 changes: 12 additions & 0 deletions regression/cbmc/typedef-const-union1/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

typedef union tag_union_name
{
int x;
float y;
} MYUNION;

void fun()
{
const union tag_union_name tag_union_var = {1};
const MYUNION myunion_var = {.y = 2.1f};
}
11 changes: 11 additions & 0 deletions regression/cbmc/typedef-const-union1/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
CORE
main.c
--show-symbol-table --function fun
// Enable multi-line checking
activate-multi-line-match
EXIT=0
SIGNAL=0
Base name\.+: tag_union_var\nMode\.+: C\nType\.+: const union tag_union_name
Base name\.+: myunion_var\nMode\.+: C\nType\.+: const MYUNION
--
warning: ignoring
11 changes: 11 additions & 0 deletions regression/cbmc/typedef-param-anon-struct1/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

typedef struct
{
int x;
float y;
} MYSTRUCT;

void fun(MYSTRUCT mystruct_param)
{

}
10 changes: 10 additions & 0 deletions regression/cbmc/typedef-param-anon-struct1/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
CORE
main.c
--show-symbol-table --function fun
// Enable multi-line checking
activate-multi-line-match
EXIT=0
SIGNAL=0
Base name\.+: mystruct_param\nMode\.+: C\nType\.+: MYSTRUCT
--
warning: ignoring
10 changes: 10 additions & 0 deletions regression/cbmc/typedef-param-anon-union1/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

typedef union
{
int x;
float y;
} MYUNION;

void fun(MYUNION myunion_param)
{
}
10 changes: 10 additions & 0 deletions regression/cbmc/typedef-param-anon-union1/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
CORE
main.c
--show-symbol-table --function fun
// Enable multi-line checking
activate-multi-line-match
EXIT=0
SIGNAL=0
Base name\.+: myunion_param\nMode\.+: C\nType\.+: MYUNION
--
warning: ignoring
10 changes: 10 additions & 0 deletions regression/cbmc/typedef-param-struct1/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

typedef struct tag_struct_name
{
int x;
float y;
} MYSTRUCT;

void fun(struct tag_struct_name tag_struct_param, MYSTRUCT mystruct_param)
{
}
11 changes: 11 additions & 0 deletions regression/cbmc/typedef-param-struct1/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
CORE
main.c
--show-symbol-table --function fun
// Enable multi-line checking
activate-multi-line-match
EXIT=0
SIGNAL=0
Base name\.+: tag_struct_param\nMode\.+: C\nType\.+: struct tag_struct_name
Base name\.+: mystruct_param\nMode\.+: C\nType\.+: MYSTRUCT
--
warning: ignoring
7 changes: 7 additions & 0 deletions regression/cbmc/typedef-param-type1/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

typedef int MYINT;

void fun(int int_param, MYINT myint_param)
{

}
11 changes: 11 additions & 0 deletions regression/cbmc/typedef-param-type1/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
CORE
main.c
--show-symbol-table --function fun
// Enable multi-line checking
activate-multi-line-match
EXIT=0
SIGNAL=0
Base name\.+: int_param\nMode\.+: C\nType\.+: signed int
Base name\.+: myint_param\nMode\.+: C\nType\.+: MYINT
--
warning: ignoring
8 changes: 8 additions & 0 deletions regression/cbmc/typedef-param-type2/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

typedef int MYINT;
typedef int ALTINT;

void fun(int int_param, MYINT myint_param, ALTINT altint_param)
{

}
12 changes: 12 additions & 0 deletions regression/cbmc/typedef-param-type2/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
CORE
main.c
--show-symbol-table --function fun
// Enable multi-line checking
activate-multi-line-match
EXIT=0
SIGNAL=0
Base name\.+: int_param\nMode\.+: C\nType\.+: signed int
Base name\.+: myint_param\nMode\.+: C\nType\.+: MYINT
Base name\.+: altint_param\nMode\.+: C\nType\.+: ALTINT
--
warning: ignoring
7 changes: 7 additions & 0 deletions regression/cbmc/typedef-param-type3/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

typedef int MYINT;
typedef MYINT CHAINEDINT;

void fun(int int_param, MYINT myint_param, CHAINEDINT chainedint_param)
{
}
12 changes: 12 additions & 0 deletions regression/cbmc/typedef-param-type3/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
CORE
main.c
--show-symbol-table --function fun
// Enable multi-line checking
activate-multi-line-match
EXIT=0
SIGNAL=0
Base name\.+: int_param\nMode\.+: C\nType\.+: signed int
Base name\.+: myint_param\nMode\.+: C\nType\.+: MYINT
Base name\.+: chainedint_param\nMode\.+: C\nType\.+: CHAINEDINT
--
warning: ignoring
10 changes: 10 additions & 0 deletions regression/cbmc/typedef-param-union1/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

typedef union tag_union_name
{
int x;
float y;
} MYUNION;

void fun(union tag_union_name tag_union_param, MYUNION myunion_param)
{
}
11 changes: 11 additions & 0 deletions regression/cbmc/typedef-param-union1/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
CORE
main.c
--show-symbol-table --function fun
// Enable multi-line checking
activate-multi-line-match
EXIT=0
SIGNAL=0
Base name\.+: tag_union_param\nMode\.+: C\nType\.+: union tag_union_name
Base name\.+: myunion_param\nMode\.+: C\nType\.+: MYUNION
--
warning: ignoring
Loading