[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] tools/libxl: compile with -Wmissing-declarations



# HG changeset patch
# User Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
# Date 1282062053 -3600
# Node ID e5a9221bdd3fec99bc4b01afe56ef639cc9be60a
# Parent  c82f7f4ee9b7e73642b6f01dc4426f64e61f8585
tools/libxl: 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 can be worked
around by providing the declarations ourselves regardless.

Signed-off-by: Gianni Tedesco <gianni.tedesco@xxxxxxxxxx>
Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
---
 tools/libxl/Makefile         |    2 -
 tools/libxl/libxl.c          |    2 -
 tools/libxl/libxl_device.c   |    2 -
 tools/libxl/libxl_internal.h |    4 ++-
 tools/libxl/libxl_paths.c    |    1 
 tools/libxl/libxlu_cfg_l.c   |   53 ++++++++++++++++++++++++-------------------
 tools/libxl/libxlu_cfg_l.h   |    2 -
 tools/libxl/libxlu_cfg_l.l   |    7 +++++
 tools/libxl/xl_cmdimpl.c     |   46 ++++++++++++++++++-------------------
 9 files changed, 68 insertions(+), 51 deletions(-)

diff -r c82f7f4ee9b7 -r e5a9221bdd3f tools/libxl/Makefile
--- a/tools/libxl/Makefile      Tue Aug 17 15:23:36 2010 +0100
+++ b/tools/libxl/Makefile      Tue Aug 17 17:20:53 2010 +0100
@@ -11,7 +11,7 @@ XLUMAJOR = 1.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)
 
diff -r c82f7f4ee9b7 -r e5a9221bdd3f tools/libxl/libxl.c
--- a/tools/libxl/libxl.c       Tue Aug 17 15:23:36 2010 +0100
+++ b/tools/libxl/libxl.c       Tue Aug 17 17:20:53 2010 +0100
@@ -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];
diff -r c82f7f4ee9b7 -r e5a9221bdd3f tools/libxl/libxl_device.c
--- a/tools/libxl/libxl_device.c        Tue Aug 17 15:23:36 2010 +0100
+++ b/tools/libxl/libxl_device.c        Tue Aug 17 17:20:53 2010 +0100
@@ -262,7 +262,7 @@ out:
     return rc;
 }
 
-int wait_for_dev_destroy(libxl_ctx *ctx, struct timeval *tv)
+static int wait_for_dev_destroy(libxl_ctx *ctx, struct timeval *tv)
 {
     libxl_gc gc = LIBXL_INIT_GC(ctx);
     int nfds, rc;
diff -r c82f7f4ee9b7 -r e5a9221bdd3f tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h      Tue Aug 17 15:23:36 2010 +0100
+++ b/tools/libxl/libxl_internal.h      Tue Aug 17 17:20:53 2010 +0100
@@ -272,4 +272,6 @@ struct libxl__xen_console_reader {
     unsigned int index;
 };
 
-#endif
+_hidden int libxl_error_set(libxl_ctx *ctx, int code);
+
+#endif
diff -r c82f7f4ee9b7 -r e5a9221bdd3f tools/libxl/libxl_paths.c
--- a/tools/libxl/libxl_paths.c Tue Aug 17 15:23:36 2010 +0100
+++ b/tools/libxl/libxl_paths.c Tue Aug 17 17:20:53 2010 +0100
@@ -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)
diff -r c82f7f4ee9b7 -r e5a9221bdd3f tools/libxl/libxlu_cfg_l.c
--- a/tools/libxl/libxlu_cfg_l.c        Tue Aug 17 15:23:36 2010 +0100
+++ b/tools/libxl/libxlu_cfg_l.c        Tue Aug 17 17:20:53 2010 +0100
@@ -488,8 +488,15 @@ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1
     return (x);                   \
   }while(0)
 
-
-#line 493 "libxlu_cfg_l.c"
+/* Some versions of flex have a bug (Fedora bugzilla 612465) which causes
+ * it to fail to declare these functions, which it defines.  So declare
+ * them ourselves.  Hopefully we won't have to simultaneously support
+ * a flex version which declares these differently somehow. */
+int xlu__cfg_yyget_column(yyscan_t yyscanner);
+void xlu__cfg_yyset_column(int  column_no, yyscan_t yyscanner);
+
+
+#line 500 "libxlu_cfg_l.c"
 
 #define INITIAL 0
 #define lexerr 1
