This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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?)


> Hmm, does C++ support the same feature? If not then an ifdef __cplusplus
> might do it.

> Rob

Unfortunately not - the problem is the differing interpretation of the line
'typedef int (WINAPI *FARPROC)();' in 3 sets of circumstances:

1) C++
        'int proc();' and 'int proc(void);' are synonyms. No problem.

2) C, -Wstrict-prototypes NOT in effect
        'int proc();' means: use no compiler type checking for the
parameters if proc
        'int proc(void);' means: proc takes no parameters

3) C, -Wstrict-prototypes in effect
        'int proc();' means: ditto AND causes a warning (which, since setup
is compiled with 'warnings as errors' on, stops the build)
        'int proc(void);' means: ditto

Summary:
The construct 'typedef int (WINAPI *FARPROC)();' in w32api causes an error
with -Wstrict-prototypes -Werror. This can be worked around by adding 'void'
in the empty brackets.
Downside:
This breaks C code where people were using the w32api types FARPROC,
NEARPROC, PROC, to call procedures without typechecking the arguments. I
think this is totally irrelevant, as deliberately bypassing the compiler
type checking is very silly, and I doubt anyone does that anymore.

Anyway, before I go submitting a patch which breaks backward compatibility,
even in such a rare and unused case, I want to raise this issue here.


Max.

Attachment: smime.p7s
Description: application/pkcs7-signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]