All of lore.kernel.org
 help / color / mirror / Atom feed
* [Kernel-janitors] [PATCH] - 2.6.2 - security.h - compiler cleanups
@ 2004-02-13  2:41 Ron Gage
  2004-02-13 20:42 ` Greg KH
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: Ron Gage @ 2004-02-13  2:41 UTC (permalink / raw)
  To: kernel-janitors

[-- Attachment #1: Type: text/plain, Size: 309 bytes --]

Well, it's probably useless, but I like clean compiles.

This "large" patch eliminates a bunch of "parameter defined but not used" 
warnings in the kernel.  The problems surround the stub functions in 
security.h that haven't been coded yet.

Enjoy...


-- 
Ron Gage - LPIC1, MCP, A+, Net+
Pontiac, Michigan


[-- Attachment #2: security.h.diff --]
[-- Type: text/x-diff, Size: 17361 bytes --]

--- linux-2.6.2.orig/include/linux/security.h	2004-02-03 22:44:05.000000000 -0500
+++ linux-2.6.2/include/linux/security.h	2004-02-12 21:06:12.000000000 -0500
@@ -1908,22 +1908,30 @@
 
 static inline int security_acct (struct file *file)
 {
+	file = file;
 	return 0;
 }
 
 static inline int security_sysctl(ctl_table * table, int op)
 {
+	table = table;
+	op = op;
 	return 0;
 }
 
 static inline int security_quotactl (int cmds, int type, int id,
 				     struct super_block * sb)
 {
+	cmds = cmds;
+	type = type;
+	id = id;
+	sb = sb;
 	return 0;
 }
 
 static inline int security_quota_on (struct file * file)
 {
+	file = file;
 	return 0;
 }
 
@@ -1939,11 +1947,12 @@
 
 static inline int security_bprm_alloc (struct linux_binprm *bprm)
 {
+	bprm = bprm;
 	return 0;
 }
 
 static inline void security_bprm_free (struct linux_binprm *bprm)
-{ }
+{ bprm = bprm; }
 
 static inline void security_bprm_compute_creds (struct linux_binprm *bprm)
 { 
@@ -1957,6 +1966,7 @@
 
 static inline int security_bprm_check (struct linux_binprm *bprm)
 {
+	bprm = bprm;
 	return 0;
 }
 
@@ -1967,19 +1977,22 @@
 
 static inline int security_sb_alloc (struct super_block *sb)
 {
+	sb = sb;
 	return 0;
 }
 
 static inline void security_sb_free (struct super_block *sb)
-{ }
+{ sb = sb; }
 
 static inline int security_sb_kern_mount (struct super_block *sb)
 {
+	sb = sb;
 	return 0;
 }
 
 static inline int security_sb_statfs (struct super_block *sb)
 {
+	sb = sb;
 	return 0;
 }
 
@@ -1987,82 +2000,102 @@
 				    char *type, unsigned long flags,
 				    void *data)
 {
+	dev_name = dev_name;
+	type = type;
+	flags = flags;
+	nd = nd;
+	data = data;
 	return 0;
 }
 
 static inline int security_sb_check_sb (struct vfsmount *mnt,
 					struct nameidata *nd)
 {
+	mnt = mnt;
+	nd = nd;
 	return 0;
 }
 
 static inline int security_sb_umount (struct vfsmount *mnt, int flags)
 {
+	mnt = mnt;
+	flags = flags;
 	return 0;
 }
 
 static inline void security_sb_umount_close (struct vfsmount *mnt)
-{ }
+{ mnt = mnt; }
 
 static inline void security_sb_umount_busy (struct vfsmount *mnt)
-{ }
+{ mnt = mnt; }
 
 static inline void security_sb_post_remount (struct vfsmount *mnt,
 					     unsigned long flags, void *data)
-{ }
+{ mnt = mnt; flags = flags; data = data; }
 
 static inline void security_sb_post_mountroot (void)
 { }
 
 static inline void security_sb_post_addmount (struct vfsmount *mnt,
 					      struct nameidata *mountpoint_nd)
-{ }
+{ mnt = mnt; mountpoint_nd = mountpoint_nd; }
 
 static inline int security_sb_pivotroot (struct nameidata *old_nd,
 					 struct nameidata *new_nd)
 {
+	old_nd = old_nd;
+	new_nd = new_nd;
 	return 0;
 }
 
 static inline void security_sb_post_pivotroot (struct nameidata *old_nd,
 					       struct nameidata *new_nd)
-{ }
+{ old_nd = old_nd; new_nd = new_nd; }
 
 static inline int security_inode_alloc (struct inode *inode)
 {
+	inode = inode;
 	return 0;
 }
 
 static inline void security_inode_free (struct inode *inode)
-{ }
+{ inode = inode; }
 	
 static inline int security_inode_create (struct inode *dir,
 					 struct dentry *dentry,
 					 int mode)
 {
+	dir = dir;
+	dentry = dentry;
+	mode = mode;
 	return 0;
 }
 
 static inline void security_inode_post_create (struct inode *dir,
 					       struct dentry *dentry,
 					       int mode)
-{ }
+{ dir = dir; dentry = dentry; mode = mode; }
 
 static inline int security_inode_link (struct dentry *old_dentry,
 				       struct inode *dir,
 				       struct dentry *new_dentry)
 {
+	old_dentry = old_dentry;
+	dir = dir;
+	new_dentry = new_dentry;
 	return 0;
 }
 
 static inline void security_inode_post_link (struct dentry *old_dentry,
 					     struct inode *dir,
 					     struct dentry *new_dentry)
-{ }
+{ old_dentry = old_dentry; dir = dir; new_dentry = new_dentry; }
 
 static inline int security_inode_unlink (struct inode *dir,
 					 struct dentry *dentry)
 {
+	dir = dir;
+	dentry = dentry;
 	return 0;
 }
 
@@ -2070,29 +2103,37 @@
 					  struct dentry *dentry,
 					  const char *old_name)
 {
+	dir = dir;
+	dentry = dentry;
+	old_name = old_name;
 	return 0;
 }
 
 static inline void security_inode_post_symlink (struct inode *dir,
 						struct dentry *dentry,
 						const char *old_name)
-{ }
+{ dir = dir; dentry = dentry; old_name = old_name; }
 
 static inline int security_inode_mkdir (struct inode *dir,
 					struct dentry *dentry,
 					int mode)
 {
+	dir = dir;
+	dentry = dentry;
+	mode = mode;
 	return 0;
 }
 
 static inline void security_inode_post_mkdir (struct inode *dir,
 					      struct dentry *dentry,
 					      int mode)
-{ }
+{ dir = dir; dentry = dentry; mode = mode; }
 
 static inline int security_inode_rmdir (struct inode *dir,
 					struct dentry *dentry)
 {
+	dir = dir;
+	dentry = dentry;
 	return 0;
 }
 
@@ -2100,19 +2141,27 @@
 					struct dentry *dentry,
 					int mode, dev_t dev)
 {
+	dir = dir;
+	dentry = dentry;
+	mode = mode;
+	dev = dev;
 	return 0;
 }
 
 static inline void security_inode_post_mknod (struct inode *dir,
 					      struct dentry *dentry,
 					      int mode, dev_t dev)
-{ }
+{ dir = dir; dentry = dentry; mode = mode; dev = dev; }
 
 static inline int security_inode_rename (struct inode *old_dir,
 					 struct dentry *old_dentry,
 					 struct inode *new_dir,
 					 struct dentry *new_dentry)
 {
+	old_dir = old_dir;
+	old_dentry = old_dentry;
+	new_dir = new_dir;
+	new_dentry = new_dentry;
 	return 0;
 }
 
@@ -2120,39 +2169,54 @@
 					       struct dentry *old_dentry,
 					       struct inode *new_dir,
 					       struct dentry *new_dentry)
-{ }
+{ 
+	old_dir = old_dir; 
+	old_dentry = old_dentry; 
+	new_dir = new_dir; 
+	new_dentry = new_dentry; 
+}
 
 static inline int security_inode_readlink (struct dentry *dentry)
 {
+	dentry = dentry;
 	return 0;
 }
 
 static inline int security_inode_follow_link (struct dentry *dentry,
 					      struct nameidata *nd)
 {
+	dentry = dentry;
+	nd = nd;
 	return 0;
 }
 
 static inline int security_inode_permission (struct inode *inode, int mask,
 					     struct nameidata *nd)
 {
+	inode = inode;
+	mask = mask;
+	nd = nd;
 	return 0;
 }
 
 static inline int security_inode_setattr (struct dentry *dentry,
 					  struct iattr *attr)
 {
+	dentry = dentry;
+	attr = attr;
 	return 0;
 }
 
 static inline int security_inode_getattr (struct vfsmount *mnt,
 					  struct dentry *dentry)
 {
+	mnt = mnt;
+	dentry = dentry;
 	return 0;
 }
 
 static inline void security_inode_delete (struct inode *inode)
-{ }
+{ inode = inode; }
 
 static inline int security_inode_setxattr (struct dentry *dentry, char *name,
 					   void *value, size_t size, int flags)
@@ -2162,15 +2226,24 @@
 
 static inline void security_inode_post_setxattr (struct dentry *dentry, char *name,
 						 void *value, size_t size, int flags)
-{ }
+{ 
+	dentry = dentry;
+	name = name;
+	value = value;
+	size = size;
+	flags = flags;
+}
 
 static inline int security_inode_getxattr (struct dentry *dentry, char *name)
 {
+	dentry = dentry;
+	name = name;
 	return 0;
 }
 
 static inline int security_inode_listxattr (struct dentry *dentry)
 {
+	dentry = dentry;
 	return 0;
 }
 
@@ -2181,63 +2254,91 @@
 
 static inline int security_inode_getsecurity(struct dentry *dentry, const char *name, void *buffer, size_t size)
 {
+	dentry = dentry;
+	name = name;
+	buffer = buffer;
+	size = size;
 	return -EOPNOTSUPP;
 }
 
 static inline int security_inode_setsecurity(struct dentry *dentry, const char *name, const void *value, size_t size, int flags) 
 {
+	dentry = dentry;
+	name = name;
+	value = value;
+	size = size;
+	flags = flags;
 	return -EOPNOTSUPP;
 }
 
 static inline int security_inode_listsecurity(struct dentry *dentry, char *buffer)
 {
+	dentry = dentry;
+	buffer = buffer;
 	return 0;
 }
 
 static inline int security_file_permission (struct file *file, int mask)
 {
+	file = file;
+	mask = mask;
 	return 0;
 }
 
 static inline int security_file_alloc (struct file *file)
 {
+	file = file;
 	return 0;
 }
 
 static inline void security_file_free (struct file *file)
-{ }
+{ file = file; }
 
 static inline int security_file_ioctl (struct file *file, unsigned int cmd,
 				       unsigned long arg)
 {
+	file = file;
+	cmd = cmd;
+	arg = arg;
 	return 0;
 }
 
 static inline int security_file_mmap (struct file *file, unsigned long prot,
 				      unsigned long flags)
 {
+	file = file;
+	prot = prot;
+	flags = flags;
 	return 0;
 }
 
 static inline int security_file_mprotect (struct vm_area_struct *vma,
 					  unsigned long prot)
 {
+	vma = vma;
+	prot = prot;
 	return 0;
 }
 
 static inline int security_file_lock (struct file *file, unsigned int cmd)
 {
+	file = file;
+	cmd = cmd;
 	return 0;
 }
 
 static inline int security_file_fcntl (struct file *file, unsigned int cmd,
 				       unsigned long arg)
 {
+	file = file;
+	cmd = cmd;
+	arg = arg;
 	return 0;
 }
 
 static inline int security_file_set_fowner (struct file *file)
 {
+	file = file;
 	return 0;
 }
 
@@ -2245,30 +2346,41 @@
 						struct fown_struct *fown,
 						int fd, int reason)
 {
+	tsk = tsk;
+	fown = fown;
+	fd = fd;
+	reason = reason;
 	return 0;
 }
 
 static inline int security_file_receive (struct file *file)
 {
+	file = file;
 	return 0;
 }
 
 static inline int security_task_create (unsigned long clone_flags)
 {
+	clone_flags = clone_flags;
 	return 0;
 }
 
 static inline int security_task_alloc (struct task_struct *p)
 {
+	p = p;
 	return 0;
 }
 
 static inline void security_task_free (struct task_struct *p)
-{ }
+{ p = p; }
 
 static inline int security_task_setuid (uid_t id0, uid_t id1, uid_t id2,
 					int flags)
 {
+	id0 = id0;
+	id1 = id1;
+	id2 = id2;
+	flags = flags;
 	return 0;
 }
 
@@ -2281,37 +2393,51 @@
 static inline int security_task_setgid (gid_t id0, gid_t id1, gid_t id2,
 					int flags)
 {
+	id0 = id0;
+	id1 = id1;
+	id2 = id2;
+	flags = flags;
 	return 0;
 }
 
 static inline int security_task_setpgid (struct task_struct *p, pid_t pgid)
 {
+	p = p;
+	pgid = pgid;
 	return 0;
 }
 
 static inline int security_task_getpgid (struct task_struct *p)
 {
+	p = p;
 	return 0;
 }
 
 static inline int security_task_getsid (struct task_struct *p)
 {
+	p = p;
 	return 0;
 }
 
 static inline int security_task_setgroups (int gidsetsize, gid_t *grouplist)
 {
+	gidsetsize = gidsetsize;
+	grouplist = grouplist;
 	return 0;
 }
 
 static inline int security_task_setnice (struct task_struct *p, int nice)
 {
+	p = p;
+	nice = nice;
 	return 0;
 }
 
 static inline int security_task_setrlimit (unsigned int resource,
 					   struct rlimit *new_rlim)
 {
+	resource = resource;
+	new_rlim = new_rlim;
 	return 0;
 }
 
@@ -2319,22 +2445,30 @@
 					      int policy,
 					      struct sched_param *lp)
 {
+	p = p;
+	policy = policy;
+	lp = lp;
 	return 0;
 }
 
 static inline int security_task_getscheduler (struct task_struct *p)
 {
+	p = p;
 	return 0;
 }
 
 static inline int security_task_kill (struct task_struct *p,
 				      struct siginfo *info, int sig)
 {
+	p = p;
+	info = info;
+	sig = sig;
 	return 0;
 }
 
 static inline int security_task_wait (struct task_struct *p)
 {
+	p = p;
 	return 0;
 }
 
@@ -2343,6 +2477,11 @@
 				       unsigned long arg4,
 				       unsigned long arg5)
 {
+	option = option;
+	arg2 = arg2;
+	arg3 = arg3;
+	arg4 = arg4;
+	arg5 = arg5;
 	return 0;
 }
 
@@ -2352,44 +2491,55 @@
 }
 
 static inline void security_task_to_inode(struct task_struct *p, struct inode *inode)
-{ }
+{ p = p; inode = inode; }
 
 static inline int security_ipc_permission (struct kern_ipc_perm *ipcp,
 					   short flag)
 {
+	ipcp = ipcp;
+	flag = flag;
 	return 0;
 }
 
 static inline int security_msg_msg_alloc (struct msg_msg * msg)
 {
+	msg = msg;
 	return 0;
 }
 
 static inline void security_msg_msg_free (struct msg_msg * msg)
-{ }
+{ msg = msg; }
 
 static inline int security_msg_queue_alloc (struct msg_queue *msq)
 {
+	msq = msq;
 	return 0;
 }
 
 static inline void security_msg_queue_free (struct msg_queue *msq)
-{ }
+{ msq = msq; }
 
 static inline int security_msg_queue_associate (struct msg_queue * msq, 
 						int msqflg)
 {
+	msq = msq;
+	msqflg = msqflg;
 	return 0;
 }
 
 static inline int security_msg_queue_msgctl (struct msg_queue * msq, int cmd)
 {
+	msq = msq;
+	cmd = cmd;
 	return 0;
 }
 
 static inline int security_msg_queue_msgsnd (struct msg_queue * msq,
 					     struct msg_msg * msg, int msqflg)
 {
+	msq = msq;
+	msg = msg;
+	msqflg = msqflg;
 	return 0;
 }
 
@@ -2398,49 +2548,68 @@
 					     struct task_struct * target,
 					     long type, int mode)
 {
+	msq = msq;
+	msg = msg;
+	target = target;
+	type = type;
+	mode = mode;
 	return 0;
 }
 
 static inline int security_shm_alloc (struct shmid_kernel *shp)
 {
+	shp = shp;
 	return 0;
 }
 
 static inline void security_shm_free (struct shmid_kernel *shp)
-{ }
+{ shp = shp; }
+
 
 static inline int security_shm_associate (struct shmid_kernel * shp, 
 					  int shmflg)
 {
+	shp = shp;
+	shmflg = shmflg;
 	return 0;
 }
 
 static inline int security_shm_shmctl (struct shmid_kernel * shp, int cmd)
 {
+	shp = shp;
+	cmd = cmd;
 	return 0;
 }
 
 static inline int security_shm_shmat (struct shmid_kernel * shp, 
 				      char __user *shmaddr, int shmflg)
 {
+	shp = shp;
+	shmaddr = shmaddr;
+	shmflg = shmflg;
 	return 0;
 }
 
 static inline int security_sem_alloc (struct sem_array *sma)
 {
+	sma = sma;
 	return 0;
 }
 
 static inline void security_sem_free (struct sem_array *sma)
-{ }
+{ sma = sma; }
 
 static inline int security_sem_associate (struct sem_array * sma, int semflg)
 {
+	sma = sma;
+	semflg = semflg; 
 	return 0;
 }
 
 static inline int security_sem_semctl (struct sem_array * sma, int cmd)
 {
+	sma = sma;
+	cmd = cmd;
 	return 0;
 }
 
@@ -2448,19 +2617,31 @@
 				      struct sembuf * sops, unsigned nsops, 
 				      int alter)
 {
+	sma = sma;
+	sops = sops;
+	nsops = nsops;
+	alter = alter;
 	return 0;
 }
 
 static inline void security_d_instantiate (struct dentry *dentry, struct inode *inode)
-{ }
+{ dentry = dentry; inode = inode; }
 
 static inline int security_getprocattr(struct task_struct *p, char *name, void *value, size_t size)
 {
+	p = p;
+	name = name;
+	value = value;
+	size = size;
 	return -EINVAL;
 }
 
 static inline int security_setprocattr(struct task_struct *p, char *name, void *value, size_t size)
 {
+	p = p;
+	name = name;
+	value = value;
+	size = size;
 	return -EINVAL;
 }
 
@@ -2606,17 +2787,25 @@
 					       struct socket * other, 
 					       struct sock * newsk)
 {
+	sock = sock;
+	other = other;
+	newsk = newsk;
 	return 0;
 }
 
 static inline int security_unix_may_send(struct socket * sock, 
 					 struct socket * other)
 {
+	sock = sock;
+	other = other;
 	return 0;
 }
 
 static inline int security_socket_create (int family, int type, int protocol)
 {
+	family = family;
+	type = type;
+	protocol = protocol;
 	return 0;
 }
 
@@ -2625,12 +2814,19 @@
 					       int type, 
 					       int protocol)
 {
+	sock = sock;
+	family = family;
+	type = type;
+	protocol = protocol;
 }
 
 static inline int security_socket_bind(struct socket * sock, 
 				       struct sockaddr * address, 
 				       int addrlen)
 {
+	sock = sock;
+	address = address;
+	addrlen = addrlen;
 	return 0;
 }
 
@@ -2638,28 +2834,40 @@
 					  struct sockaddr * address, 
 					  int addrlen)
 {
+	sock = sock;
+	address = address;
+	addrlen = addrlen;
 	return 0;
 }
 
 static inline int security_socket_listen(struct socket * sock, int backlog)
 {
+	sock = sock;
+	backlog = backlog;
 	return 0;
 }
 
 static inline int security_socket_accept(struct socket * sock, 
 					 struct socket * newsock)
 {
+	sock = sock;
+	newsock = newsock;
 	return 0;
 }
 
 static inline void security_socket_post_accept(struct socket * sock, 
 					       struct socket * newsock)
 {
+	sock = sock;
+	newsock = newsock;
 }
 
 static inline int security_socket_sendmsg(struct socket * sock, 
 					  struct msghdr * msg, int size)
 {
+	sock = sock;
+	msg = msg;
+	size = size;
 	return 0;
 }
 
@@ -2667,54 +2875,78 @@
 					  struct msghdr * msg, int size, 
 					  int flags)
 {
+	sock = sock;
+	msg = msg;
+	size = size;
+	flags = flags;
 	return 0;
 }
 
 static inline int security_socket_getsockname(struct socket * sock)
 {
+	sock = sock;
 	return 0;
 }
 
 static inline int security_socket_getpeername(struct socket * sock)
 {
+	sock = sock;
 	return 0;
 }
 
 static inline int security_socket_getsockopt(struct socket * sock, 
 					     int level, int optname)
 {
+	sock = sock;
+	level = level;
+	optname = optname;
 	return 0;
 }
 
 static inline int security_socket_setsockopt(struct socket * sock, 
 					     int level, int optname)
 {
+	sock = sock;
+	level = level;
+	optname = optname;
 	return 0;
 }
 
 static inline int security_socket_shutdown(struct socket * sock, int how)
 {
+	sock = sock;
+	how = how;
 	return 0;
 }
 static inline int security_sock_rcv_skb (struct sock * sk, 
 					 struct sk_buff * skb)
 {
+	sk = sk;
+	skb = skb;
 	return 0;
 }
 
 static inline int security_socket_getpeersec(struct socket *sock, char __user *optval,
 					     int __user *optlen, unsigned len)
 {
+	sock = sock;
+	optval = optval;
+	optlen = optlen;
+	len = len;
 	return -ENOPROTOOPT;
 }
 
 static inline int security_sk_alloc(struct sock *sk, int family, int priority)
 {
+	sk = sk;
+	family = family;
+	priority = priority;
 	return 0;
 }
 
 static inline void security_sk_free(struct sock *sk)
 {
+	sk = sk;
 }
 #endif	/* CONFIG_SECURITY_NETWORK */
 

[-- Attachment #3: Type: text/plain, Size: 163 bytes --]

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Kernel-janitors] [PATCH] - 2.6.2 - security.h - compiler cleanups
  2004-02-13  2:41 [Kernel-janitors] [PATCH] - 2.6.2 - security.h - compiler cleanups Ron Gage
@ 2004-02-13 20:42 ` Greg KH
  2004-02-13 21:20 ` Ron Gage
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Greg KH @ 2004-02-13 20:42 UTC (permalink / raw)
  To: kernel-janitors

On Thu, Feb 12, 2004 at 09:41:59PM -0500, Ron Gage wrote:
> Well, it's probably useless, but I like clean compiles.
> 
> This "large" patch eliminates a bunch of "parameter defined but not used" 
> warnings in the kernel.  The problems surround the stub functions in 
> security.h that haven't been coded yet.

What compiler version are you using that you see these "warnings"?  I
don't see them here using 3.3.2.

And I really don't think that any kernel developer will accept these
patches, I know I sure will not.

Oh yeah, isn't there a gcc __attribute__ that will also turn off the
warning?

thanks,

greg k-h
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Kernel-janitors] [PATCH] - 2.6.2 - security.h - compiler cleanups
  2004-02-13  2:41 [Kernel-janitors] [PATCH] - 2.6.2 - security.h - compiler cleanups Ron Gage
  2004-02-13 20:42 ` Greg KH
