2003-03-21 13:04:22

by norbert_wolff

[permalink] [raw]
Subject: Some Warning from gcc-3.4-cvs for 2.5.65

Hi !

Here are some Warning got when compiling Linux 2.6.65 (devfs not configured)
with the latest gcc-3.4 CVS :

include/linux/devfs_fs_kernel.h: In function `devfs_remove':
include/linux/devfs_fs_kernel.h:101: warning: varargs function cannot be
inline

Possible Fix :

Replace inline-func with macro

--- devfs_fs_kernel.h.orig 2003-03-21 13:28:24.000000000 +0000
+++ devfs_fs_kernel.h 2003-03-21 13:30:28.000000000 +0000
@@ -97,9 +97,9 @@
{
return NULL;
}
-static inline void devfs_remove(const char *fmt, ...)
-{
-}
+
+#define devfs_remove(x, ...) do { ; } while (0)
+
static inline int devfs_generate_path (devfs_handle_t de, char *path,
int buflen)
{

---

include/linux/kallsyms.h: In function `__check_printsym_format':
include/linux/kallsyms.h:38: warning: varargs function cannot be inline

> /* This macro allows us to keep printk typechecking */
> static void __check_printsym_format(const char *fmt, ...)
>__attribute__((format(printf,1,2)));
> static inline void __check_printsym_format(const char *fmt, ...)
> {
> }

I think the inline-attribute should be simply removed to quiet this Warning.

---

arch/i386/kernel/ptrace.c: In function `sys_ptrace':
warning: `__pu_err' might be used uninitialized in this function

This comes from include/asm-i386

> #define __put_user_nocheck(x,ptr,size) \
> ({ \
> long __pu_err; \
> __put_user_size((x),(ptr),(size),__pu_err,-EFAULT); \
> __pu_err; \
> })

__pu_err is shurely not initialized, but migth this be intentionally ?

---

kernel/fork.c: In function `copy_fs':
kernel/fork.c:569: warning: function cannot be inline
kernel/fork.c: In function `copy_process':
kernel/fork.c:569: warning: can't inline call to `copy_fs'
kernel/fork.c:882: warning: called from here

I dont understand WHY copy_fs cannont be inlined ...

kernel/posix-timers.c: In function `unlock_timer':
kernel/posix-timers.c:564: warning: function cannot be inline

ditto
---

kernel/suspend.c: In function `freeze_processes':
kernel/suspend.c:228: warning: comparison of distinct pointer types lacks a
cast

---

drivers/char/vt.c:2457: warning: `return' with a value, in function
returning void
drivers/char/vt.c:2497: warning: initialization from incompatible pointer
type

I think these Warnings appear as con_init is declared as
static void __init con_init(void);
but typedef int (*initcall_t)(void);
suggests that it migth better be static int __init con_init(void) ??


Regards,

Norbert


2003-03-21 13:23:41

by Jörn Engel

[permalink] [raw]
Subject: Re: Some Warning from gcc-3.4-cvs for 2.5.65

On Fri, 21 March 2003 14:15:12 +0000, Norbert Wolff wrote:
>
> Here are some Warning got when compiling Linux 2.6.65 (devfs not configured)
> with the latest gcc-3.4 CVS :
>
> include/linux/devfs_fs_kernel.h: In function `devfs_remove':
> include/linux/devfs_fs_kernel.h:101: warning: varargs function cannot be
> inline
>
> Possible Fix :
>
> Replace inline-func with macro
>
> --- devfs_fs_kernel.h.orig 2003-03-21 13:28:24.000000000 +0000
> +++ devfs_fs_kernel.h 2003-03-21 13:30:28.000000000 +0000
> @@ -97,9 +97,9 @@
> {
> return NULL;
> }
> -static inline void devfs_remove(const char *fmt, ...)
> -{
> -}
> +
> +#define devfs_remove(x, ...) do { ; } while (0)
> +
> static inline int devfs_generate_path (devfs_handle_t de, char *path,
> int buflen)
> {
>
> ---
>
> include/linux/kallsyms.h: In function `__check_printsym_format':
> include/linux/kallsyms.h:38: warning: varargs function cannot be inline
>
> > /* This macro allows us to keep printk typechecking */
> > static void __check_printsym_format(const char *fmt, ...)
> >__attribute__((format(printf,1,2)));
> > static inline void __check_printsym_format(const char *fmt, ...)
> > {
> > }
>
> I think the inline-attribute should be simply removed to quiet this Warning.

Quiting a warning is not a good reason for patches. If the warning is
bogus, the compiler should get fixed, not the kernel.
In this case the compiler should, inlined or not, optimize the call to
an empty function into nothing and shut up.

J?rn

--
Good warriors cause others to come to them and do not go to others.
-- Sun Tzu