Hi, I am looking into getting the kernel to compile with gcc 4.0, and encountered something which I am not sure about. In sys/conf/kern.mk, why do we have -Wredundant-decls in the CWARNFLAGS: CWARNFLAGS?= -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes \ I have no problems with the other warning flags. However -Wredundant-decls warns for: `-Wredundant-decls' Warn if anything is declared more than once in the same scope, even in cases where multiple declaration is valid and changes nothing. This warning causes gcc to emit a warning for legal C code, that normally not even -Wall would complain about. For example, gcc compiles this code compiles fine, even with -Wall: struct a { }; static struct a b; static struct a b = { }; but emits a warning with -Wredundant-decls: r.c:1: warning: redundant redeclaration of 'b' r.c:1: warning: previous declaration of 'b' was here There are places in the kernel that want to forward declare a struct as static, and then implement it later on. Since it is legal in C to do this, are we gaining anything by having this flag in the kernel's CWARNFLAGS? Does -Wredundant-decls warn against other things that are useful to warn against? Sorry if this is a silly question....I'm not a C expert. Thanks. -- Craig Rodrigues rodrigc_at_crodrigues.orgReceived on Tue Aug 02 2005 - 03:42:01 UTC
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:40 UTC