@ 2004-02-13 21:20 ` Ron Gage
  2004-02-13 21:57 ` Greg KH
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Ron Gage @ 2004-02-13 21:20 UTC (permalink / raw)
  To: kernel-janitors

On Friday 13 February 2004 03:42 pm, Greg KH wrote:
> On Thu, Feb 12, 2004 at 09:41:59PM -0500, Ron Gage wrote:
> > Well, it's probably useless, but I like clean compiles.
> >
> > This "large" patch eliminates a bunch of "parameter defined but not used"
> > warnings in the kernel.  The problems surround the stub functions in
> > security.h that haven't been coded yet.
>
> What compiler version are you using that you see these "warnings"?  I
> don't see them here using 3.3.2.
I am using gcc 3.2.2 here.


Per the instructions from the janitors to-do list....

- Signedness issues. We have _lots_ of these.
  Adding a -W to the kernel build line shows them. We have lots of code paths
  that are not executed because comparisons <0 on an unsigned int always
  evaluates to true.

Doing this also exposes a LOT of unused parameter/unused variable warnings - a 
LOT in this case means that "make 2>../errors" generated a 5.8 meg file.  I 
though it would appropriate to clean up ALL warnings, not just the signedness 
problems.

>
> And I really don't think that any kernel developer will accept these
> patches, I know I sure will not.
>

