Skip to content

Commit 7b571fb

Browse files
Manual cleanups.
- Remove `#include <stddef.h>` from files that no longer directly reference `size_t`. - Order of `#include`s, etc.
1 parent e4028e8 commit 7b571fb

40 files changed

+6
-55
lines changed

clang/test/3C/3d-allocation.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
#include <stdio.h>
99
#include <stdlib.h>
1010

11-
#include <stdlib.h>
12-
1311
int ***malloc3d(int y, int x, int z) {
1412
//CHECK_NOALL: int ***malloc3d(int y, int x, int z) : itype(_Ptr<int **>) {
1513
//CHECK_ALL: _Array_ptr<_Array_ptr<_Array_ptr<int>>> malloc3d(int y, int x, int z) : count(y) {

clang/test/3C/add_bounds.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ void biz(){
3535
//CHECK_ALL: _Array_ptr<int> b : count(10) = a;
3636
}
3737

38-
#include<stddef.h>
3938
#include <stdlib.h>
4039
_Array_ptr<int> faz(void) {
4140
//CHECK_ALL: _Array_ptr<int> faz(void) : count(100) {

clang/test/3C/alloc_type_param.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
// RUN: 3c -base-dir=%S -output-dir=%t.checked -alltypes %s --
66
// RUN: 3c -base-dir=%t.checked -alltypes %t.checked/alloc_type_param.c -- | diff %t.checked/alloc_type_param.c -
77

8-
#include <stddef.h>
98
#include <stdlib.h>
109

1110
/* Check basic behavior with the three alloc functions */

clang/test/3C/allocator.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
// RUN: 3c -base-dir=%t.checked %t.checked/allocator.c -- | diff %t.checked/allocator.c -
1010
// expected-no-diagnostics
1111
//
12-
#include <stddef.h>
1312
#include <stdlib.h>
1413

1514
void dosomething(void) {

clang/test/3C/arrboundsbasic.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
Basic array bounds tests (without any data-flow analysis).
77
*/
88

9-
#include <stddef.h>
10-
119
#include <stdlib.h>
1210

1311
struct bar {

clang/test/3C/arrboundsbasicinfer.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
Basic array bounds tests (without any data-flow analysis).
77
*/
88

9-
#include <stddef.h>
10-
119
#include <stdlib.h>
1210

1311
struct bar {

clang/test/3C/arrboundsbyte.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
Array bounds (byte_bound) tests with data-flow analysis.
77
*/
88

9-
#include <stddef.h>
109
#include <stdlib.h>
1110
// This test needs a custom version of memcpy where src and dest are `int *`.
1211
int *memcpy_int(int *restrict dest

clang/test/3C/arrboundsheuristics.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
int *glob;
1212
int lenplusone;
13-
#include <stddef.h>
1413
#include <stdlib.h>
1514
//CHECK_ALL: _Array_ptr<int> glob = ((void *)0);
1615
//CHECK_NOALL: int *glob;

clang/test/3C/arrboundsinfer2.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@
66
Basic array bounds tests (without any data-flow analysis).
77
*/
88

9-
#include <stddef.h>
10-
119
#include <stdlib.h>
10+
1211
extern void ext_func(_Array_ptr<int> arr : count(len), unsigned len);
1312

1413
struct bar {

clang/test/3C/arrctxsenbounds.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
/*
66
Context-sensitive array-bounds inference.
77
*/
8-
#include <stddef.h>
98
#include <stdlib.h>
109
struct foo {
1110
int *x;

clang/test/3C/arrtests_xfail.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,8 @@
88
Various array bounds tests.
99
*/
1010

11-
#include <stddef.h>
12-
#include <string.h>
1311
#include <stdlib.h>
12+
#include <string.h>
1413

1514
int *g; // array : count is 100; see the call to foo
1615
void foo(void) {

clang/test/3C/calloc.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
// RUN: 3c -base-dir=%S -output-dir=%t.checked -alltypes %s --
66
// RUN: 3c -base-dir=%t.checked -alltypes %t.checked/calloc.c -- | diff %t.checked/calloc.c -
77

8-
#include <stddef.h>
98
#include <stdlib.h>
109

1110
void func(int *x : itype(_Array_ptr<int>));

clang/test/3C/definedType.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
// RUN: 3c -base-dir=%S -alltypes -output-dir=%t.checked %s --
66
// RUN: 3c -base-dir=%t.checked -alltypes %t.checked/definedType.c -- | diff %t.checked/definedType.c -
77

8-
#include <stddef.h>
98
#include <stdlib.h>
109

1110
// From issue 204

clang/test/3C/dont_rewrite.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// RUN: 3c -base-dir=%S -addcr %s -- | FileCheck -match-full-lines -check-prefixes="CHECK" %s
33
// RUN: 3c -base-dir=%S -addcr %s -- | %clang -c -fcheckedc-extension -x c -o /dev/null -
44

5-
#include <stddef.h>
6-
75
#include <string.h>
86

97
// don't mess with this

clang/test/3C/free.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// RUN: 3c -base-dir=%S -addcr %s -- | FileCheck -match-full-lines -check-prefixes="CHECK_NOALL","CHECK" %s
33
// RUN: 3c -base-dir=%S -addcr %s -- | %clang -c -fcheckedc-extension -x c -o /dev/null -
44

5-
#include <stddef.h>
65
#include <stdlib.h>
76

87
int *test() {

clang/test/3C/graphs2.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#include <string.h>
1515

1616
#include <stddef.h>
17-
#include <stdlib.h>
1817

1918
/*Structure for storing a graph*/
2019

clang/test/3C/hash.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,6 @@
66
* Based on hash.c in Very Secure FTPd
77
*/
88

9-
//#include <stdlib_checked.h>
10-
//#include <string_checked.h>
11-
//#include <stdio_checked.h>
12-
13-
#include <stddef.h>
149
#include <stdlib.h>
1510
#include <string.h>
1611

clang/test/3C/inline_anon_structs.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
// RUN: 3c -base-dir=%S -output-dir=%t.checked %s --
66
// RUN: 3c -base-dir=%t.checked %t.checked/inline_anon_structs.c -- | diff %t.checked/inline_anon_structs.c -
77

8-
#include <stddef.h>
98
#include <stdlib.h>
109

1110
/*This code ensures conversion happens as expected when

clang/test/3C/invalidbounds.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ Regression test for the issue:
88
Here, array bounds should be invalidated when conflicting bounds are assigned.
99
*/
1010

11-
#include <stddef.h>
12-
1311
#include <stdlib.h>
1412
#include <string.h>
1513

clang/test/3C/liberal_itypes_ptr.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ void biz() {
4141
// CHECK: b = buz();
4242
}
4343

44-
#include <stddef.h>
4544
#include <stdlib.h>
4645

4746
void malloc_test() {

clang/test/3C/linkedlist.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#include <stdlib.h>
1111

1212
#include <stddef.h>
13-
#include <stdlib.h>
1413

1514
typedef struct node Node;
1615
typedef struct list List;

clang/test/3C/malloc_array.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
// RUN: 3c -base-dir=%S -output-dir=%t.checked -alltypes %s --
66
// RUN: 3c -base-dir=%t.checked -alltypes %t.checked/malloc_array.c -- | diff %t.checked/malloc_array.c -
77

8-
#include <stddef.h>
98
#include <stdlib.h>
109

1110
int *foo(int *x) {

clang/test/3C/malloc_implicit_cast.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
// RUN: 3c -base-dir=%S -alltypes %s -- | FileCheck -match-full-lines %s
1313

14-
#include <stddef.h>
1514
#include <stdlib.h>
1615

1716
#include <stdint.h>

clang/test/3C/mergebodies2.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@ int *fnPtrParamSafe(int (*fn)(int,int)) {
3737
int main(int argc, char** argv) {
3838
// CHECK: int main(int argc, _Ptr<_Ptr<char>> argv) _Checked {
3939
return 0;
40-
}
40+
}

clang/test/3C/pointerarithm.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,8 @@
44
// RUN: 3c -base-dir=%S -addcr -alltypes -output-dir=%t.checked %s --
55
// RUN: 3c -base-dir=%t.checked -addcr -alltypes %t.checked/pointerarithm.c -- | diff %t.checked/pointerarithm.c -
66

7-
#include <stddef.h>
8-
#include <stdlib.h>
97
#include <stdio.h>
8+
#include <stdlib.h>
109
#include <string.h>
1110

1211
int *sus(int *x, int *y) {

clang/test/3C/ptrptr.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@
55
// RUN: 3c -base-dir=%S -output-dir=%t.checked -alltypes %s --
66
// RUN: 3c -base-dir=%t.checked -alltypes %t.checked/ptrptr.c -- | diff %t.checked/ptrptr.c -
77

8-
#include <stddef.h>
9-
#include <stdlib.h>
108
#include <stdio.h>
9+
#include <stdlib.h>
1110
#include <string.h>
1211

1312
void f() {

clang/test/3C/realloc.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
// RUN: 3c -base-dir=%S -output-dir=%t.checked -alltypes %s --
66
// RUN: 3c -base-dir=%t.checked -alltypes %t.checked/realloc.c -- | diff %t.checked/realloc.c -
77

8-
#include <stddef.h>
98
#include <stdlib.h>
109

1110
void foo(int *w) {

clang/test/3C/realloc_complex.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
/* multiple complex realloc calls */
1111
/**********************************************************/
1212

13-
#include <stddef.h>
1413
#include <stdlib.h>
1514

1615
void foo(int *count) {

clang/test/3C/regression_tests_xfail.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
//
99
// XFAIL: *
1010

11-
#include <stddef.h>
12-
1311
#include <stdlib.h>
1412

1513
unsigned char *func(void) {

clang/test/3C/resolve_itypes.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ int *biz(void) : itype(_Ptr<int>) {
4545
void fuz(int *a : itype(_Ptr<int>)) {}
4646
//CHECK: void fuz(_Ptr<int> a) _Checked {}
4747

48-
#include<stddef.h>
4948
#include <stdlib.h>
5049
extern _Itype_for_any(T) void paper_foo(void * : itype(_Array_ptr<T>));
5150
void paper_bar(int *q : itype(_Ptr<int>), int n) {

clang/test/3C/return_not_least.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ int *foo(void) {
4040
return q;
4141
}
4242

43-
#include <stddef.h>
4443
#include <stdlib.h>
4544

4645
int *bar() {

clang/test/3C/root_cause.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
// This test is unusual in that it checks for the errors in the code
88

9-
#include <stddef.h>
109
#include <stdlib.h>
1110

1211
void *x; // expected-warning {{Default void* type}}

clang/test/3C/single_ptr_calloc.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
// RUN: 3c -base-dir=%S -output-dir=%t.checked -alltypes %s --
66
// RUN: 3c -base-dir=%t.checked -alltypes %t.checked/single_ptr_calloc.c -- | diff %t.checked/single_ptr_calloc.c -
77

8-
#include <stddef.h>
98
#include <stdlib.h>
109

1110
void foo(int *w) {

clang/test/3C/stmtExprA.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// RUN: 3c -base-dir=%S %s -- | FileCheck -match-full-lines -check-prefixes="CHECK_NOALL","CHECK" %s
33
// RUN: 3c -base-dir=%S %s -- | %clang -c -fcheckedc-extension -x c -o /dev/null -
44

5-
#include <stddef.h>
65
#include <stdlib.h>
76

87
void foo2(int *x) {

clang/test/3C/stmtExprBUG.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// RUN: 3c -base-dir=%S %s -- | %clang -c -fcheckedc-extension -x c -o /dev/null -
44
// XFAIL: *
55

6-
#include <stddef.h>
76
#include <stdlib.h>
87

98
/*right now, even though our solving correctly identifies q ought to be checked

clang/test/3C/tree.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// RUN: 3c -base-dir=%S %s -- | FileCheck -match-full-lines -check-prefixes="CHECK_NOALL","CHECK" %s
33
// RUN: 3c -base-dir=%S %s -- | %clang -c -fcheckedc-extension -x c -o /dev/null -
44

5-
#include <stddef.h>
65
#include <stdlib.h>
76
#include <string.h>
87

clang/test/3C/type_params.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ void unsafe(int *a) {
9191

9292
// Example issue 153
9393

94-
#include <stddef.h>
9594
#include <stdlib.h>
9695
#include <string.h>
9796

@@ -153,7 +152,6 @@ void deep(int ****v, int ****w, int ****x, int ****y, int ****z) {
153152
// Issue #233. Void type paramters were not being detected by
154153
// typeArgsProvidedCheck
155154

156-
157155
// void provided
158156
void *example0(void *ptr, unsigned int size) {
159157
// CHECK: void *example0(void *ptr, unsigned int size) {

clang/test/3C/type_params_xfail1.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
// independent at each call site.
88

99
// adapted from type_params.c
10-
#include <stddef.h>
1110
#include <stdlib.h>
1211

1312
_Itype_for_any(T) void incoming_doubleptr(_Array_ptr<T> ptr

clang/test/3C/unsafeunion.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
// RUN: 3c -base-dir=%S -output-dir=%t.checked -alltypes %s --
66
// RUN: 3c -base-dir=%t.checked -alltypes %t.checked/unsafeunion.c -- | diff %t.checked/unsafeunion.c -
77

8-
#include <stddef.h>
98
#include <stdlib.h>
109

1110
union foo {

clang/test/3C/user_malloc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
// RUN: 3c -base-dir=%S -use-malloc=my_malloc,your_malloc %s -- | %clang -c -fcheckedc-extension -x c -o /dev/null -
44

55
#include <stddef.h>
6+
#include <stdlib.h>
67
extern _Itype_for_any(T) void *my_malloc(size_t size)
78
: itype(_Array_ptr<T>) byte_count(size);
89
extern _Itype_for_any(T) void *your_malloc(size_t size)
910
: itype(_Array_ptr<T>) byte_count(size);
10-
#include <stdlib.h>
1111

1212
int *foo(void) {
1313
int *p = my_malloc(sizeof(int));

0 commit comments

Comments
 (0)