Skip to contentSkip to conversation

xl: compile with -Wmissing-declarations

PATCH In review Gianni Tedesco 2 participants 2 messages Aug 17, 2010

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xl: compile with -Wmissing-declarations

Since the recent build error caused by mismatch of symbol types due to missing declarations, build libxl with -Wmissing-declarations.

The patch is mostly straightforward, a one liner in the makefile enables the flag, a lot of functions in xl_cmdimpl.c needed to be made static and libxl_paths.c needed to include libxl.h.

The one wart on the patch-set is that flex has a bug where it emits code with missing declarations for yy(set|get)_column. This is apparently fixed in a newer version but for now I just removed the unused functions from the generated code.

tools/libxl/Makefile +1 -1
diff -r f353f1ac38f6 tools/libxl/Makefile
@@ -11,7 +11,7 @@ MINOR = 0
 XLUMAJOR = 1.0
 XLUMINOR = 0
 
-CFLAGS += -Werror -Wno-format-zero-length
+CFLAGS += -Werror -Wno-format-zero-length -Wmissing-declarations
 CFLAGS += -I. -fPIC
 CFLAGS += $(CFLAGS_libxenctrl) $(CFLAGS_libxenguest) $(CFLAGS_libxenstore) $(CFLAGS_libblktapctl)
 
tools/libxl/libxl.c +1 -1
diff -r f353f1ac38f6 tools/libxl/libxl.c
@@ -1346,7 +1346,7 @@ static char ** libxl_build_device_model_
     }
 }
 
-void dm_xenstore_record_pid(void *for_spawn, pid_t innerchild)
+static void dm_xenstore_record_pid(void *for_spawn, pid_t innerchild)
 {
     libxl_device_model_starting *starting = for_spawn;
     char *kvs[3];
tools/libxl/libxl_internal.h +2 -0
diff -r f353f1ac38f6 tools/libxl/libxl_internal.h
@@ -263,4 +263,6 @@ const char *libxl_blktap_devpath(libxl_g
 
 _hidden char *libxl_uuid2string(libxl_gc *gc, const libxl_uuid uuid);
 
+_hidden int libxl_error_set(libxl_ctx *ctx, int code);
+
 #endif
tools/libxl/libxl_paths.c +1 -0
diff -r f353f1ac38f6 tools/libxl/libxl_paths.c
@@ -12,6 +12,7 @@
  * GNU Lesser General Public License for more details.
  */
 
+#include "libxl.h"
 #include "_libxl_paths.h"
 
 const char *libxl_sbindir_path(void)
tools/libxl/libxlu_cfg_l.c +0 -28
diff -r f353f1ac38f6 tools/libxl/libxlu_cfg_l.c
@@ -1766,19 +1766,6 @@ int xlu__cfg_yyget_lineno  (yyscan_t yys
     return yylineno;
 }
 
-/** Get the current column number.
- * @param yyscanner The scanner object.
- */
-int xlu__cfg_yyget_column  (yyscan_t yyscanner)
-{
-    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-    
-        if (! YY_CURRENT_BUFFER)
-            return 0;
-    
-    return yycolumn;
-}
-
 /** Get the input stream.
  * @param yyscanner The scanner object.
  */
@@ -1841,21 +1828,6 @@ void xlu__cfg_yyset_lineno (int  line_nu
     yylineno = line_number;
 }
 
-/** Set the current column.
- * @param line_number
- * @param yyscanner The scanner object.
- */
-void xlu__cfg_yyset_column (int  column_no , yyscan_t yyscanner)
-{
-    struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
-
-        /* column is only valid if an input buffer exists. */
-        if (! YY_CURRENT_BUFFER )
-           yy_fatal_error( "xlu__cfg_yyset_column called with no buffer" , yyscanner); 
-    
-    yycolumn = column_no;
-}
-
 /** Set the input stream. This does not discard the current
  * input buffer.
  * @param in_str A readable stream.
tools/libxl/xl_cmdimpl.c +23 -23

182 lines not on this page · raw message

#1 lore raw

Gianni Tedesco writes ("[Xen-devel] [PATCH] xl: compile with -Wmissing-declarations"):

Quoted 4 lines

The one wart on the patch-set is that flex has a bug where it emits code with missing declarations for yy(set|get)_column. This is apparently fixed in a newer version but for now I just removed the unused functions from the generated code.

I think it would be better to just add the declarations for now. Otherwise rebuilding the grammar will cause the build to break.

The rest of it is fine.

Ian.