Well, I guess I shouldn't have presumed to fix all the warnings.  My bad... 
Sorry about that...



-- 
Ron Gage - LPIC1, MCP, A+, Net+
Pontiac, Michigan

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Kernel-janitors] [PATCH] - 2.6.2 - security.h - compiler cleanups
  2004-02-13  2:41 [Kernel-janitors] [PATCH] - 2.6.2 - security.h - compiler cleanups Ron Gage
  2004-02-13 20:42 ` Greg KH
  2004-02-13 21:20 ` Ron Gage
@ 2004-02-13 21:57 ` Greg KH
  2004-02-13 22:02 ` Ron Gage
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Greg KH @ 2004-02-13 21:57 UTC (permalink / raw)
  To: kernel-janitors

On Fri, Feb 13, 2004 at 04:20:27PM -0500, Ron Gage wrote:
> 
> Well, I guess I shouldn't have presumed to fix all the warnings.  My bad... 
> Sorry about that...

Just fix the warnings that make sense :)

This one doesn't really...

thanks,

greg k-h
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Kernel-janitors] [PATCH] - 2.6.2 - security.h - compiler cleanups
  2004-02-13  2:41 [Kernel-janitors] [PATCH] - 2.6.2 - security.h - compiler cleanups Ron Gage
                   ` (2 preceding siblings ...)
  2004-02-13 21:57 ` Greg KH
