aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxl
diff options
context:
space:
mode:
authorIan Jackson <Ian.Jackson@eu.citrix.com>2010-08-17 17:20:53 +0100
committerIan Jackson <Ian.Jackson@eu.citrix.com>2010-08-17 17:20:53 +0100
commit8188bc8a37e790fd2f051c2714c2a628d10c1c5e (patch)
tree18399ac2156175711a996e81ceebca4e16322533 /tools/libxl
parentd83eb7f21e37956c1674481b56f0c9181d493304 (diff)
downloadxen-8188bc8a37e790fd2f051c2714c2a628d10c1c5e.tar.gz
xen-8188bc8a37e790fd2f051c2714c2a628d10c1c5e.tar.bz2
xen-8188bc8a37e790fd2f051c2714c2a628d10c1c5e.zip
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@citrix.com> Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Diffstat (limited to 'tools/libxl')
-rw-r--r--tools/libxl/Makefile2
-rw-r--r--tools/libxl/libxl.c2
-rw-r--r--tools/libxl/libxl_device.c2
-rw-r--r--tools/libxl/libxl_internal.h2
-rw-r--r--tools/libxl/libxl_paths.c1
-rw-r--r--tools/libxl/libxlu_cfg_l.c47
-rw-r--r--tools/libxl/libxlu_cfg_l.h2
-rw-r--r--tools/libxl/libxlu_cfg_l.l7
-rw-r--r--tools/libxl/xl_cmdimpl.c46
9 files changed, 64 insertions, 47 deletions
diff --git a/tools/libxl/Makefile b/tools/libxl/Makefile
index 67815f4ecd..9c237ab026 100644
--- a/tools/libxl/Makefile
+++ b/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)
diff --git a/tools/libxl/libxl.c b/tools/libxl/libxl.c
index d96743bab9..c95272d432 100644
--- a/tools/libxl/libxl.c
+++ b/tools/libxl/libxl.c
@@ -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];
diff --git a/tools/libxl/libxl_device.c b/tools/libxl/libxl_device.c
index 58cff09fc9..7a8c4fcbc4 100644
--- a/tools/libxl/libxl_device.c
+++ b/tools/libxl/libxl_device.c
@@ -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 --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
index f1b53ff3a9..2f81acce92 100644
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -272,4 +272,6 @@ struct libxl__xen_console_reader {
unsigned int index;
};
+_hidden int libxl_error_set(libxl_ctx *ctx, int code);
+
#endif
diff --git a/tools/libxl/libxl_paths.c b/tools/libxl/libxl_paths.c
index ceb1d73265..b9783d7c20 100644
--- a/tools/libxl/libxl_paths.c
+++ b/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)
diff --git a/tools/libxl/libxlu_cfg_l.c b/tools/libxl/libxlu_cfg_l.c
index b37501bdac..917a156701 100644
--- a/tools/libxl/libxlu_cfg_l.c
+++ b/tools/libxl/libxlu_cfg_l.c
@@ -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"
diff --git a/tools/libxl/libxlu_cfg_l.h b/tools/libxl/libxlu_cfg_l.h
index 5f78395eae..26f6dd63d1 100644
--- a/tools/libxl/libxlu_cfg_l.h
+++ b/tools/libxl/libxlu_cfg_l.h
@@ -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 --git a/tools/libxl/libxlu_cfg_l.l b/tools/libxl/libxlu_cfg_l.l
index b3700281cb..ac6b0112c2 100644
--- a/tools/libxl/libxlu_cfg_l.l
+++ b/tools/libxl/libxlu_cfg_l.l
@@ -11,6 +11,13 @@
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
diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index 44f1a135b4..323dd04803 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -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;