@@ -734,10 +741,10 @@ YY_DECL
        register int yy_act;
     struct yyguts_t * yyg = (struct yyguts_t*)yyscanner;
 
-#line 30 "libxlu_cfg_l.l"
-
-
-#line 741 "libxlu_cfg_l.c"
+#line 37 "libxlu_cfg_l.l"
+
+
+#line 748 "libxlu_cfg_l.c"
 
     yylval = yylval_param;
 
@@ -840,7 +847,7 @@ do_action:  /* This label is used only to
 
 case 1:
 YY_RULE_SETUP
-#line 32 "libxlu_cfg_l.l"
+#line 39 "libxlu_cfg_l.l"
 {
                           yylval->string= xlu__cfgl_strdup(ctx,yytext);
                           GOT(IDENT);
@@ -848,7 +855,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 2:
 YY_RULE_SETUP
-#line 36 "libxlu_cfg_l.l"
+#line 43 "libxlu_cfg_l.l"
 {
                           yylval->string= xlu__cfgl_strdup(ctx,yytext);
                           GOT(NUMBER);
@@ -856,43 +863,43 @@ YY_RULE_SETUP
        YY_BREAK
 case 3:
 YY_RULE_SETUP
-#line 41 "libxlu_cfg_l.l"
+#line 48 "libxlu_cfg_l.l"
 
        YY_BREAK
 case 4:
 YY_RULE_SETUP
-#line 43 "libxlu_cfg_l.l"
+#line 50 "libxlu_cfg_l.l"
 { GOT(','); }
        YY_BREAK
 case 5:
 YY_RULE_SETUP
-#line 44 "libxlu_cfg_l.l"
+#line 51 "libxlu_cfg_l.l"
 { GOT('['); }
        YY_BREAK
 case 6:
 YY_RULE_SETUP
-#line 45 "libxlu_cfg_l.l"
+#line 52 "libxlu_cfg_l.l"
 { GOT(']'); }
        YY_BREAK
 case 7:
 YY_RULE_SETUP
-#line 46 "libxlu_cfg_l.l"
+#line 53 "libxlu_cfg_l.l"
 { GOT('='); }
        YY_BREAK
 case 8:
 YY_RULE_SETUP
-#line 47 "libxlu_cfg_l.l"
+#line 54 "libxlu_cfg_l.l"
 { GOT(';'); }
        YY_BREAK
 case 9:
 /* rule 9 can match eol */
 YY_RULE_SETUP
-#line 49 "libxlu_cfg_l.l"
+#line 56 "libxlu_cfg_l.l"
 { yylloc->first_line= yylineno-1; return NEWLINE; }
        YY_BREAK
 case 10:
 YY_RULE_SETUP
