> Date: Thu, 08 Jan 2015 19:00:30 -0500
> From: Ted Unangst <[email protected]>
> 
> I think -Wimplicit-function-declaration is a better fit for the
> desired warning here. We don't want implicit function declarations.
> This is the same warning we recently added to userland in a few places.
> 
> -Wstrict-prototypes was used in the past because I think the above
> warning wasn't available? Anyway, I don't like it, because combined
> with the no static rule, even private functions need prototypes. I
> think it's silly when I see code that does...
> 
> int somefun(int); /* declaration */
> int
> somefun(int x)
> {
>        /* definition two lines later */
> }
> 
> If a function is defined before it's used, it shouldn't be necessary
> to provide a private declaration, too.

In the end this really is a style issue.  Many projects I've got
experience with have -Wstrict-prototypes on by default.  By relaxing
things in our tree we make it harder for people to steal our code.
There is a clear trend that compilers are getting stricter.  Wouldn't
be surprised if -Wstrict-prototypes becomes the default in GCC at some
point.  I also have the feeling that in a couple of years somebody
will come along and argue to switch things back.

Does gcc3 support -Wimplict-function-declaration?  How about clang?

> Index: alpha/conf/Makefile.alpha
> ===================================================================
> RCS file: /cvs/src/sys/arch/alpha/conf/Makefile.alpha,v
> retrieving revision 1.85
> diff -u -p -r1.85 Makefile.alpha
> --- alpha/conf/Makefile.alpha 18 Nov 2014 01:17:36 -0000      1.85
> +++ alpha/conf/Makefile.alpha 8 Jan 2015 23:48:11 -0000
> @@ -23,7 +23,7 @@ _archdir?=  $S/arch/${_arch}
>  
>  INCLUDES=    -nostdinc -I$S -I. -I$S/arch
>  CPPFLAGS=    ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -MD -MP
> -CWARNFLAGS=  -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes \
> +CWARNFLAGS=  -Werror -Wall -Wimplicit-function-declaration \
>               -Wno-main -Wno-uninitialized \
>               -Wframe-larger-than=2047
>  
> Index: amd64/conf/Makefile.amd64
> ===================================================================
> RCS file: /cvs/src/sys/arch/amd64/conf/Makefile.amd64,v
> retrieving revision 1.63
> diff -u -p -r1.63 Makefile.amd64
> --- amd64/conf/Makefile.amd64 18 Nov 2014 01:11:13 -0000      1.63
> +++ amd64/conf/Makefile.amd64 8 Jan 2015 23:43:30 -0000
> @@ -23,7 +23,7 @@ _archdir?=  $S/arch/${_arch}
>  
>  INCLUDES=    -nostdinc -I$S -I. -I$S/arch
>  CPPFLAGS=    ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -MD -MP
> -CWARNFLAGS=  -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes \
> +CWARNFLAGS=  -Werror -Wall -Wimplicit-function-declaration \
>               -Wno-main -Wno-uninitialized \
>               -Wframe-larger-than=2047
>  
> Index: armish/conf/Makefile.armish
> ===================================================================
> RCS file: /cvs/src/sys/arch/armish/conf/Makefile.armish,v
> retrieving revision 1.49
> diff -u -p -r1.49 Makefile.armish
> --- armish/conf/Makefile.armish       4 Oct 2014 18:10:14 -0000       1.49
> +++ armish/conf/Makefile.armish       8 Jan 2015 23:48:33 -0000
> @@ -23,7 +23,7 @@ _archdir?=  $S/arch/${_arch}
>  
>  INCLUDES=    -nostdinc -I$S -I. -I$S/arch
>  CPPFLAGS=    ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -D__${_mach}__ -MD -MP
> -CWARNFLAGS=  -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes \
> +CWARNFLAGS=  -Werror -Wall -Wimplicit-function-declaration \
>               -Wno-main -Wno-uninitialized \
>               -Wframe-larger-than=2047
>  
> Index: armv7/conf/Makefile.armv7
> ===================================================================
> RCS file: /cvs/src/sys/arch/armv7/conf/Makefile.armv7,v
> retrieving revision 1.5
> diff -u -p -r1.5 Makefile.armv7
> --- armv7/conf/Makefile.armv7 4 Oct 2014 18:10:14 -0000       1.5
> +++ armv7/conf/Makefile.armv7 8 Jan 2015 23:48:37 -0000
> @@ -23,7 +23,7 @@ _archdir?=  $S/arch/${_arch}
>  
>  INCLUDES=    -nostdinc -I$S -I. -I$S/arch
>  CPPFLAGS=    ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -D__${_mach}__ -MD -MP
> -CWARNFLAGS=  -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes \
> +CWARNFLAGS=  -Werror -Wall -Wimplicit-function-declaration \
>               -Wno-main -Wno-uninitialized \
>               -Wframe-larger-than=2047
>  
> Index: aviion/conf/Makefile.aviion
> ===================================================================
> RCS file: /cvs/src/sys/arch/aviion/conf/Makefile.aviion,v
> retrieving revision 1.49
> diff -u -p -r1.49 Makefile.aviion
> --- aviion/conf/Makefile.aviion       18 Nov 2014 01:17:36 -0000      1.49
> +++ aviion/conf/Makefile.aviion       8 Jan 2015 23:48:41 -0000
> @@ -23,7 +23,7 @@ _archdir?=  $S/arch/${_arch}
>  
>  INCLUDES=    -nostdinc -I$S -I. -I$S/arch
>  CPPFLAGS=    ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -D__${_mach}__ -MD -MP
> -CWARNFLAGS=  -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes \
> +CWARNFLAGS=  -Werror -Wall -Wimplicit-function-declaration \
>               -Wno-main -Wno-uninitialized \
>               -Wframe-larger-than=2047
>  
> Index: hppa/conf/Makefile.hppa
> ===================================================================
> RCS file: /cvs/src/sys/arch/hppa/conf/Makefile.hppa,v
> retrieving revision 1.78
> diff -u -p -r1.78 Makefile.hppa
> --- hppa/conf/Makefile.hppa   18 Nov 2014 01:17:36 -0000      1.78
> +++ hppa/conf/Makefile.hppa   8 Jan 2015 23:48:45 -0000
> @@ -23,7 +23,7 @@ _archdir?=  $S/arch/${_arch}
>  
>  INCLUDES=    -nostdinc -I$S -I. -I$S/arch
>  CPPFLAGS=    ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -MD -MP
> -CWARNFLAGS=  -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes \
> +CWARNFLAGS=  -Werror -Wall -Wimplicit-function-declaration \
>               -Wno-main -Wno-uninitialized \
>               -Wframe-larger-than=2047
>  
> Index: hppa64/conf/Makefile.hppa64
> ===================================================================
> RCS file: /cvs/src/sys/arch/hppa64/conf/Makefile.hppa64,v
> retrieving revision 1.50
> diff -u -p -r1.50 Makefile.hppa64
> --- hppa64/conf/Makefile.hppa64       18 Nov 2014 01:17:36 -0000      1.50
> +++ hppa64/conf/Makefile.hppa64       8 Jan 2015 23:48:47 -0000
> @@ -23,7 +23,7 @@ _archdir?=  $S/arch/${_arch}
>  
>  INCLUDES=    -nostdinc -I$S -I. -I$S/arch
>  CPPFLAGS=    ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -MD -MP
> -CWARNFLAGS=  -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes \
> +CWARNFLAGS=  -Werror -Wall -Wimplicit-function-declaration \
>               -Wno-main -Wno-uninitialized \
>               -Wframe-larger-than=2047
>  
> Index: i386/conf/Makefile.i386
> ===================================================================
> RCS file: /cvs/src/sys/arch/i386/conf/Makefile.i386,v
> retrieving revision 1.90
> diff -u -p -r1.90 Makefile.i386
> --- i386/conf/Makefile.i386   4 Oct 2014 18:10:14 -0000       1.90
> +++ i386/conf/Makefile.i386   8 Jan 2015 23:48:52 -0000
> @@ -23,7 +23,7 @@ _archdir?=  $S/arch/${_arch}
>  
>  INCLUDES=    -nostdinc -I$S -I. -I$S/arch
>  CPPFLAGS=    ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -MD -MP
> -CWARNFLAGS=  -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes \
> +CWARNFLAGS=  -Werror -Wall -Wimplicit-function-declaration \
>               -Wno-main -Wno-uninitialized \
>               -Wframe-larger-than=2047
>  
> Index: landisk/conf/Makefile.landisk
> ===================================================================
> RCS file: /cvs/src/sys/arch/landisk/conf/Makefile.landisk,v
> retrieving revision 1.51
> diff -u -p -r1.51 Makefile.landisk
> --- landisk/conf/Makefile.landisk     4 Oct 2014 18:10:14 -0000       1.51
> +++ landisk/conf/Makefile.landisk     8 Jan 2015 23:48:55 -0000
> @@ -23,7 +23,7 @@ _archdir?=  $S/arch/${_arch}
>  
>  INCLUDES=    -nostdinc -I$S -I. -I$S/arch
>  CPPFLAGS=    ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -D__${_mach}__ -MD -MP
> -CWARNFLAGS=  -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes \
> +CWARNFLAGS=  -Werror -Wall -Wimplicit-function-declaration \
>               -Wno-main -Wno-uninitialized \
>               -Wframe-larger-than=2047
>  
> Index: loongson/conf/Makefile.loongson
> ===================================================================
> RCS file: /cvs/src/sys/arch/loongson/conf/Makefile.loongson,v
> retrieving revision 1.43
> diff -u -p -r1.43 Makefile.loongson
> --- loongson/conf/Makefile.loongson   18 Nov 2014 01:17:37 -0000      1.43
> +++ loongson/conf/Makefile.loongson   8 Jan 2015 23:48:59 -0000
> @@ -30,7 +30,7 @@ _archdir?=  $S/arch/${_arch}
>  
>  INCLUDES=    -nostdinc -I$S -I. -I$S/arch
>  CPPFLAGS=    ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -D__${_mach}__ -MD -MP
> -CWARNFLAGS=  -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes \
> +CWARNFLAGS=  -Werror -Wall -Wimplicit-function-declaration \
>               -Wno-main -Wno-uninitialized \
>               -Wframe-larger-than=2047
>  
> Index: luna88k/conf/Makefile.luna88k
> ===================================================================
> RCS file: /cvs/src/sys/arch/luna88k/conf/Makefile.luna88k,v
> retrieving revision 1.57
> diff -u -p -r1.57 Makefile.luna88k
> --- luna88k/conf/Makefile.luna88k     18 Nov 2014 01:17:37 -0000      1.57
> +++ luna88k/conf/Makefile.luna88k     8 Jan 2015 23:49:06 -0000
> @@ -23,7 +23,7 @@ _archdir?=  $S/arch/${_arch}
>  
>  INCLUDES=    -nostdinc -I$S -I. -I$S/arch
>  CPPFLAGS=    ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -D__${_mach}__ -MD -MP
> -CWARNFLAGS=  -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes \
> +CWARNFLAGS=  -Werror -Wall -Wimplicit-function-declaration \
>               -Wno-main -Wno-uninitialized \
>               -Wframe-larger-than=2047
>  
> Index: macppc/conf/Makefile.macppc
> ===================================================================
> RCS file: /cvs/src/sys/arch/macppc/conf/Makefile.macppc,v
> retrieving revision 1.69
> diff -u -p -r1.69 Makefile.macppc
> --- macppc/conf/Makefile.macppc       4 Oct 2014 18:10:14 -0000       1.69
> +++ macppc/conf/Makefile.macppc       8 Jan 2015 23:49:10 -0000
> @@ -23,7 +23,7 @@ _archdir?=  $S/arch/${_arch}
>  
>  INCLUDES=    -nostdinc -I$S -I. -I$S/arch
>  CPPFLAGS=    ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -D__${_mach}__ -MD -MP
> -CWARNFLAGS=  -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes \
> +CWARNFLAGS=  -Werror -Wall -Wimplicit-function-declaration \
>               -Wno-main -Wno-uninitialized \
>               -Wframe-larger-than=2047
>  
> Index: octeon/conf/Makefile.octeon
> ===================================================================
> RCS file: /cvs/src/sys/arch/octeon/conf/Makefile.octeon,v
> retrieving revision 1.19
> diff -u -p -r1.19 Makefile.octeon
> --- octeon/conf/Makefile.octeon       18 Nov 2014 01:17:37 -0000      1.19
> +++ octeon/conf/Makefile.octeon       8 Jan 2015 23:49:14 -0000
> @@ -30,7 +30,7 @@ _archdir?=  $S/arch/${_arch}
>  
>  INCLUDES=    -nostdinc -I$S -I. -I$S/arch
>  CPPFLAGS=    ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -D__${_mach}__ -MD -MP
> -CWARNFLAGS=  -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes \
> +CWARNFLAGS=  -Werror -Wall -Wimplicit-function-declaration \
>               -Wno-main -Wno-uninitialized \
>               -Wframe-larger-than=2047
>  
> Index: sgi/conf/Makefile.sgi
> ===================================================================
> RCS file: /cvs/src/sys/arch/sgi/conf/Makefile.sgi,v
> retrieving revision 1.67
> diff -u -p -r1.67 Makefile.sgi
> --- sgi/conf/Makefile.sgi     18 Nov 2014 01:17:37 -0000      1.67
> +++ sgi/conf/Makefile.sgi     8 Jan 2015 23:49:18 -0000
> @@ -30,7 +30,7 @@ _archdir?=  $S/arch/${_arch}
>  
>  INCLUDES=    -nostdinc -I$S -I. -I$S/arch
>  CPPFLAGS=    ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -D__${_mach}__ -MD -MP
> -CWARNFLAGS=  -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes \
> +CWARNFLAGS=  -Werror -Wall -Wimplicit-function-declaration \
>               -Wno-main -Wno-uninitialized \
>               -Wframe-larger-than=2047
>  
> Index: socppc/conf/Makefile.socppc
> ===================================================================
> RCS file: /cvs/src/sys/arch/socppc/conf/Makefile.socppc,v
> retrieving revision 1.40
> diff -u -p -r1.40 Makefile.socppc
> --- socppc/conf/Makefile.socppc       4 Oct 2014 18:10:14 -0000       1.40
> +++ socppc/conf/Makefile.socppc       8 Jan 2015 23:49:26 -0000
> @@ -23,7 +23,7 @@ _archdir?=  $S/arch/${_arch}
>  
>  INCLUDES=    -nostdinc -I$S -I. -I$S/arch
>  CPPFLAGS=    ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -D__${_mach}__ -MD -MP
> -CWARNFLAGS=  -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes \
> +CWARNFLAGS=  -Werror -Wall -Wimplicit-function-declaration \
>               -Wno-main -Wno-uninitialized \
>               -Wframe-larger-than=2047
>  
> Index: solbourne/conf/Makefile.solbourne
> ===================================================================
> RCS file: /cvs/src/sys/arch/solbourne/conf/Makefile.solbourne,v
> retrieving revision 1.45
> diff -u -p -r1.45 Makefile.solbourne
> --- solbourne/conf/Makefile.solbourne 18 Nov 2014 01:17:37 -0000      1.45
> +++ solbourne/conf/Makefile.solbourne 8 Jan 2015 23:49:29 -0000
> @@ -23,7 +23,7 @@ _archdir?=  $S/arch/${_arch}
>  
>  INCLUDES=    -nostdinc -I$S -I. -I$S/arch
>  CPPFLAGS=    ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -D__${_mach}__ -MD -MP
> -CWARNFLAGS=  -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes \
> +CWARNFLAGS=  -Werror -Wall -Wimplicit-function-declaration \
>               -Wno-main -Wno-uninitialized \
>               -Wframe-larger-than=2047
>  
> Index: sparc/conf/Makefile.sparc
> ===================================================================
> RCS file: /cvs/src/sys/arch/sparc/conf/Makefile.sparc,v
> retrieving revision 1.82
> diff -u -p -r1.82 Makefile.sparc
> --- sparc/conf/Makefile.sparc 18 Nov 2014 01:17:37 -0000      1.82
> +++ sparc/conf/Makefile.sparc 8 Jan 2015 23:49:34 -0000
> @@ -23,7 +23,7 @@ _archdir?=  $S/arch/${_arch}
>  
>  INCLUDES=    -nostdinc -I$S -I. -I$S/arch
>  CPPFLAGS=    ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -MD -MP
> -CWARNFLAGS=  -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes \
> +CWARNFLAGS=  -Werror -Wall -Wimplicit-function-declaration \
>               -Wno-main -Wno-uninitialized \
>               -Wframe-larger-than=2047
>  
> Index: sparc64/conf/Makefile.sparc64
> ===================================================================
> RCS file: /cvs/src/sys/arch/sparc64/conf/Makefile.sparc64,v
> retrieving revision 1.70
> diff -u -p -r1.70 Makefile.sparc64
> --- sparc64/conf/Makefile.sparc64     18 Nov 2014 01:17:37 -0000      1.70
> +++ sparc64/conf/Makefile.sparc64     8 Jan 2015 23:49:37 -0000
> @@ -23,7 +23,7 @@ _archdir?=  $S/arch/${_arch}
>  
>  INCLUDES=    -nostdinc -I$S -I. -I$S/arch
>  CPPFLAGS=    ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -MD -MP
> -CWARNFLAGS=  -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes \
> +CWARNFLAGS=  -Werror -Wall -Wimplicit-function-declaration \
>               -Wno-main -Wno-uninitialized \
>               -Wframe-larger-than=2047
>  
> Index: vax/conf/Makefile.vax
> ===================================================================
> RCS file: /cvs/src/sys/arch/vax/conf/Makefile.vax,v
> retrieving revision 1.72
> diff -u -p -r1.72 Makefile.vax
> --- vax/conf/Makefile.vax     4 Oct 2014 18:10:14 -0000       1.72
> +++ vax/conf/Makefile.vax     8 Jan 2015 23:49:41 -0000
> @@ -23,7 +23,7 @@ _archdir?=  $S/arch/${_arch}
>  
>  INCLUDES=    -nostdinc -I$S -I. -I$S/arch
>  CPPFLAGS=    ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -MD -MP
> -CWARNFLAGS=  -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes \
> +CWARNFLAGS=  -Werror -Wall -Wimplicit-function-declaration \
>               -Wno-main -Wno-uninitialized \
>               -Wframe-larger-than=2047
>  
> Index: zaurus/conf/Makefile.zaurus
> ===================================================================
> RCS file: /cvs/src/sys/arch/zaurus/conf/Makefile.zaurus,v
> retrieving revision 1.52
> diff -u -p -r1.52 Makefile.zaurus
> --- zaurus/conf/Makefile.zaurus       4 Oct 2014 18:10:15 -0000       1.52
> +++ zaurus/conf/Makefile.zaurus       8 Jan 2015 23:49:47 -0000
> @@ -23,7 +23,7 @@ _archdir?=  $S/arch/${_arch}
>  
>  INCLUDES=    -nostdinc -I$S -I. -I$S/arch
>  CPPFLAGS=    ${INCLUDES} ${IDENT} ${PARAM} -D_KERNEL -D__${_mach}__ -MD -MP
> -CWARNFLAGS=  -Werror -Wall -Wstrict-prototypes -Wmissing-prototypes \
> +CWARNFLAGS=  -Werror -Wall -Wimplicit-function-declaration \
>               -Wno-main -Wno-uninitialized \
>               -Wframe-larger-than=2047
>  
> 
> 

Reply via email to