Skip to contentSkip to conversation

gcc 3.5 fixes

PATCH In review Anton Blanchard 3 participants 7 messages Jul 4, 2004 – Jul 11, 2004

Subsystems (7)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 gcc 3.5 fixes

gcc 3.5 is warning about static vs non static function declarations. The following patch removes function prototypes in .h files where possible and changes prototypes to be static elsewhere.

Anton

drivers/net/pppoe.c renamed from root/toolchain/linux-2.5-bk/drivers/net/pppoe.c +1 -0
diff -ur /root/toolchain/linux-2.5-bk/drivers/net/pppoe.c linux-2.5-bk/drivers/net/pppoe.c
@@ -86,6 +86,7 @@
 static struct proto_ops pppoe_ops;
 static rwlock_t pppoe_hash_lock = RW_LOCK_UNLOCKED;
 
+static struct ppp_channel_ops pppoe_chan_ops;
 
 static inline int cmp_2_addr(struct pppoe_addr *a, struct pppoe_addr *b)
 {
drivers/serial/8250.c renamed from root/toolchain/linux-2.5-bk/drivers/serial/8250.c +1 -1
diff -ur /root/toolchain/linux-2.5-bk/drivers/serial/8250.c linux-2.5-bk/drivers/serial/8250.c
@@ -2013,7 +2013,7 @@
 	return uart_set_options(port, co, baud, parity, bits, flow);
 }
 
-extern struct uart_driver serial8250_reg;
+static struct uart_driver serial8250_reg;
 static struct console serial8250_console = {
 	.name		= "ttyS",
 	.write		= serial8250_console_write,
drivers/usb/input/hiddev.c renamed from root/toolchain/linux-2.5-bk/drivers/usb/input/hiddev.c +0 -3
diff -ur /root/toolchain/linux-2.5-bk/drivers/usb/input/hiddev.c linux-2.5-bk/drivers/usb/input/hiddev.c
@@ -66,9 +66,6 @@
 
 static struct hiddev *hiddev_table[HIDDEV_MINORS];
 
-/* forward reference to make our lives easier */
-extern struct usb_driver hiddev_driver;
-
 /*
  * Find a report, given the report's type and ID.  The ID can be specified
  * indirectly by REPORT_ID_FIRST (which returns the first report of the given
fs/cifs/cifsfs.c renamed from root/toolchain/linux-2.5-bk/fs/cifs/cifsfs.c +0 -2
diff -ur /root/toolchain/linux-2.5-bk/fs/cifs/cifsfs.c linux-2.5-bk/fs/cifs/cifsfs.c
@@ -48,8 +48,6 @@
 static struct quotactl_ops cifs_quotactl_ops;
 #endif
 
-extern struct file_system_type cifs_fs_type;
-
 int cifsFYI = 0;
 int cifsERROR = 1;
 int traceSMB = 0;
include/linux/idr.h renamed from root/toolchain/linux-2.5-bk/include/linux/idr.h +0 -2
diff -ur /root/toolchain/linux-2.5-bk/include/linux/idr.h linux-2.5-bk/include/linux/idr.h
@@ -76,5 +76,3 @@
 int idr_get_new_above(struct idr *idp, void *ptr, int starting_id, int *id);
 void idr_remove(struct idr *idp, int id);
 void idr_init(struct idr *idp);
-
-extern kmem_cache_t *idr_layer_cache;
include/linux/if_pppox.h renamed from root/toolchain/linux-2.5-bk/include/linux/if_pppox.h +0 -2
diff -ur /root/toolchain/linux-2.5-bk/include/linux/if_pppox.h linux-2.5-bk/include/linux/if_pppox.h
@@ -159,8 +159,6 @@
     PPPOX_DEAD		= 16  /* dead, useless, please clean me up!*/
 };
 
-extern struct ppp_channel_ops pppoe_chan_ops;
-
 #endif /* __KERNEL__ */
 
 #endif /* !(__LINUX_IF_PPPOX_H) */