@ 2004-02-13 22:02 ` Ron Gage
  2004-02-13 22:45 ` Matthew Wilcox
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Ron Gage @ 2004-02-13 22:02 UTC (permalink / raw)
  To: kernel-janitors

On Friday 13 February 2004 04:57 pm, Greg KH wrote:
> On Fri, Feb 13, 2004 at 04:20:27PM -0500, Ron Gage wrote:
> > Well, I guess I shouldn't have presumed to fix all the warnings.  My
> > bad... Sorry about that...
>
> Just fix the warnings that make sense :)

To quote the (1970's version) Cylons:
"By Your Command..."

-- 
Ron Gage - LPIC1, MCP, A+, Net+
Pontiac, Michigan

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Kernel-janitors] [PATCH] - 2.6.2 - security.h - compiler cleanups
  2004-02-13  2:41 [Kernel-janitors] [PATCH] - 2.6.2 - security.h - compiler cleanups Ron Gage
                   ` (3 preceding siblings ...)
  2004-02-13 22:02 ` Ron Gage
@ 2004-02-13 22:45 ` Matthew Wilcox
  2004-02-14  4:55 ` Greg KH
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Matthew Wilcox @ 2004-02-13 22:45 UTC (permalink / raw)
  To: kernel-janitors

On Fri, Feb 13, 2004 at 01:57:57PM -0800, Greg KH wrote:
> On Fri, Feb 13, 2004 at 04:20:27PM -0500, Ron Gage wrote:
> > 
> > Well, I guess I shouldn't have presumed to fix all the warnings.  My bad... 
> > Sorry about that...
> 
> Just fix the warnings that make sense :)
> 
> This one doesn't really...

