From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14846 invoked by alias); 3 Mar 2002 21:20:07 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Received: (qmail 14797 invoked from network); 3 Mar 2002 21:20:07 -0000 Received: from unknown (HELO itdomain003.itdomain.net.au) (203.63.157.208) by sources.redhat.com with SMTP; 3 Mar 2002 21:20:07 -0000 content-class: urn:content-classes:message Subject: RE: w32api bugfix (was: Currently, CVS setup.exe does not compile, due to warnings with 'warnings as errors' in effect. How best to change code to avoid warnings?) Date: Sun, 03 Mar 2002 13:20:00 -0000 MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: quoted-printable Message-ID: X-MimeOLE: Produced By Microsoft Exchange V6.0.5762.3 X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: w32api bugfix (was: Currently, CVS setup.exe does not compile, due to warnings with 'warnings as errors' in effect. How best to change code to avoid warnings?) Thread-Index: AcHC3YOL0GVvxCDRToyKVVxNYIn0GwAGxp7Q From: "Robert Collins" To: "Max Bowsher" , X-SW-Source: 2002-03/txt/msg00137.txt.bz2 > -----Original Message----- > From: Max Bowsher [mailto:maxb@ukf.net]=20 > Sent: Sunday, March 03, 2002 9:36 PM > To: cygwin@cygwin.com > Subject: w32api bugfix (was: Currently, CVS setup.exe does=20 > not compile, due to warnings with 'warnings as errors' in=20 > effect. How best to change code to avoid warnings?) >=20 >=20 > > Hmm, does C++ support the same feature? If not then an ifdef=20 > > __cplusplus might do it. >=20 > Unfortunately not - the problem is the differing=20 > interpretation of the line 'typedef int (WINAPI *FARPROC)();'=20 > in 3 sets of circumstances: >=20 > 1) C++ > 'int proc();' and 'int proc(void);' are synonyms. No problem. Does the error trigger under g++ ? IIRC your original post correctly, it does. If so, then gcc's warning is flawed. =20 > 2) C, -Wstrict-prototypes NOT in effect > 'int proc();' means: use no compiler type checking=20 > for the parameters if proc > 'int proc(void);' means: proc takes no parameters Ah, this is the killer then. Do we actually hit this during a C file compilation? We've only a couple of C files - autoload and mklink2. I wonder if we can detect that -Wstrict-prototypes is on in the header - something like #if !pramga(strict-on) || defined (_cplusplus) ... #endif =20 > Summary: > The construct 'typedef int (WINAPI *FARPROC)();' in w32api=20 > causes an error with -Wstrict-prototypes -Werror. This can be=20 > worked around by adding 'void' in the empty brackets. > Downside: > This breaks C code where people were using the w32api types=20 > FARPROC, NEARPROC, PROC, to call procedures without=20 > typechecking the arguments. I think this is totally=20 > irrelevant, as deliberately bypassing the compiler type=20 > checking is very silly, and I doubt anyone does that anymore. =20 Actually, they do. Someone turned the (void) off again after I'd put it in there because the X code needed it. > Anyway, before I go submitting a patch which breaks backward=20 > compatibility, even in such a rare and unused case, I want to=20 > raise this issue here. Thank you. Rob -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/