[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: New warnings on emacs-26 branch with gcc 8.2.0
From: |
Andy Moreton |
Subject: |
Re: New warnings on emacs-26 branch with gcc 8.2.0 |
Date: |
Sat, 18 Aug 2018 20:07:20 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (windows-nt) |
On Sat 18 Aug 2018, Eli Zaretskii wrote:
>> From: Bruno Haible <address@hidden>
>> Date: Sat, 18 Aug 2018 18:09:27 +0200
>> Cc: Paul Eggert <address@hidden>, Andy Moreton <address@hidden>,
>> address@hidden
>>
>> So, there are 4 options:
>> 1) Use static reference to Windows API functions.
>> 2) Use '#pragma GCC diagnostic ignored "-Wcast-function-type"'
>> 3) Remove -Wcast-function-type from the compiler options.
>> 4) Live with the warning.
>>
>> I'm opposed to 1), since it removes either features or portability.
>>
>> I could do 2), but it does not feel like the right thing, to silence
>> a compiler warning when the user has explicitly requested a warning.
>>
>> So, please choose among 3) and 4).
>
> There's also this additional option:
>
> 5) Cast through (void *). Like this:
>
> GetSystemTimePreciseAsFileTimeFunc =
> (GetSystemTimePreciseAsFileTimeFuncType) (void (*) (void))
> GetProcAddress (kernel32, "GetSystemTimePreciseAsFileTime");
This is the sensible option. GetProcAddress returns FARPROC, so there is
no way of performing this cast correctly without some sort of type
mismatch.
The additional (void (*) (void)) cast deliberately suppresses the warning
in this case, which still allowing use of the warning to catch abuse of
function pointer types in other parts of the program.
AndyM
- Re: New warnings on emacs-26 branch with gcc 8.2.0, (continued)
- Re: New warnings on emacs-26 branch with gcc 8.2.0, Paul Eggert, 2018/08/14
- Re: New warnings on emacs-26 branch with gcc 8.2.0, Eli Zaretskii, 2018/08/17
- Re: New warnings on emacs-26 branch with gcc 8.2.0, Bruno Haible, 2018/08/18
- Re: New warnings on emacs-26 branch with gcc 8.2.0, Paul Eggert, 2018/08/18
- Re: New warnings on emacs-26 branch with gcc 8.2.0, Bruno Haible, 2018/08/18
- Re: New warnings on emacs-26 branch with gcc 8.2.0, Eli Zaretskii, 2018/08/18
- Re: New warnings on emacs-26 branch with gcc 8.2.0, Paul Eggert, 2018/08/18
- Re: New warnings on emacs-26 branch with gcc 8.2.0, Eli Zaretskii, 2018/08/18
- Re: New warnings on emacs-26 branch with gcc 8.2.0, Paul Eggert, 2018/08/18
- Re: New warnings on emacs-26 branch with gcc 8.2.0, Eli Zaretskii, 2018/08/18
- Re: New warnings on emacs-26 branch with gcc 8.2.0,
Andy Moreton <=
- Re: New warnings on emacs-26 branch with gcc 8.2.0, Bruno Haible, 2018/08/18
- Re: New warnings on emacs-26 branch with gcc 8.2.0, Bruno Haible, 2018/08/18
- Re: New warnings on emacs-26 branch with gcc 8.2.0, Eli Zaretskii, 2018/08/18
- Re: New warnings on emacs-26 branch with gcc 8.2.0, Yuri Khan, 2018/08/19
- Re: New warnings on emacs-26 branch with gcc 8.2.0, Bruno Haible, 2018/08/19
- Re: New warnings on emacs-26 branch with gcc 8.2.0, Richard Stallman, 2018/08/19
- Re: New warnings on emacs-26 branch with gcc 8.2.0, Andy Moreton, 2018/08/20
- Re: New warnings on emacs-26 branch with gcc 8.2.0, Richard Stallman, 2018/08/20
- Re: New warnings on emacs-26 branch with gcc 8.2.0, Paul Eggert, 2018/08/20
- Re: New warnings on emacs-26 branch with gcc 8.2.0, Richard Stallman, 2018/08/22