include/linux/netfilter_ipv4/ip_tables.h renamed from root/toolchain/linux-2.5-bk/include/linux/netfilter_ipv4/ip_tables.h +0 -2
diff -ur /root/toolchain/linux-2.5-bk/include/linux/netfilter_ipv4/ip_tables.h linux-2.5-bk/include/linux/netfilter_ipv4/ip_tables.h
@@ -284,8 +284,6 @@
 	struct ipt_entry entrytable[0];
 };
 
-extern struct semaphore ipt_mutex;
-
 /* Standard return verdict, or do jump. */
 #define IPT_STANDARD_TARGET ""
 /* Error verdict. */
include/linux/sunrpc/svcauth.h renamed from root/toolchain/linux-2.5-bk/include/linux/sunrpc/svcauth.h +0 -1
diff -ur /root/toolchain/linux-2.5-bk/include/linux/sunrpc/svcauth.h linux-2.5-bk/include/linux/sunrpc/svcauth.h
@@ -93,7 +93,6 @@
 	int	(*release)(struct svc_rqst *rq);
 	void	(*domain_release)(struct auth_domain *);
 };
-extern struct auth_ops	*authtab[RPC_AUTH_MAXFLAVOR];
 
 #define	SVC_GARBAGE	1
 #define	SVC_SYSERR	2
net/ipv4/xfrm4_state.c renamed from root/toolchain/linux-2.5-bk/net/ipv4/xfrm4_state.c +1 -1
diff -ur /root/toolchain/linux-2.5-bk/net/ipv4/xfrm4_state.c linux-2.5-bk/net/ipv4/xfrm4_state.c
@@ -11,7 +11,7 @@
 #include <linux/pfkeyv2.h>
 #include <linux/ipsec.h>
 
-extern struct xfrm_state_afinfo xfrm4_state_afinfo;
+static struct xfrm_state_afinfo xfrm4_state_afinfo;
 
 static void
 __xfrm4_init_tempsel(struct xfrm_state *x, struct flowi *fl,
net/netlink/af_netlink.c renamed from root/toolchain/linux-2.5-bk/net/netlink/af_netlink.c +1 -1
diff -ur /root/toolchain/linux-2.5-bk/net/netlink/af_netlink.c linux-2.5-bk/net/netlink/af_netlink.c
@@ -176,7 +176,7 @@
 	return sk;
 }
 
