Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 16 Apr 1995 05:11:59 +1000
From:      Bruce Evans <bde@zeta.org.au>
To:        jkh@freefall.cdrom.com, joerg_wunsch@uriah.heep.sax.de
Cc:        freebsd-hackers@FreeBSD.org
Subject:   Re: 90's compilers
Message-ID:  <199504151911.FAA00626@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>I've always stayed neutral on the whole KNF issue as it's not all that
>important to me what style code is formatted to, just so long as it's
>self-consistent.  However, I do feel that full prototypes are no
 ^^^^^^^^^^^^^^^                           ^^^^^^^^^^^^^^^^^^^^^^
>longer optional and furthermore hate constructs of the form:
 ^^^^^^^^^^^^^^^

Unfortunately there is too much old code out there to do everything
consistently and right.  E.g., compiling dmenu with full ANSI and
other warnings:

exec gcc \
	-Wall -ansi -pedantic \
	-Wbad-function-cast \
	-Wcast-align \
	-Wchar-subscripts \
	-Wconversion \
	-Winline \
	-Wnested-externs \
	-Wpointer-arith \
	-Wredundant-decls \
	-Wshadow \
	-Wstrict-prototypes \
	-Wtraditional \
	$*
(oops, I forget these:
# -Wmissing-declarations
# -Waggregate-return -Wcast-qual -Wwrite-strings
# -Wmissing-prototypes)

Produces a few warnings for the new code and too many warnings for old
code:

/usr/src/usr.bin/dmenu/strsed.c:3: warning: text following `#endif' violates ANSI standard
/usr/src/usr.bin/dmenu/strsed.c:136: warning: function declaration isn't a prototype
/usr/src/usr.bin/dmenu/strsed.c: In function `strsed':
/usr/src/usr.bin/dmenu/strsed.c:140: warning: function declaration isn't a prototype
/usr/src/usr.bin/dmenu/strsed.c:140: warning: nested extern declaration of `realloc'
/usr/src/usr.bin/dmenu/strsed.c:141: warning: function declaration isn't a prototype
/usr/src/usr.bin/dmenu/strsed.c:141: warning: nested extern declaration of `strdup'
/usr/src/usr.bin/dmenu/strsed.c:141: warning: redundant redeclaration of `strdup' in same scope
/usr/include/string.h:85: warning: previous declaration of `strdup'
/usr/src/usr.bin/dmenu/strsed.c:142: warning: function declaration isn't a prototype
/usr/src/usr.bin/dmenu/strsed.c:142: warning: nested extern declaration of `free'
/usr/src/usr.bin/dmenu/strsed.c:155: warning: function declaration isn't a prototype
/usr/src/usr.bin/dmenu/strsed.c:155: warning: nested extern declaration of `backslash_eliminate'
/usr/src/usr.bin/dmenu/strsed.c:156: warning: function declaration isn't a prototype
/usr/src/usr.bin/dmenu/strsed.c:156: warning: invalid storage class for function `mem'
/usr/src/usr.bin/dmenu/strsed.c:156: warning: nested extern declaration of `mem'
/usr/src/usr.bin/dmenu/strsed.c:157: warning: function declaration isn't a prototype
/usr/src/usr.bin/dmenu/strsed.c:157: warning: invalid storage class for function `mem_init'
/usr/src/usr.bin/dmenu/strsed.c:157: warning: nested extern declaration of `mem_init'
/usr/src/usr.bin/dmenu/strsed.c:158: warning: function declaration isn't a prototype
/usr/src/usr.bin/dmenu/strsed.c:158: warning: invalid storage class for function `mem_free'
/usr/src/usr.bin/dmenu/strsed.c:158: warning: nested extern declaration of `mem_free'
/usr/src/usr.bin/dmenu/strsed.c:190: warning: unused variable `i'
/usr/src/usr.bin/dmenu/strsed.c:440: warning: unused variable `i'
/usr/src/usr.bin/dmenu/strsed.c:468: warning: function declaration isn't a prototype
/usr/src/usr.bin/dmenu/strsed.c:468: warning: nested extern declaration of `malloc'
/usr/src/usr.bin/dmenu/strsed.c:469: warning: pointer targets in assignment differ in signedness
/usr/src/usr.bin/dmenu/strsed.c:580: warning: passing arg 3 of `strncpy' as unsigned due to prototype
/usr/src/usr.bin/dmenu/strsed.c:611: warning: function declaration isn't a prototype
/usr/src/usr.bin/dmenu/strsed.c:611: warning: invalid storage class for function `build_map'
/usr/src/usr.bin/dmenu/strsed.c:611: warning: nested extern declaration of `build_map'
/usr/src/usr.bin/dmenu/strsed.c:632: warning: array subscript has type `char'
/usr/src/usr.bin/dmenu/strsed.c: At top level:
/usr/src/usr.bin/dmenu/strsed.c:683: warning: function declaration isn't a prototype
/usr/src/usr.bin/dmenu/strsed.c: In function `backslash_eliminate':
/usr/src/usr.bin/dmenu/strsed.c:732: warning: function declaration isn't a prototype
/usr/src/usr.bin/dmenu/strsed.c:732: warning: invalid storage class for function `mem'
/usr/src/usr.bin/dmenu/strsed.c:732: warning: nested extern declaration of `mem'
/usr/src/usr.bin/dmenu/strsed.c: At top level:
/usr/src/usr.bin/dmenu/strsed.c:1004: warning: function declaration isn't a prototype
/usr/src/usr.bin/dmenu/strsed.c: In function `build_map':
/usr/src/usr.bin/dmenu/strsed.c:1032: warning: function declaration isn't a prototype
/usr/src/usr.bin/dmenu/strsed.c:1032: warning: invalid storage class for function `mem'
/usr/src/usr.bin/dmenu/strsed.c:1032: warning: nested extern declaration of `mem'
/usr/src/usr.bin/dmenu/strsed.c:1033: warning: function declaration isn't a prototype
/usr/src/usr.bin/dmenu/strsed.c:1033: warning: invalid storage class for function `nextch'
/usr/src/usr.bin/dmenu/strsed.c:1033: warning: nested extern declaration of `nextch'
/usr/src/usr.bin/dmenu/strsed.c:1044: warning: passing arg 3 of `strncmp' as unsigned due to prototype
/usr/src/usr.bin/dmenu/strsed.c:1028: warning: `out' might be used uninitialized in this function
/usr/src/usr.bin/dmenu/strsed.c: At top level:
/usr/src/usr.bin/dmenu/strsed.c:1153: warning: function declaration isn't a prototype
/usr/src/usr.bin/dmenu/strsed.c:1274: warning: function declaration isn't a prototype
/usr/src/usr.bin/dmenu/strsed.c: In function `mem':
/usr/src/usr.bin/dmenu/strsed.c:1287: warning: function declaration isn't a prototype
/usr/src/usr.bin/dmenu/strsed.c:1287: warning: invalid storage class for function `mem_save'
/usr/src/usr.bin/dmenu/strsed.c:1287: warning: nested extern declaration of `mem_save'
/usr/src/usr.bin/dmenu/strsed.c:1288: warning: function declaration isn't a prototype
/usr/src/usr.bin/dmenu/strsed.c:1288: warning: nested extern declaration of `malloc'
/usr/src/usr.bin/dmenu/strsed.c:1325: warning: function declaration isn't a prototype
/usr/src/usr.bin/dmenu/strsed.c:1325: warning: invalid storage class for function `mem_find'
/usr/src/usr.bin/dmenu/strsed.c:1325: warning: nested extern declaration of `mem_find'
/usr/src/usr.bin/dmenu/strsed.c: At top level:
/usr/src/usr.bin/dmenu/strsed.c:1352: warning: function declaration isn't a prototype
/usr/src/usr.bin/dmenu/strsed.c:1371: warning: function declaration isn't a prototype
/usr/src/usr.bin/dmenu/strsed.c: In function `mem_save':
/usr/src/usr.bin/dmenu/strsed.c:1383: warning: function declaration isn't a prototype
/usr/src/usr.bin/dmenu/strsed.c:1383: warning: nested extern declaration of `free'
/usr/src/usr.bin/dmenu/strsed.c: At top level:
/usr/src/usr.bin/dmenu/strsed.c:1434: warning: function declaration isn't a prototype
/usr/src/usr.bin/dmenu/strsed.c:1449: warning: function declaration isn't a prototype
/usr/src/usr.bin/dmenu/strsed.c:2: warning: `rcsid' defined but not used

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199504151911.FAA00626>