I think there's a case for fixing all the *headers* that don't compile
cleanly with -W.  That way people can enable -W for their own drivers
without being flooded with errors that are nothing to do with them.

The patches that Ron submitted are one way to fix it, but I've always
hated the foo = foo "feature" of C, ever since I inadvertently found
out about it (that would be a couple of years ago).  We can use gcc
extensions to stop warning about it:

static int foo(int x, int y __attribute__((unused)))
{
        return x;
}

Obviously we wouldn't want to write that out because it's even more
ugly, but with a suitable define, we could do something like:

static int foo(int x, unused(int y))

or

static int foo(int x, int y __unused)

What do you think?


... hmm, the documentation is unclear, but:

static int foo(int x, int __unused y)

also doesn't warn, and that's the same syntax as __user, which gives me
the warm fuzzies.

-- 
"Next the statesmen will invent cheap lies, putting the blame upon 
the nation that is attacked, and every man will be glad of those
conscience-soothing falsities, and will diligently study them, and refuse
to examine any refutations of them; and thus he will by and by convince 
himself that the war is just, and will thank God for the better sleep 
he enjoys after this process of grotesque self-deception." -- Mark Twain
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Kernel-janitors] [PATCH] - 2.6.2 - security.h - compiler cleanups
  2004-02-13  2:41 [Kernel-janitors] [PATCH] - 2.6.2 - security.h - compiler cleanups Ron Gage
                   ` (4 preceding siblings ...)
  2004-02-13 22:45 ` Matthew Wilcox
