File tree Expand file tree Collapse file tree 2 files changed +11
-4
lines changed
c/clang_return_stack_checks Expand file tree Collapse file tree 2 files changed +11
-4
lines changed Original file line number Diff line number Diff line change 1
- CC ?= clang
2
- CFLAGS ?= -Wall -Wextra
1
+ ifeq ($(origin CC ) ,default)
2
+ CC = scan-build clang
3
+ endif
4
+
5
+ ifeq ($(origin CFLAGS ) ,default)
6
+ CFLAGS = -Wall -Wextra
7
+ endif
3
8
4
9
all : return_stack_escape
5
10
Original file line number Diff line number Diff line change 4
4
struct guard
5
5
{
6
6
int8_t guard_set ;
7
+ struct guard * previous ;
7
8
};
8
9
9
10
extern struct guard * guard_ptr ;
@@ -12,8 +13,8 @@ static void
12
13
set_guard (struct guard * const g )
13
14
{
14
15
assert (!g -> guard_set );
15
- assert (!guard_ptr );
16
16
g -> guard_set = 1 ;
17
+ g -> previous = guard_ptr ;
17
18
guard_ptr = g ;
18
19
}
19
20
@@ -23,5 +24,6 @@ clear_guard(struct guard * const g)
23
24
assert (g -> guard_set );
24
25
assert (guard_ptr );
25
26
g -> guard_set = 0 ;
26
- guard_ptr = 0 ;
27
+ assert (guard_ptr == g );
28
+ guard_ptr = guard_ptr -> previous ;
27
29
}
You can’t perform that action at this time.
0 commit comments