WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [PATCH] xl: compile with -Wmissing-declarations

To: Xen Devel <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: [Xen-devel] [PATCH] xl: compile with -Wmissing-declarations
From: Gianni Tedesco <gianni.tedesco@xxxxxxxxxx>
Date: Tue, 17 Aug 2010 14:49:41 +0100
Cc: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>, Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Delivery-date: Tue, 17 Aug 2010 06:55:51 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
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.

Signed-off-by: Gianni Tedesco <gianni.tedesco@xxxxxxxxxx>

diff -r f353f1ac38f6 tools/libxl/Makefile
--- a/tools/libxl/Makefile      Tue Aug 17 12:45:44 2010 +0100
+++ b/tools/libxl/Makefile      Tue Aug 17 14:49:32 2010 +0100
@@ -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 -r f353f1ac38f6 tools/libxl/libxl.c
--- a/tools/libxl/libxl.c       Tue Aug 17 12:45:44 2010 +0100
+++ b/tools/libxl/libxl.c       Tue Aug 17 14:49:32 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 f353f1ac38f6 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h      Tue Aug 17 12:45:44 2010 +0100
+++ b/tools/libxl/libxl_internal.h      Tue Aug 17 14:49:32 2010 +0100
@@ -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
diff -r f353f1ac38f6 tools/libxl/libxl_paths.c
--- a/tools/libxl/libxl_paths.c Tue Aug 17 12:45:44 2010 +0100
+++ b/tools/libxl/libxl_paths.c Tue Aug 17 14:49:32 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 f353f1ac38f6 tools/libxl/libxlu_cfg_l.c
--- a/tools/libxl/libxlu_cfg_l.c        Tue Aug 17 12:45:44 2010 +0100
+++ b/tools/libxl/libxlu_cfg_l.c        Tue Aug 17 14:49:32 2010 +0100
@@ -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.
diff -r f353f1ac38f6 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c  Tue Aug 17 12:45:44 2010 +0100
+++ b/tools/libxl/xl_cmdimpl.c  Tue Aug 17 14:49:32 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-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>