-extern struct proto_ops netlink_ops;
+static struct proto_ops netlink_ops;
 
 static int netlink_insert(struct sock *sk, u32 pid)
 {
#1 lore raw

gcc 3.5 is warning about unused static variables, add __attribute_unused__ to the 2 places to silence it.

kernel/configs.c renamed from root/toolchain/linux-2.5-bk/kernel/configs.c +1 -1
diff -ur /root/toolchain/linux-2.5-bk/kernel/configs.c linux-2.5-bk/kernel/configs.c
@@ -58,7 +58,7 @@
 /**************************************************/
 /* globals and useful constants                   */
 
-static const char IKCONFIG_VERSION[] __initdata = "0.7";
+static const char IKCONFIG_VERSION[] __attribute_used__ __initdata = "0.7";
 
 static ssize_t
 ikconfig_read_current(struct file *file, char __user *buf,
lib/zlib_inflate/inftrees.c renamed from root/toolchain/linux-2.5-bk/lib/zlib_inflate/inftrees.c +1 -1
diff -ur /root/toolchain/linux-2.5-bk/lib/zlib_inflate/inftrees.c linux-2.5-bk/lib/zlib_inflate/inftrees.c
@@ -7,7 +7,7 @@
 #include "inftrees.h"
 #include "infutil.h"
 
-static const char inflate_copyright[] =
+static const char inflate_copyright[] __attribute_used__ =
    " inflate 1.1.3 Copyright 1995-1998 Mark Adler ";
 /*
   If you use the zlib library in a product, an acknowledgment is welcome
#2 lore raw

gcc 3.5 ICEd on the ppc64 version of __ptep_set_access_flags, but it does look like we want to use *ptep here.

include/asm-ppc64/pgtable.h renamed from root/toolchain/linux-2.5-bk/include/asm-ppc64/pgtable.h +1 -1
diff -ur /root/toolchain/linux-2.5-bk/include/asm-ppc64/pgtable.h linux-2.5-bk/include/asm-ppc64/pgtable.h
@@ -424,7 +424,7 @@
 		stdcx.	%0,0,%4\n\
 		bne-	1b"
 	:"=&r" (old), "=&r" (tmp), "=m" (*ptep)
-	:"r" (bits), "r" (ptep), "m" (ptep), "i" (_PAGE_BUSY)
+	:"r" (bits), "r" (ptep), "m" (*ptep), "i" (_PAGE_BUSY)
 	:"cc");
 }
 #define  ptep_set_access_flags(__vma, __address, __ptep, __entry, __dirty) \
#3 lore raw
In reply to Anton Blanchard

Hi,

Quoted 2 lines · Anton Blanchard

gcc 3.5 is warning about unused static variables, add __attribute_unused__ to the 2 places to silence it.

Can't we just remove these variables?

Quoted 30 lines

diff -ur /root/toolchain/linux-2.5-bk/kernel/configs.c linux-2.5-bk/kernel/configs.c ---
/root/toolchain/linux-2.5-bk/kernel/configs.c 2004-06-25 09:13:15.000000000
+0000 +++ linux-2.5-bk/kernel/configs.c 2004-07-03 11:03:45.019878184 +0000

kernel/configs.c renamed from root/toolchain/linux-2.5-bk/kernel/configs.c +1 -1
@@ -58,7 +58,7 @@
 /**************************************************/
 /* globals and useful constants                   */
 
-static const char IKCONFIG_VERSION[] __initdata = "0.7";
+static const char IKCONFIG_VERSION[] __attribute_used__ __initdata =
 "0.7";
 
 static ssize_t

ikconfig_read_current(struct file *file, char __user *buf,
diff -ur /root/toolchain/linux-2.5-bk/lib/zlib_inflate/inftrees.c linux-2.5-bk/lib/zlib_inflate/inftrees.c ---
/root/toolchain/linux-2.5-bk/lib/zlib_inflate/inftrees.c 2004-02-22
13:48:07.000000000 +0000 +++
linux-2.5-bk/lib/zlib_inflate/inftrees.c 2004-07-03 11:27:06.633933752
+0000 @@ -7,7 +7,7 @@
#include "inftrees.h"
#include "infutil.h"

lib/zlib_inflate/inftrees.c renamed from root/toolchain/linux-2.5-bk/lib/zlib_inflate/inftrees.c +1 -1
-static const char inflate_copyright[] =
+static const char inflate_copyright[] __attribute_used__ =
    " inflate 1.1.3 Copyright 1995-1998 Mark Adler ";
 /*
   If you use the zlib library in a product, an acknowledgment is welcome
#4 lore raw
Quoted 2 lines

Can't we just remove these variables?

Certainly possible. Randy, does IKCONFIG_VERSION serve a purpose?

Anton

#5 lore raw

On Sun, 4 Jul 2004 21:04:43 +1000 Anton Blanchard wrote:

|  
| > Can't we just remove these variables?
| 
| Certainly possible. Randy, does IKCONFIG_VERSION serve a purpose?

Just kill it.

Thanks,
--
~Randy

#6 lore raw
Quoted 2 lines

Just kill it.

OK here we go.

--

Remove unused IKCONFIG_VERSION.

===== kernel/configs.c 1.9 vs edited =====

kernel/configs.c +0 -5
@@ -55,11 +55,6 @@
 
 #ifdef CONFIG_IKCONFIG_PROC
 
-/**************************************************/
-/* globals and useful constants                   */
-
-static const char IKCONFIG_VERSION[] __attribute_used__ __initdata = "0.7";
-
 static ssize_t
 ikconfig_read_current(struct file *file, char __user *buf,
 		      size_t len, loff_t * offset)