bug-inetutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

maint: Fix most instances of '-Wstrict-prototypes'.


From: Collin Funk
Subject: maint: Fix most instances of '-Wstrict-prototypes'.
Date: Thu, 9 May 2024 19:14:59 -0700
User-agent: Mozilla Thunderbird

Hi,

I've pushed this patch already because it seems pretty
uncontroversial.

Basically converting some K&R functions to ISO C and not using empty
argument lists:

     /* Bad.  */
     void do_something ();
     extern char *getenv ();

     vs.

     /* Good.  */
     void do_something (void);
     extern char *getenv (const char *);

Since the first example will cause problems in C23. There are still a
few function pointers that need to be fixed. For example this idiom in
telnet:

    struct encryptlist
    {  
      const char *name;
      const char *help;
      int (*handler) ();
      int needconnect;
      int minarg;
      int maxarg;
    };

Where handler can have multiple different prototypes. FreeBSD just
casts the function which is undefined behavior in ISO C, but *should*
be allowed by POSIX (see documentation for dlsym). I'll fix those
eventually and add a NEWS entry saying Inetutils can be compiled in
C23 mode for whenever there is a release.

Collin

Attachment: 0001-maint-Fix-most-instances-of-Wstrict-prototypes.patch
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]