[schilytools] RFC: removal of K&R-style declarations
Dennis Clarke
dclarke at blastwave.org
Thu Apr 25 21:38:27 CEST 2024
On 4/9/24 12:05, Robert Clausecker wrote:
> Greetings,
>
> Large parts of the schilytools code base have carefully been designed to
> support compilation with pre-ANSI C compilers. This means that function
> declarations employ the __PR macro to only generate prototypes if
> supported, while function definitions are in K&R style unless the code is
> only for platforms that support ANSI C or if it's a varargs function.
>
> This is slowly becoming a liability. K&R-style definitions have been
> phased out of the C standard for a while and are not supported anymore.
> Compilers like clang have started to warn about them and may no longer
> support them in the future. Some platforms (like aarch64 macOS) have
> different, less efficient calling conventions for K&R-style functions
> and may miscompile code that mixes and matches prototypes with K&R-style
> definitions. It is also well known that use of K&R-style definitions
> can hide bugs and protability issues that we should want out for.
>
> At the same time, few if any platforms with pre-ANSI compilers remain.
> And those that do remain are likely not to be targets to compile
> schilytools for.
>
Just a quick reply to let you know that I see loads of this :
niread.c:24:1: warning: a function definition without a prototype is
deprecated in all versions of C and is not supported in C2x
[-Wdeprecated-non-prototype]
_niread(f, buf, count)
This may be another opportunity for a K&R_rip_out_patch type thing.
--
Dennis Clarke
RISC-V/SPARC/PPC/ARM/CISC
UNIX and Linux spoken
More information about the schilytools
mailing list