]> xenbits.xensource.com Git - xen.git/commitdiff
tools/libxl: compile with -Wmissing-declarations
authorIan Jackson <Ian.Jackson@eu.citrix.com>
Tue, 17 Aug 2010 16:20:53 +0000 (17:20 +0100)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Tue, 17 Aug 2010 16:20:53 +0000 (17:20 +0100)
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@citrix.com>
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
tools/libxl/Makefile
tools/libxl/libxl.c
tools/libxl/libxl_device.c
tools/libxl/libxl_internal.h
tools/libxl/libxl_paths.c
tools/libxl/libxlu_cfg_l.c
tools/libxl/libxlu_cfg_l.h
tools/libxl/libxlu_cfg_l.l
tools/libxl/xl_cmdimpl.c

index 67815f4ecd7faef3d40b45474d7b0c47687ac21b..9c237ab0264cb65f53ac4dc85cad4d2b8a21a6ed 100644 (file)
@@ -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)
 
index d96743bab9e779dd0d8c53ade2dbe3986ccfeba2..c95272d4327fe3fb3eead1553a7904969930f92f 100644 (file)
@@ -1346,7 +1346,7 @@ static char ** libxl_build_device_model_args(libxl_gc *gc,
     }
 }
 
-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];
index 58cff09fc9a1fbe9626192eeb42d18981c24c80f..7a8c4fcbc42e9a75223aa802ac31bd288485d686 100644 (file)
@@ -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;
index f1b53ff3a96c5d26718261117528b26c781611b3..2f81acce92085c8038925a01cef4682a79023540 100644 (file)
@@ -272,4 +272,6 @@ struct libxl__xen_console_reader {
     unsigned int index;
 };
 
+_hidden int libxl_error_set(libxl_ctx *ctx, int code);
+
 #endif
index ceb1d732656632c49bce9c355f5c451bfa5d1f9b..b9783d7c209790280a02c1eaf2e5472eb284aff2 100644 (file)
@@ -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)
index b37501bdac0c1411cc0fc9414efb184e72912c15..917a1567013dbb6562e42a0c40fb3976300992b3 100644 (file)
@@ -488,8 +488,15 @@ static yyconst flex_int32_t yy_rule_can_match_eol[16] =
     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);
 
-#line 493 "libxlu_cfg_l.c"
+
+#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 37 "libxlu_cfg_l.l"
 
 
-#line 741 "libxlu_cfg_l.c"
+#line 748 "libxlu_cfg_l.c"
 
     yylval = yylval_param;
 
@@ -840,7 +847,7 @@ do_action:  /* This label is used only to access EOF actions. */
 
 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 @@ YY_RULE_SETUP
 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 , yyscan_t yyscanner)
 
 #define YYTABLES_NAME "yytables"
 
-#line 75 "libxlu_cfg_l.l"
+#line 82 "libxlu_cfg_l.l"
index 5f78395eaecde52244a1225418e9ed6ab6bde3a5..26f6dd63d16cd3296cc2f4a45bc38f54f18a18f5 100644 (file)
@@ -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
index b3700281cb1d42d8bede94f0fb4791d4c7476f6f..ac6b0112c2f38214ecfaa17fa5cece9d82fb8d3a 100644 (file)
     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);
+
 %}
 
 %option warn
index 44f1a135b4a5055669254808679f28ddb5beaea3..323dd04803fbba46a92b20bbe0f0bbe1d41076f0 100644 (file)
@@ -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 sz) {
     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 *mem)
     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, char **argv)
     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_dominfo *info, int nb_domain)
     }
 }
 
-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 libxl_dominfo *info, int nb_domain)
     }
 }
 
-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 *domain_spec,
     }
 }
 
-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, const char *filename,
             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 tdomid,
     }
 }
 
-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;