Rob Shearman : widl: Fix symbol was not declared and using plain integer as NULL pointer sparse warnings .

Alexandre Julliard julliard at winehq.org
Fri Jan 22 08:26:50 CST 2010


Module: wine
Branch: master
Commit: 39b3a57b3dbdfe68582ae11321a5e1dc995c6907
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=39b3a57b3dbdfe68582ae11321a5e1dc995c6907

Author: Rob Shearman <robertshearman at gmail.com>
Date:   Thu Jan 21 11:56:53 2010 +0000

widl: Fix symbol was not declared and using plain integer as NULL pointer sparse warnings.

---

 tools/widl/parser.h  |    2 ++
 tools/widl/parser.l  |    2 --
 tools/widl/typegen.c |    8 ++++----
 tools/widl/widl.c    |   39 +++++++++++++++++++--------------------
 4 files changed, 25 insertions(+), 26 deletions(-)

diff --git a/tools/widl/parser.h b/tools/widl/parser.h
index 71f08dc..1bcc3c1 100644
--- a/tools/widl/parser.h
+++ b/tools/widl/parser.h
@@ -45,4 +45,6 @@ void pop_import(void);
 
 int is_type(const char *name);
 
+extern char *temp_name;
+
 #endif
diff --git a/tools/widl/parser.l b/tools/widl/parser.l
index a72c454..0d231fc 100644
--- a/tools/widl/parser.l
+++ b/tools/widl/parser.l
@@ -64,8 +64,6 @@ double	[0-9]+\.[0-9]+([eE][+-]?[0-9]+)*
 
 #include "parser.tab.h"
 
-extern char *temp_name;
-
 static void addcchar(char c);
 static char *get_buffered_cstring(void);
 
diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c
index 68e9da1..c35020c 100644
--- a/tools/widl/typegen.c
+++ b/tools/widl/typegen.c
@@ -69,7 +69,7 @@ static unsigned int write_string_tfs(FILE *file, const attr_list_t *attrs,
                                type_t *type, int toplevel_param,
                                const char *name, unsigned int *typestring_offset);
 
-const char *string_of_type(unsigned char type)
+static const char *string_of_type(unsigned char type)
 {
     switch (type)
     {
@@ -133,7 +133,7 @@ static void *get_aliaschain_attrp(const type_t *type, enum attr_type attr)
             return get_attrp(t->attrs, attr);
         else if (type_is_alias(t))
             t = type_alias_get_aliasee(t);
-        else return 0;
+        else return NULL;
     }
 }
 
@@ -391,7 +391,7 @@ unsigned char get_struct_fc(const type_t *type)
   return RPC_FC_STRUCT;
 }
 
-unsigned char get_array_fc(const type_t *type)
+static unsigned char get_array_fc(const type_t *type)
 {
     unsigned char fc;
     const expr_t *size_is;
@@ -641,7 +641,7 @@ static type_t *get_user_type(const type_t *t, const char **pname)
         if (type_is_alias(t))
             t = type_alias_get_aliasee(t);
         else
-            return 0;
+            return NULL;
     }
 }
 
diff --git a/tools/widl/widl.c b/tools/widl/widl.c
index a481c56..8c76c24 100644
--- a/tools/widl/widl.c
+++ b/tools/widl/widl.c
@@ -100,7 +100,7 @@ int parser_debug, yy_flex_debug;
 
 int pedantic = 0;
 int do_everything = 1;
-int preprocess_only = 0;
+static int preprocess_only = 0;
 int do_header = 0;
 int do_typelib = 0;
 int do_proxies = 0;
@@ -108,7 +108,7 @@ int do_client = 0;
 int do_server = 0;
 int do_idfile = 0;
 int do_dlldata = 0;
-int no_preprocess = 0;
+static int no_preprocess = 0;
 int old_names = 0;
 int do_win32 = 1;
 int do_win64 = 1;
@@ -127,16 +127,15 @@ char *client_name;
 char *client_token;
 char *server_name;
 char *server_token;
-char *idfile_name;
-char *idfile_token;
+static char *idfile_name;
+static char *idfile_token;
 char *temp_name;
 const char *prefix_client = "";
 const char *prefix_server = "";
 
 int line_number = 1;
 
-FILE *header;
-FILE *idfile;
+static FILE *idfile;
 
 size_t pointer_size = 0;
 syskind_t typelib_kind = sizeof(void*) == 8 ? SYS_WIN64 : SYS_WIN32;
@@ -160,18 +159,18 @@ enum {
 static const char short_options[] =
     "b:cC:d:D:EhH:I:m:NpP:sS:tT:uU:VW";
 static const struct option long_options[] = {
-    { "dlldata", 1, 0, DLLDATA_OPTION },
-    { "dlldata-only", 0, 0, DLLDATA_ONLY_OPTION },
-    { "local-stubs", 1, 0, LOCAL_STUBS_OPTION },
-    { "oldnames", 0, 0, OLDNAMES_OPTION },
-    { "prefix-all", 1, 0, PREFIX_ALL_OPTION },
-    { "prefix-client", 1, 0, PREFIX_CLIENT_OPTION },
-    { "prefix-server", 1, 0, PREFIX_SERVER_OPTION },
-    { "win32", 0, 0, WIN32_OPTION },
-    { "win64", 0, 0, WIN64_OPTION },
-    { "win32-align", 1, 0, WIN32_ALIGN_OPTION },
-    { "win64-align", 1, 0, WIN64_ALIGN_OPTION },
-    { 0, 0, 0, 0 }
+    { "dlldata", 1, NULL, DLLDATA_OPTION },
+    { "dlldata-only", 0, NULL, DLLDATA_ONLY_OPTION },
+    { "local-stubs", 1, NULL, LOCAL_STUBS_OPTION },
+    { "oldnames", 0, NULL, OLDNAMES_OPTION },
+    { "prefix-all", 1, NULL, PREFIX_ALL_OPTION },
+    { "prefix-client", 1, NULL, PREFIX_CLIENT_OPTION },
+    { "prefix-server", 1, NULL, PREFIX_SERVER_OPTION },
+    { "win32", 0, NULL, WIN32_OPTION },
+    { "win64", 0, NULL, WIN64_OPTION },
+    { "win32-align", 1, NULL, WIN32_ALIGN_OPTION },
+    { "win64-align", 1, NULL, WIN64_ALIGN_OPTION },
+    { NULL, 0, NULL, 0 }
 };
 
 static void rm_tempfile(void);
@@ -648,8 +647,8 @@ int main(int argc,char *argv[])
 
   if(debuglevel)
   {
-    setbuf(stdout,0);
-    setbuf(stderr,0);
+    setbuf(stdout, NULL);
+    setbuf(stderr, NULL);
   }
 
   parser_debug = debuglevel & DEBUGLEVEL_TRACE ? 1 : 0;




More information about the wine-cvs mailing list