[syslinux] gcc4 warnings

Peter Jones pjones at redhat.com
Mon Mar 7 08:37:22 PST 2005


Below is a patch to get rid of several warnings which occur while
building syslinux 3.07 with the current gcc 4 snapshot.  This fixes all
the warnings except one unused variable.

Take them or leave them as you see fit.  They're all com32 stuff that's
pulled in from external sources.

--- syslinux-3.07/memdisk/unzip.c.gcc4	2004-12-07 23:29:22.000000000 -0500
+++ syslinux-3.07/memdisk/unzip.c	2005-03-07 11:26:46.000000000 -0500
@@ -70,8 +70,6 @@
 static void gzip_mark(void **);
 static void gzip_release(void **);
 
-extern ulg crc_32_tab[256];
-
 /* Get byte from input buffer */
 static inline uch get_byte(void)
 {
--- syslinux-3.07/com32/modules/readconfig.c.gcc4	2004-12-28 18:18:27.000000000 -0500
+++ syslinux-3.07/com32/modules/readconfig.c	2005-03-07 11:26:46.000000000 -0500
@@ -131,7 +131,7 @@
     me->hotkey = 0;
 
     if ( ld->menulabel ) {
-      unsigned char *p = strchr(ld->menulabel, '^');
+      unsigned char *p = (unsigned char *)strchr(ld->menulabel, '^');
       if ( p && p[1] ) {
 	int hotkey = p[1] & ~0x20;
 	if ( !menu_hotkeys[hotkey] ) {
--- syslinux-3.07/com32/libutil/get_key.c.gcc4	2005-01-04 02:15:20.000000000 -0500
+++ syslinux-3.07/com32/libutil/get_key.c	2005-03-07 11:26:46.000000000 -0500
@@ -49,7 +49,7 @@
 };
 
 #define MAXLEN 8
-#define CODE(x,y) { x, (sizeof y)-1, y }
+#define CODE(x,y) { x, (sizeof y)-1, (unsigned char *)y }
 
 static const struct keycode keycodes[] = {
   /* First, the BIOS combined codes */
--- syslinux-3.07/com32/lib/strncmp.c.gcc4	2004-11-10 17:31:50.000000000 -0500
+++ syslinux-3.07/com32/lib/strncmp.c	2005-03-07 11:26:46.000000000 -0500
@@ -6,7 +6,8 @@
 
 int strncmp(const char *s1, const char *s2, size_t n)
 {
-  const unsigned char *c1 = s1, *c2 = s2;
+  const unsigned char *c1 = (const unsigned char *)s1;
+  const unsigned char *c2 = (const unsigned char *)s2;
   unsigned char ch;
   int d = 0;
 
--- syslinux-3.07/com32/lib/libpng/pngwrite.c.gcc4	2005-01-08 00:58:20.000000000 -0500
+++ syslinux-3.07/com32/lib/libpng/pngwrite.c	2005-03-07 11:26:46.000000000 -0500
@@ -435,7 +435,7 @@
    png_malloc_ptr malloc_fn, png_free_ptr free_fn)
 {
 #endif /* PNG_USER_MEM_SUPPORTED */
-   png_structp png_ptr;
+   volatile png_structp png_ptr;
 #ifdef PNG_SETJMP_SUPPORTED
 #ifdef USE_FAR_KEYWORD
    jmp_buf jmpbuf;
--- syslinux-3.07/com32/lib/libpng/pngread.c.gcc4	2005-01-08 00:58:20.000000000 -0500
+++ syslinux-3.07/com32/lib/libpng/pngread.c	2005-03-07 11:26:46.000000000 -0500
@@ -33,7 +33,7 @@
 {
 #endif /* PNG_USER_MEM_SUPPORTED */
 
-   png_structp png_ptr;
+   volatile png_structp png_ptr;
 
 #ifdef PNG_SETJMP_SUPPORTED
 #ifdef USE_FAR_KEYWORD
--- syslinux-3.07/com32/lib/MCONFIG.gcc4	2005-03-07 11:28:15.000000000 -0500
+++ syslinux-3.07/com32/lib/MCONFIG	2005-03-07 11:28:59.000000000 -0500
@@ -18,7 +18,7 @@
 
 REQFLAGS  = -g -m32 -mregparm=3 -DREGPARM=3 -D__COM32__ -I. -I./sys -I../include
 OPTFLAGS  = -Os -march=i386 -falign-functions=0 -falign-jumps=0 \
-	    -falign-labels=0
+	    -falign-labels=0 -finline-limit=1000
 WARNFLAGS = -W -Wall -Wpointer-arith -Wwrite-strings -Wstrict-prototypes -Winline
 
 CFLAGS  = -Wp,-MT,$@,-MD,$(dir $@).$(notdir $@).d $(OPTFLAGS) \
--- syslinux-3.07/com32/lib/libgcc/__moddi3.c.gcc4	2004-11-17 02:19:58.000000000 -0500
+++ syslinux-3.07/com32/lib/libgcc/__moddi3.c	2005-03-07 11:26:46.000000000 -0500
@@ -21,7 +21,7 @@
     minus ^= 1;
   }
   
-  (void) __udivmoddi4(num, den, &v);
+  (void) __udivmoddi4(num, den, (uint64_t *)&v);
   if ( minus )
     v = -v;
 
--- syslinux-3.07/com32/lib/strcmp.c.gcc4	2004-11-10 17:31:50.000000000 -0500
+++ syslinux-3.07/com32/lib/strcmp.c	2005-03-07 11:26:46.000000000 -0500
@@ -6,7 +6,8 @@
 
 int strcmp(const char *s1, const char *s2)
 {
-  const unsigned char *c1 = s1, *c2 = s2;
+  const unsigned char *c1 = (const unsigned char *)s1;
+  const unsigned char *c2 = (const unsigned char *)s2;
   unsigned char ch;
   int d = 0;
 
--- syslinux-3.07/com32/lib/zlib/crc32.c.gcc4	2005-01-08 00:38:12.000000000 -0500
+++ syslinux-3.07/com32/lib/zlib/crc32.c	2005-03-07 11:26:46.000000000 -0500
@@ -94,7 +94,8 @@
 local void make_crc_table()
 {
     unsigned long c;
-    int n, k;
+    unsigned int n;
+    int k;
     unsigned long poly;            /* polynomial exclusive-or pattern */
     /* terms of polynomial defining this crc (except x^32): */
     static const unsigned char p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26};
--- syslinux-3.07/com32/lib/strncasecmp.c.gcc4	2004-11-10 17:31:50.000000000 -0500
+++ syslinux-3.07/com32/lib/strncasecmp.c	2005-03-07 11:26:46.000000000 -0500
@@ -7,7 +7,8 @@
 
 int strncasecmp(const char *s1, const char *s2, size_t n)
 {
-  const unsigned char *c1 = s1, *c2 = s2;
+  const unsigned char *c1 = (const unsigned char *)s1;
+  const unsigned char *c2 = (const unsigned char *)s2;
   unsigned char ch;
   int d = 0;
 
--- syslinux-3.07/com32/lib/strcasecmp.c.gcc4	2004-11-10 17:31:50.000000000 -0500
+++ syslinux-3.07/com32/lib/strcasecmp.c	2005-03-07 11:26:46.000000000 -0500
@@ -7,7 +7,8 @@
 
 int strcasecmp(const char *s1, const char *s2)
 {
-  const unsigned char *c1 = s1, *c2 = s2;
+  const unsigned char *c1 = (const unsigned char *)s1;
+  const unsigned char *c2 = (const unsigned char *)s2;
   unsigned char ch;
   int d = 0;
 

-- 
        Peter




More information about the Syslinux mailing list