@ 2004-02-14  4:55 ` Greg KH
  2004-02-14 16:53 ` Matthew Wilcox
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Greg KH @ 2004-02-14  4:55 UTC (permalink / raw)
  To: kernel-janitors

On Fri, Feb 13, 2004 at 10:45:24PM +0000, Matthew Wilcox wrote:
> static int foo(int x, int __unused y)
> 
> also doesn't warn, and that's the same syntax as __user, which gives me
> the warm fuzzies.

This is much more sane and nice.

Can we get a warning from the compiler if we actually use a variable
marked __unused?

thanks,

greg k-h
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Kernel-janitors] [PATCH] - 2.6.2 - security.h - compiler cleanups
  2004-02-13  2:41 [Kernel-janitors] [PATCH] - 2.6.2 - security.h - compiler cleanups Ron Gage
                   ` (5 preceding siblings ...)
  2004-02-14  4:55 ` Greg KH
@ 2004-02-14 16:53 ` Matthew Wilcox
  2004-02-14 17:16 ` Christoph Hellwig
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: Matthew Wilcox @ 2004-02-14 16:53 UTC (permalink / raw)
  To: kernel-janitors

On Fri, Feb 13, 2004 at 08:55:52PM -0800, Greg KH wrote:
> On Fri, Feb 13, 2004 at 10:45:24PM +0000, Matthew Wilcox wrote:
> > static int foo(int x, int __unused y)
> > 
> > also doesn't warn, and that's the same syntax as __user, which gives me
> > the warm fuzzies.
> 
> This is much more sane and nice.
> 
> Can we get a warning from the compiler if we actually use a variable
> marked __unused?

