NetBSD-Bugs archive

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

Re: PR/57809



The following reply was made to PR lib/57809; it has been noted by GNATS.

From: RVP <rvp%SDF.ORG@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: PR/57809
Date: Tue, 27 May 2025 23:53:08 +0000 (UTC)

 On Mon, 26 May 2025, nia via gnats wrote:
 
 > You've added a cast,
 >
 
 Not a cast: assignment (which is what function parameter passing devolves to
 in ANSI C anyway...).
 
 > but the goal is to generate a compiler warning when the wrong pointer
 > type is used.
 >
 
 With my patch:
 
 ```
 $ cc -c pr.c
 pr.c: In function 'setup':
 pr.c:8:9: warning: initialization of 'fd_set *' from incompatible pointer type 'int *' [-Wincompatible-pointer-types]
      8 |         FD_ZERO(&readfd);
        |         ^~~~~~~
 
 $ cc -Werror -c pr.c
 pr.c: In function 'setup':
 pr.c:8:9: error: initialization of 'fd_set *' from incompatible pointer type 'int *' [-Werror=incompatible-pointer-types]
      8 |         FD_ZERO(&readfd);
        |         ^~~~~~~
 cc1: all warnings being treated as errors
 
 $
 ```
 
 this is what you wanted, right?
 
 -RVP
 


Home | Main Index | Thread Index | Old Index