-#line 51 "libxlu_cfg_l.l"
+#line 58 "libxlu_cfg_l.l"
 {
                           yylval->string= xlu__cfgl_dequote(ctx,yytext);
                           GOT(STRING);
@@ -900,7 +907,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 11:
 YY_RULE_SETUP
-#line 55 "libxlu_cfg_l.l"
+#line 62 "libxlu_cfg_l.l"
 {
                           yylval->string= xlu__cfgl_dequote(ctx,yytext);
                           GOT(STRING);
@@ -908,7 +915,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 12:
 YY_RULE_SETUP
-#line 60 "libxlu_cfg_l.l"
+#line 67 "libxlu_cfg_l.l"
 {
                           BEGIN(lexerr);
                           yymore();
@@ -916,7 +923,7 @@ YY_RULE_SETUP
        YY_BREAK
 case 13:
 YY_RULE_SETUP
-#line 65 "libxlu_cfg_l.l"
+#line 72 "libxlu_cfg_l.l"
 {
                           xlu__cfgl_lexicalerror(ctx,"lexical error");
                           BEGIN(0);
@@ -925,7 +932,7 @@ case 14:
 case 14:
 /* rule 14 can match eol */
 YY_RULE_SETUP
-#line 70 "libxlu_cfg_l.l"
+#line 77 "libxlu_cfg_l.l"
 {
                           xlu__cfgl_lexicalerror(ctx,"lexical error");
                           BEGIN(0);
@@ -934,10 +941,10 @@ YY_RULE_SETUP
        YY_BREAK
 case 15:
 YY_RULE_SETUP
-#line 75 "libxlu_cfg_l.l"
+#line 82 "libxlu_cfg_l.l"
 YY_FATAL_ERROR( "flex scanner jammed" );
        YY_BREAK
-#line 941 "libxlu_cfg_l.c"
+#line 948 "libxlu_cfg_l.c"
 case YY_STATE_EOF(INITIAL):
 case YY_STATE_EOF(lexerr):
        yyterminate();
@@ -2087,4 +2094,4 @@ void xlu__cfg_yyfree (void * ptr , yysca
 
 #define YYTABLES_NAME "yytables"
 
-#line 75 "libxlu_cfg_l.l"
+#line 82 "libxlu_cfg_l.l"
diff -r c82f7f4ee9b7 -r e5a9221bdd3f tools/libxl/libxlu_cfg_l.h
--- a/tools/libxl/libxlu_cfg_l.h        Tue Aug 17 15:23:36 2010 +0100
+++ b/tools/libxl/libxlu_cfg_l.h        Tue Aug 17 17:20:53 2010 +0100
@@ -350,7 +350,7 @@ extern int xlu__cfg_yylex \
 #undef YY_DECL
 #endif
 
-#line 75 "libxlu_cfg_l.l"
+#line 82 "libxlu_cfg_l.l"
 
 #line 356 "libxlu_cfg_l.h"
 #undef xlu__cfg_yyIN_HEADER
diff -r c82f7f4ee9b7 -r e5a9221bdd3f tools/libxl/libxlu_cfg_l.l
--- a/tools/libxl/libxlu_cfg_l.l        Tue Aug 17 15:23:36 2010 +0100
+++ b/tools/libxl/libxlu_cfg_l.l        Tue Aug 17 17:20:53 2010 +0100
@@ -10,6 +10,13 @@
     yylloc->first_line= yylineno; \
     return (x);                   \
   }while(0)
+
+/* Some versions of flex have a bug (Fedora bugzilla 612465) which causes
+ * it to fail to declare these functions, which it defines.  So declare
+ * them ourselves.  Hopefully we won't have to simultaneously support
+ * a flex version which declares these differently somehow. */
+int xlu__cfg_yyget_column(yyscan_t yyscanner);
+void xlu__cfg_yyset_column(int  column_no, yyscan_t yyscanner);
 
 %}
 
diff -r c82f7f4ee9b7 -r e5a9221bdd3f tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c  Tue Aug 17 15:23:36 2010 +0100
+++ b/tools/libxl/xl_cmdimpl.c  Tue Aug 17 17:20:53 2010 +0100
@@ -214,7 +214,7 @@ static void find_domain(const char *p)
 
 #define LOG(_f, _a...)   dolog(__FILE__, __LINE__, __func__, _f "\n", ##_a)
 
-void dolog(const char *file, int line, const char *func, char *fmt, ...)
+static void dolog(const char *file, int line, const char *func, char *fmt, ...)
 {
     va_list ap;
     char *s;
@@ -1037,7 +1037,7 @@ static void *xrealloc(void *ptr, size_t 
     return r;
 }
 
-int autoconnect_console(int hvm)
+static int autoconnect_console(int hvm)
 {
     int status, options;
     pid_t pid, r;
@@ -1661,7 +1661,7 @@ static int64_t parse_mem_size_kb(char *m
     return kbytes;
 }
 
-int set_memory_max(char *p, char *mem)
+static int set_memory_max(char *p, char *mem)
 {
     int64_t memorykb;
     int rc;
@@ -1712,7 +1712,7 @@ int main_memmax(int argc, char **argv)
     return 0;
 }
 
-void set_memory_target(char *p, char *mem)
+static void set_memory_target(char *p, char *mem)
 {
     long long int memorykb;
 
@@ -1754,7 +1754,7 @@ int main_memset(int argc, char **argv)
     return 0;
 }
 
-void cd_insert(char *dom, char *virtdev, char *phys)
+static void cd_insert(char *dom, char *virtdev, char *phys)
 {
     libxl_device_disk disk;
     char *p;
@@ -1936,7 +1936,7 @@ int main_vncviewer(int argc, char **argv
     return 0;
 }
 
-void pcilist_assignable(void)
+static void pcilist_assignable(void)
 {
     libxl_device_pci *pcidevs;
     int num, i;
@@ -1969,7 +1969,7 @@ int main_pcilist_assignable(int argc, ch
     return 0;
 }
 
-void pcilist(char *dom)
+static void pcilist(char *dom)
 {
     libxl_device_pci *pcidevs;
     int num, i;
@@ -2011,7 +2011,7 @@ int main_pcilist(int argc, char **argv)
     return 0;
 }
 
-void pcidetach(char *dom, char *bdf)
+static void pcidetach(char *dom, char *bdf)
 {
     libxl_device_pci pcidev;
 
@@ -2051,7 +2051,7 @@ int main_pcidetach(int argc, char **argv
     pcidetach(domname, bdf);
     return 0;
 }
-void pciattach(char *dom, char *bdf, char *vs)
+static void pciattach(char *dom, char *bdf, char *vs)
 {
     libxl_device_pci pcidev;
 
@@ -2095,19 +2095,19 @@ int main_pciattach(int argc, char **argv
     return 0;
 }
 
-void pause_domain(char *p)
+static void pause_domain(char *p)
 {
     find_domain(p);
     libxl_domain_pause(&ctx, domid);
 }
 
-void unpause_domain(char *p)
+static void unpause_domain(char *p)
 {
     find_domain(p);
     libxl_domain_unpause(&ctx, domid);
 }
 
-void destroy_domain(char *p)
+static void destroy_domain(char *p)
 {
     int rc;
     find_domain(p);
@@ -2119,7 +2119,7 @@ void destroy_domain(char *p)
     if (rc) { fprintf(stderr,"destroy failed (rc=%d)\n.",rc); exit(-1); }
 }
 
-void shutdown_domain(char *p)
+static void shutdown_domain(char *p)
 {
     int rc;
     find_domain(p);
@@ -2127,7 +2127,7 @@ void shutdown_domain(char *p)
     if (rc) { fprintf(stderr,"shutdown failed (rc=%d)\n.",rc);exit(-1); }
 }
 
-void reboot_domain(char *p)
+static void reboot_domain(char *p)
 {
     int rc;
     find_domain(p);
@@ -2135,7 +2135,7 @@ void reboot_domain(char *p)
     if (rc) { fprintf(stderr,"reboot failed (rc=%d)\n.",rc);exit(-1); }
 }
 
-void list_domains_details(const libxl_dominfo *info, int nb_domain)
+static void list_domains_details(const libxl_dominfo *info, int nb_domain)
 {
     struct domain_config d_config;
 
@@ -2161,7 +2161,7 @@ void list_domains_details(const libxl_do
     }
 }
 
-void list_domains(int verbose, const libxl_dominfo *info, int nb_domain)
+static void list_domains(int verbose, const libxl_dominfo *info, int nb_domain)
 {
     int i;
 
@@ -2188,7 +2188,7 @@ void list_domains(int verbose, const lib
     }
 }
 
-void list_vm(void)
+static void list_vm(void)
 {
     libxl_vminfo *info;
     char *domname;
@@ -2236,7 +2236,7 @@ static void save_domain_core_begin(char 
     }
 }
 
-void save_domain_core_writeconfig(int fd, const char *filename,
+static void save_domain_core_writeconfig(int fd, const char *filename,
                                   const uint8_t *config_data, int config_len)
 {
     struct save_file_header hdr;
@@ -2275,7 +2275,7 @@ void save_domain_core_writeconfig(int fd
             hdr.optional_data_len);
 }
 
-int save_domain(char *p, char *filename, int checkpoint,
+static int save_domain(char *p, char *filename, int checkpoint,
                 const char *override_config_file)
 {
     int fd;
@@ -3157,7 +3157,7 @@ int main_create(int argc, char **argv)
     return 0;
 }
 
-void button_press(char *p, char *b)
+static void button_press(char *p, char *b)
 {
     libxl_button button;
 
@@ -3272,7 +3272,7 @@ static void print_vcpuinfo(uint32_t tdom
     }
 }
 
-void vcpulist(int argc, char **argv)
+static void vcpulist(int argc, char **argv)
 {
     libxl_dominfo *dominfo, *domlist;
     libxl_vcpuinfo *vcpuinfo, *list = NULL;
@@ -3340,7 +3340,7 @@ int main_vcpulist(int argc, char **argv)
     return 0;
 }
 
-void vcpupin(char *d, const char *vcpu, char *cpu)
+static void vcpupin(char *d, const char *vcpu, char *cpu)
 {
     libxl_vcpuinfo *vcpuinfo;
     libxl_physinfo physinfo;
@@ -3444,7 +3444,7 @@ int main_vcpupin(int argc, char **argv)
     return 0;
 }
 
-void vcpuset(char *d, char* nr_vcpus)
+static void vcpuset(char *d, char* nr_vcpus)
 {
     char *endptr;
     unsigned int max_vcpus;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.