It doesn't warn in that case.

static int foo(int x, int __attribute__((unused)) y)
{
        return x + y;
}

Possibly we should call it __optional instead of __unused?

-- 
"Next the statesmen will invent cheap lies, putting the blame upon 
the nation that is attacked, and every man will be glad of those
conscience-soothing falsities, and will diligently study them, and refuse
to examine any refutations of them; and thus he will by and by convince 
himself that the war is just, and will thank God for the better sleep 
he enjoys after this process of grotesque self-deception." -- Mark Twain
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Kernel-janitors] [PATCH] - 2.6.2 - security.h - compiler cleanups
  2004-02-13  2:41 [Kernel-janitors] [PATCH] - 2.6.2 - security.h - compiler cleanups Ron Gage
                   ` (6 preceding siblings ...)
  2004-02-14 16:53 ` Matthew Wilcox
@ 2004-02-14 17:16 ` Christoph Hellwig
  2004-02-14 17:41 ` Matthew Wilcox
  2004-02-15  6:35 ` Adrian Bunk
  9 siblings, 0 replies; 11+ messages in thread
From: Christoph Hellwig @ 2004-02-14 17:16 UTC (permalink / raw)
  To: kernel-janitors

On Sat, Feb 14, 2004 at 04:53:02PM +0000, Matthew Wilcox wrote:
> It doesn't warn in that case.
> 
> static int foo(int x, int __attribute__((unused)) y)
> {
>         return x + y;
> }
> 
> Possibly we should call it __optional instead of __unused?

What about finding a gcc switch to turn that silly warning off instead?
It's quite natural at least for method vectors to have unused arguments.
Dito for all kinds of state machines implemented as array of function
pointers, etc...

Basically everywhere where we implement the OO Virtual baseclass paradigm.

> 
> -- 
> "Next the statesmen will invent cheap lies, putting the blame upon 
> the nation that is attacked, and every man will be glad of those
> conscience-soothing falsities, and will diligently study them, and refuse
> to examine any refutations of them; and thus he will by and by convince 
> himself that the war is just, and will thank God for the better sleep 
> he enjoys after this process of grotesque self-deception." -- Mark Twain
> _______________________________________________
> Kernel-janitors mailing list
> Kernel-janitors@lists.osdl.org
> http://lists.osdl.org/mailman/listinfo/kernel-janitors
---end quoted text---
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Kernel-janitors] [PATCH] - 2.6.2 - security.h - compiler cleanups
  2004-02-13  2:41 [Kernel-janitors] [PATCH] - 2.6.2 - security.h - compiler cleanups Ron Gage
                   ` (7 preceding siblings ...)
  2004-02-14 17:16 ` Christoph Hellwig
@ 2004-02-14 17:41 ` Matthew Wilcox
  2004-02-15  6:35 ` Adrian Bunk
  9 siblings, 0 replies; 11+ messages in thread
From: Matthew Wilcox @ 2004-02-14 17:41 UTC (permalink / raw)
  To: kernel-janitors

On Sat, Feb 14, 2004 at 05:16:46PM +0000, Christoph Hellwig wrote:
> On Sat, Feb 14, 2004 at 04:53:02PM +0000, Matthew Wilcox wrote:
> > It doesn't warn in that case.
> > 
> > static int foo(int x, int __attribute__((unused)) y)
> > {
> >         return x + y;
> > }
> > 
> > Possibly we should call it __optional instead of __unused?
> 
> What about finding a gcc switch to turn that silly warning off instead?
> It's quite natural at least for method vectors to have unused arguments.
> Dito for all kinds of state machines implemented as array of function
> pointers, etc...
> 
> Basically everywhere where we implement the OO Virtual baseclass paradigm.

Sure, it's -Wno-unused.  However, that implies it's a worthless warning,
and I don't think that's true.  Last time I looked at these warnings,
there were some places that could lose an argument entirely, but I
haven't looked in ~3 years.

I don't think it's an unreasonable burden to add __optional to the unused
arguments of a method call anyway.  I prefer the plan9 C approach of simply
not naming them (ie

static void my_write_inode(struct inode *inode, int)
{
	...
}

But we're stuck with ISO C where you can't do that.  Is it really that
ugly to write

static void my_write_inode(struct inode *inode, int __optional wait)
{
	...
}

-- 
"Next the statesmen will invent cheap lies, putting the blame upon 
the nation that is attacked, and every man will be glad of those
conscience-soothing falsities, and will diligently study them, and refuse
to examine any refutations of them; and thus he will by and by convince 
himself that the war is just, and will thank God for the better sleep 
he enjoys after this process of grotesque self-deception." -- Mark Twain
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [Kernel-janitors] [PATCH] - 2.6.2 - security.h - compiler cleanups
  2004-02-13  2:41 [Kernel-janitors] [PATCH] - 2.6.2 - security.h - compiler cleanups Ron Gage
                   ` (8 preceding siblings ...)
  2004-02-14 17:41 ` Matthew Wilcox
@ 2004-02-15  6:35 ` Adrian Bunk
  9 siblings, 0 replies; 11+ messages in thread
