lkml.org 
[lkml]   [2010]   [Jun]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] kobject: Suppress compiler warning with gcc 3.x
From
Date
Le jeudi 03 juin 2010 à 14:23 +0800, Américo Wang a écrit :
> On Wed, Jun 02, 2010 at 11:02:28PM -0700, Eric W. Biederman wrote:
> >Américo Wang <xiyou.wangcong@gmail.com> writes:
> >
> >> On Thu, Jun 03, 2010 at 07:31:41AM +0200, Eric Dumazet wrote:
> >>>Le jeudi 03 juin 2010 à 14:23 +0900, Tetsuo Handa a écrit :
> >>>> Gcc 3.x generates a warning
> >>>>
> >>>> include/linux/sysfs.h:183: warning: parameter has incomplete type
> >>>>
> >>>> on each file.
> >>>> Suppress the warning by moving the definition of "enum kobj_ns_type"
> >>>> to before "#include <linux/sysfs.h>".
> >>>>
> >>>> Signed-off-by: Tetsuo Handa <penguin-kernel@I-love.SAKURA.ne.jp>
> >>>
> >>>
> >>>I was about to submit same patch, but I was also reverting 27eabc7cb4b3
> >>>(sysfs: Don't use enums in inline function declaration.)
> >>>
> >>>So that sysfs_exit_ns() prototype is consistent regardless of
> >>>CONFIG_SYSFS
> >>>
> >>>What do you think ?
> >>>
> >>
> >> This looks odd, in sysfs.h we do have a forward declaration of
> >> enum kobj_ns_type... I am wondering why gcc 3.x doesn't recognize it.
> >
> >Because the replacement is an inline, and we are passing the enum by value
> >gcc wants to see the full definition, at the point where the inline function
> >is declared.
> >
>
> But sysfs_exit_ns() is not inlined if CONFIG_SYSFS here.
>


# gcc -v
Reading specs from /usr/lib/gcc/i386-redhat-linux/3.4.6/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--disable-checking --with-system-zlib --enable-__cxa_atexit
--disable-libunwind-exceptions --enable-java-awt=gtk
--host=i386-redhat-linux
Thread model: posix
gcc version 3.4.6 20060404 (Red Hat 3.4.6-10)


# cat try.c
enum kobj_ns_type;
void sysfs_exit_ns(enum kobj_ns_type type, const void *tag);
int main(int argc, char *argv[])
{
return 0;
}
# gcc -O2 -Wall -o try try.c
try.c:2: warning: parameter has incomplete type
#


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2010-06-03 08:49    [W:0.083 / U:0.300 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site