aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/validation
diff options
authorJosh Triplett <josh@freedesktop.org>2007-02-28 11:58:18 -0800
committerJosh Triplett <josh@freedesktop.org>2007-02-28 11:58:18 -0800
commita4abe00d7a45a02a3135b24d5f04747397445f7a (patch)
treeedc5bdf46dceb54c4f76e935c58f3ce78e713282 /validation
parentfb057c38c687c16a31b7c56e7c4e404e18e4d92d (diff)
downloadsparse-dev-a4abe00d7a45a02a3135b24d5f04747397445f7a.tar.gz
Add static to declarations in test cases, to remove unrelated warnings.
Signed-off-by: Josh Triplett <josh@freedesktop.org>
Diffstat (limited to 'validation')
-rw-r--r--validation/builtin_safe1.c2
-rw-r--r--validation/choose_expr.c8
-rw-r--r--validation/cond_expr.c4
-rw-r--r--validation/context.c76
-rw-r--r--validation/field-overlap.c4
-rw-r--r--validation/foul-bitwise.c8
-rw-r--r--validation/init-char-array.c10
-rw-r--r--validation/initializer-entry-defined-twice.c6
-rw-r--r--validation/noderef.c2
-rw-r--r--validation/struct-as.c2
-rw-r--r--validation/struct-ns1.c2
-rw-r--r--validation/struct-ns2.c4
-rw-r--r--validation/struct-size1.c2
-rw-r--r--validation/type1.c2
-rw-r--r--validation/typeconvert.c2
-rw-r--r--validation/varargs1.c2
16 files changed, 68 insertions, 68 deletions
diff --git a/validation/builtin_safe1.c b/validation/builtin_safe1.c
index 322ebc39..d95e46b0 100644
--- a/validation/builtin_safe1.c
+++ b/validation/builtin_safe1.c
@@ -7,7 +7,7 @@ int g(int);
int h(int) __attribute__((pure));
int i(int) __attribute__((const));
-int foo(int x, int y)
+static int foo(int x, int y)
{
/* unsafe: */
MY_MACRO(x++);
diff --git a/validation/choose_expr.c b/validation/choose_expr.c
index 9a06cc43..55bfa0cc 100644
--- a/validation/choose_expr.c
+++ b/validation/choose_expr.c
@@ -1,4 +1,4 @@
-int x = __builtin_choose_expr(0,(char *)0,(void)0);
-int y = __builtin_choose_expr(1,(char *)0,(void)0);
-char s[42];
-int z = 1/(sizeof(__builtin_choose_expr(1,s,0)) - 42);
+static int x = __builtin_choose_expr(0,(char *)0,(void)0);
+static int y = __builtin_choose_expr(1,(char *)0,(void)0);
+static char s[42];
+static int z = 1/(sizeof(__builtin_choose_expr(1,s,0)) - 42);
diff --git a/validation/cond_expr.c b/validation/cond_expr.c
index afd35952..d5d9e6ff 100644
--- a/validation/cond_expr.c
+++ b/validation/cond_expr.c
@@ -3,8 +3,8 @@
* (real_v == 0 ? real_v == 0 : x), which gives the wrong type (and no
* warning from the testcase below).
*/
-int x;
-double y;
+static int x;
+static double y;
int a(void)
{
return ~(y ? : x); /* should warn */
diff --git a/validation/context.c b/validation/context.c
index c3527dae..f877ec21 100644
--- a/validation/context.c
+++ b/validation/context.c
@@ -1,11 +1,11 @@
#define __cond_lock(c) ((c) ? ({ __context__(1); 1; }) : 0)
-void a(void) __attribute__((context(0,1)))
+static void a(void) __attribute__((context(0,1)))
{
__context__(1);
}
-void r(void) __attribute__((context(1,0)))
+static void r(void) __attribute__((context(1,0)))
{
__context__(-1);
}
@@ -13,13 +13,13 @@ void r(void) __attribute__((context(1,0)))
extern void _ca(int fail);
#define ca(fail) __cond_lock(_ca(fail))
-void good_paired1(void)
+static void good_paired1(void)
{
a();
r();
}
-void good_paired2(void)
+static void good_paired2(void)
{
a();
r();
@@ -27,7 +27,7 @@ void good_paired2(void)
r();
}
-void good_paired3(void)
+static void good_paired3(void)
{
a();
a();
@@ -35,62 +35,62 @@ void good_paired3(void)
r();
}
-void good_lock1(void) __attribute__((context(0,1)))
+static void good_lock1(void) __attribute__((context(0,1)))
{
a();
}
-void good_lock2(void) __attribute__((context(0,1)))
+static void good_lock2(void) __attribute__((context(0,1)))
{
a();
r();
a();
}
-void good_lock3(void) __attribute__((context(0,1)))
+static void good_lock3(void) __attribute__((context(0,1)))
{
a();
a();
r();
}
-void good_unlock1(void) __attribute__((context(1,0)))
+static void good_unlock1(void) __attribute__((context(1,0)))
{
r();
}
-void good_unlock2(void) __attribute__((context(1,0)))
+static void good_unlock2(void) __attribute__((context(1,0)))
{
a();
r();
r();
}
-void warn_lock1(void)
+static void warn_lock1(void)
{
a();
}
-void warn_lock2(void)
+static void warn_lock2(void)
{
a();
r();
a();
}
-void warn_lock3(void)
+static void warn_lock3(void)
{
a();
a();
r();
}
-void warn_unlock1(void)
+static void warn_unlock1(void)
{
r();
}
-void warn_unlock2(void)
+static void warn_unlock2(void)
{
a();
r();
@@ -99,7 +99,7 @@ void warn_unlock2(void)
extern int condition, condition2;
-int good_if1(void)
+static int good_if1(void)
{
a();
if(condition) {
@@ -110,7 +110,7 @@ int good_if1(void)
return 0;
}
-void good_if2(void)
+static void good_if2(void)
{
if(condition) {
a();
@@ -118,7 +118,7 @@ void good_if2(void)
}
}
-void good_if3(void)
+static void good_if3(void)
{
a();
if(condition) {
@@ -128,7 +128,7 @@ void good_if3(void)
r();
}
-int warn_if1(void)
+static int warn_if1(void)
{
a();
if(condition)
@@ -137,7 +137,7 @@ int warn_if1(void)
return 0;
}
-int warn_if2(void)
+static int warn_if2(void)
{
a();
if(condition) {
@@ -147,7 +147,7 @@ int warn_if2(void)
return 0;
}
-void good_while1(void)
+static void good_while1(void)
{
a();
while(condition)
@@ -155,7 +155,7 @@ void good_while1(void)
r();
}
-void good_while2(void)
+static void good_while2(void)
{
while(condition) {
a();
@@ -163,7 +163,7 @@ void good_while2(void)
}
}
-void good_while3(void)
+static void good_while3(void)
{
while(condition) {
a();
@@ -175,7 +175,7 @@ void good_while3(void)
}
}
-void good_while4(void)
+static void good_while4(void)
{
a();
while(1) {
@@ -186,7 +186,7 @@ void good_while4(void)
}
}
-void good_while5(void)
+static void good_while5(void)
{
a();
while(1) {
@@ -197,21 +197,21 @@ void good_while5(void)
}
}
-void warn_while1(void)
+static void warn_while1(void)
{
while(condition) {
a();
}
}
-void warn_while2(void)
+static void warn_while2(void)
{
while(condition) {
r();
}
}
-void warn_while3(void)
+static void warn_while3(void)
{
while(condition) {
a();
@@ -221,7 +221,7 @@ void warn_while3(void)
}
}
-void good_goto1(void)
+static void good_goto1(void)
{
a();
goto label;
@@ -229,7 +229,7 @@ label:
r();
}
-void good_goto2(void)
+static void good_goto2(void)
{
a();
goto label;
@@ -239,7 +239,7 @@ label:
r();
}
-void good_goto3(void)
+static void good_goto3(void)
{
a();
if(condition)
@@ -250,7 +250,7 @@ label:
r();
}
-void good_goto4(void)
+static void good_goto4(void)
{
if(condition)
goto label;
@@ -260,7 +260,7 @@ label:
;
}
-void good_goto5(void)
+static void good_goto5(void)
{
a();
if(condition)
@@ -271,7 +271,7 @@ label:
r();
}
-void warn_goto1(void)
+static void warn_goto1(void)
{
a();
goto label;
@@ -280,7 +280,7 @@ label:
;
}
-void warn_goto2(void)
+static void warn_goto2(void)
{
a();
goto label;
@@ -290,7 +290,7 @@ label:
r();
}
-void warn_goto3(void)
+static void warn_goto3(void)
{
a();
if(condition)
@@ -300,7 +300,7 @@ label:
r();
}
-void good_cond_lock1(void)
+static void good_cond_lock1(void)
{
if(ca(condition)) {
condition2 = 1; /* do stuff */
@@ -308,7 +308,7 @@ void good_cond_lock1(void)
}
}
-void warn_cond_lock1(void)
+static void warn_cond_lock1(void)
{
if(ca(condition))
condition2 = 1; /* do stuff */
diff --git a/validation/field-overlap.c b/validation/field-overlap.c
index 8586c7ff..15b974aa 100644
--- a/validation/field-overlap.c
+++ b/validation/field-overlap.c
@@ -1,4 +1,4 @@
-struct {
+static struct {
int x;
struct {
int z;
@@ -6,7 +6,7 @@ struct {
} y;
} a = { .y.z = 1, .y.w = 2, };
-struct {int x, y, z;} w[2] = {
+static struct {int x, y, z;} w[2] = {
{.x = 1, .y = 2, .z = 3},
{.x = 1, .y = 2, .z = 3}
};
diff --git a/validation/foul-bitwise.c b/validation/foul-bitwise.c
index 576790d0..ca84be60 100644
--- a/validation/foul-bitwise.c
+++ b/validation/foul-bitwise.c
@@ -1,20 +1,20 @@
typedef unsigned short __attribute__((bitwise))__le16;
-__le16 foo(__le16 a)
+static __le16 foo(__le16 a)
{
return a |= ~a;
}
-int baz(__le16 a)
+static int baz(__le16 a)
{
return ~a == ~a;
}
-int barf(__le16 a)
+static int barf(__le16 a)
{
return a == (a & ~a);
}
-__le16 bar(__le16 a)
+static __le16 bar(__le16 a)
{
return -a;
}
diff --git a/validation/init-char-array.c b/validation/init-char-array.c
index cd19fdf7..556d5150 100644
--- a/validation/init-char-array.c
+++ b/validation/init-char-array.c
@@ -1,11 +1,11 @@
/*
* for array of char {<string>} gets special treatment in initializer.
*/
-char *s[] = {"aaaaaaaaa"};
-char t[][10] = {"aaaaaaaaa"};
-char u[] = {"aaaaaaaaa"};
-char v[] = "aaaaaaaaa";
-void f(void)
+static char *s[] = {"aaaaaaaaa"};
+static char t[][10] = {"aaaaaaaaa"};
+static char u[] = {"aaaaaaaaa"};
+static char v[] = "aaaaaaaaa";
+static void f(void)
{
char x[1/(sizeof(s) == sizeof(char *))];
char y[1/(sizeof(u) == 10)];
diff --git a/validation/initializer-entry-defined-twice.c b/validation/initializer-entry-defined-twice.c
index 58f314b3..6c48c52b 100644
--- a/validation/initializer-entry-defined-twice.c
+++ b/validation/initializer-entry-defined-twice.c
@@ -6,7 +6,7 @@ struct normal {
int field2;
};
-struct normal struct_error = {
+static struct normal struct_error = {
.field1 = 0,
.field1 = 0
};
@@ -21,7 +21,7 @@ struct has_union {
int z;
};
-struct has_union union_error = {
+static struct has_union union_error = {
.y = {
.a = 0,
.b = 0
@@ -37,7 +37,7 @@ struct same_offset {
int field2;
};
-struct same_offset not_an_error = {
+static struct same_offset not_an_error = {
.field1 = { },
.field2 = 0
};
diff --git a/validation/noderef.c b/validation/noderef.c
index d9a48225..15be3278 100644
--- a/validation/noderef.c
+++ b/validation/noderef.c
@@ -9,7 +9,7 @@ struct y {
int a[2];
};
-void h(void)
+static void h(void)
{
char __A *p;
char __A * * q1;
diff --git a/validation/struct-as.c b/validation/struct-as.c
index f5752f0c..86b90d32 100644
--- a/validation/struct-as.c
+++ b/validation/struct-as.c
@@ -10,7 +10,7 @@ struct hello {
extern int test(int __user *ip);
-int broken(struct hello __user *sp)
+static int broken(struct hello __user *sp)
{
test(&sp->a);
}
diff --git a/validation/struct-ns1.c b/validation/struct-ns1.c
index 56d222d1..44048e31 100644
--- a/validation/struct-ns1.c
+++ b/validation/struct-ns1.c
@@ -1,7 +1,7 @@
// This actually isn't allowed in C99, but sparse and gcc will take it:
enum Foo;
-void
+static void
f (void)
{
enum Foo *pefoo; // Pointer to incomplete type
diff --git a/validation/struct-ns2.c b/validation/struct-ns2.c
index 2c543c2a..b38af0ab 100644
--- a/validation/struct-ns2.c
+++ b/validation/struct-ns2.c
@@ -1,11 +1,11 @@
-void
+static void
g (struct Bar { int i; } *x)
{
struct Bar y;
y.i = 1;
}
-void
+static void
h (void)
{
// This is not in scope and should barf loudly.
diff --git a/validation/struct-size1.c b/validation/struct-size1.c
index b2d5755b..4748cd3c 100644
--- a/validation/struct-size1.c
+++ b/validation/struct-size1.c
@@ -7,7 +7,7 @@ struct E {
struct A **pA;
struct C *pC;
};
-void f(struct E *pE, struct B *pB)
+static void f(struct E *pE, struct B *pB)
{
pB->pA = pE->pA[0];
}
diff --git a/validation/type1.c b/validation/type1.c
index 6b19dc9b..ed49fcef 100644
--- a/validation/type1.c
+++ b/validation/type1.c
@@ -18,7 +18,7 @@ struct hello {
char array[10];
};
-int test(struct hello *arg)
+static int test(struct hello *arg)
{
return deref(arg->array);
}
diff --git a/validation/typeconvert.c b/validation/typeconvert.c
index 6e43c76a..2ed400fa 100644
--- a/validation/typeconvert.c
+++ b/validation/typeconvert.c
@@ -1,4 +1,4 @@
-int add_char(void)
+static int add_char(void)
{
return (char) 127 + (char) 127 + (char) 2;
}
diff --git a/validation/varargs1.c b/validation/varargs1.c
index 19b7579c..77dcb070 100644
--- a/validation/varargs1.c
+++ b/validation/varargs1.c
@@ -1,5 +1,5 @@
extern int foo (const char *, ...);
-void sparse_error(const char err[])
+static void sparse_error(const char err[])
{
foo("%s\n",err);
}