From: Adrian Bunk @ 2004-02-15  6:35 UTC (permalink / raw)
  To: kernel-janitors

On Sat, Feb 14, 2004 at 05:41:14PM +0000, Matthew Wilcox wrote:
> >...
> > What about finding a gcc switch to turn that silly warning off instead?
> > It's quite natural at least for method vectors to have unused arguments.
> > Dito for all kinds of state machines implemented as array of function
> > pointers, etc...
> > 
> > Basically everywhere where we implement the OO Virtual baseclass paradigm.
> 
> Sure, it's -Wno-unused.  However, that implies it's a worthless warning,
> and I don't think that's true.  Last time I looked at these warnings,
> there were some places that could lose an argument entirely, but I
> haven't looked in ~3 years.
> 
> I don't think it's an unreasonable burden to add __optional to the unused
> arguments of a method call anyway.  I prefer the plan9 C approach of simply
> not naming them (ie
>...

You said you checked such cases some time ago.

With your __optional suggestion, most likely _all_ such unused
parameters will be marked __optional without a deeper checking by some
Janitors. This way, the effect would be similar to simply using
-Wno-unused when using -W .

IMHO a better approach than silenting all -W warnings would be to add
selected warning options to the default built and clean the code for
them, but completely silenting a -W compile isn't worth the effort. E.g.
some time ago I checked -Wundef. Silenting -Wundef would be possible
although it requires some work (but I gave up after looking at XFS).

cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
http://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2004-02-15  6:35 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-02-13  2:41 [Kernel-janitors] [PATCH] - 2.6.2 - security.h - compiler cleanups Ron Gage
2004-02-13 20:42 ` Greg KH
2004-02-13 21:20 ` Ron Gage
2004-02-13 21:57 ` Greg KH
2004-02-13 22:02 ` Ron Gage
2004-02-13 22:45 ` Matthew Wilcox
2004-02-14  4:55 ` Greg KH
2004-02-14 16:53 ` Matthew Wilcox
2004-02-14 17:16 ` Christoph Hellwig
2004-02-14 17:41 ` Matthew Wilcox
2004-02-15  6:35 ` Adrian Bunk

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.