public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: "Max Bowsher" <maxb@ukf.net>
To: <cygwin@cygwin.com>
Subject: 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 10:01:00 -0000	[thread overview]
Message-ID: <002001c1c2dd$363aaae0$dda8883e@wdg.uk.ibm.com> (raw)
In-Reply-To: <FC169E059D1A0442A04C40F86D9BA76008AAF5@itdomain003.itdomain.net.au>

[-- Attachment #1: Type: text/plain, Size: 1342 bytes --]

> 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 #2: smime.p7s --]
[-- Type: application/x-pkcs7-signature, Size: 2688 bytes --]

  reply	other threads:[~2002-03-03 18:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-03-02 11:14 Currently, CVS setup.exe does not compile, due to warnings with 'warnings as errors' in effect. How best to change code to avoid warnings? Robert Collins
2002-03-03 10:01 ` Max Bowsher [this message]
2002-03-03 13:20 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?) Robert Collins
2002-03-04  2:09 Max Bowsher

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='002001c1c2dd$363aaae0$dda8883e@wdg.uk.ibm.com' \
    --to=maxb@ukf.net \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).