[[[ To any NSA and FBI agents reading my email: please consider]]]
[[[ whether defending the US Constitution against all enemies, ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]
> It's given me useful warnings on several occasions while developing. I did
not
Richard Stallman wrote:
How many useful warnings has that option given us?
It's given me useful warnings on several occasions while developing. I did not
count how many.
[[[ To any NSA and FBI agents reading my email: please consider]]]
[[[ whether defending the US Constitution against all enemies, ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]
> GCC 8.1 and later have a new -Wcast-function-type warning (which is
> useful, a
[[[ To any NSA and FBI agents reading my email: please consider]]]
[[[ whether defending the US Constitution against all enemies, ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]
> Avoid -Wcast-function-type warnings from casts after GetProcAddress.
On Sun, Aug 19, 2018 at 4:26 AM Bruno Haible wrote:
> Indeed, casting through (void *) or (void (*) (void)) avoids the
> warning.
I seem to remember C does not guarantee that pointers to functions
must survive casting through void*. It does for casting between
function pointer types. So casting
Yuri Khan wrote:
> > Indeed, casting through (void *) or (void (*) (void)) avoids the
> > warning.
>
> I seem to remember C does not guarantee that pointers to functions
> must survive casting through void*.
Yes, on some old architectures like Windows 3.1 a function pointer and
a 'void *' had dif
> From: Bruno Haible
> Cc: bug-gnulib@gnu.org, egg...@cs.ucla.edu, andrewjmore...@gmail.com,
> emacs-de...@gnu.org
> Date: Sun, 19 Aug 2018 02:17:52 +0200
>
> > diff --git a/lib/gettimeofday.c b/lib/gettimeofday.c
> > index bff40d7..36b5074 100644
> > --- a/lib/gettimeofday.c
> > +++ b/lib/getti
> diff --git a/lib/gettimeofday.c b/lib/gettimeofday.c
> index bff40d7..36b5074 100644
> --- a/lib/gettimeofday.c
> +++ b/lib/gettimeofday.c
> @@ -33,6 +33,10 @@
>
> #ifdef WINDOWS_NATIVE
>
> +/* Avoid warnings from gcc -Wcast-function-type. */
> +# define GetProcAddress \
> + (void *) GetP
Eli Zaretskii wrote:
> There's also this additional option:
>
> 5) Cast through (void *). Like this:
>
> GetSystemTimePreciseAsFileTimeFunc =
> (GetSystemTimePreciseAsFileTimeFuncType) (void (*) (void))
> GetProcAddress (kernel32, "GetSystemTimePreciseAsFileTime");
Indeed, cast
Eli Zaretskii wrote:
I urge you to reconsider and use the same technique we used in the
Emacs sources to shut up this warning. There's no reason Gnulib
cannot use that technique.
Is this the void (*) (void) cast that Andy just mentioned, or some other
technique? Sorry, I've lost some context
> Cc: br...@clisp.org, bug-gnulib@gnu.org, andrewjmore...@gmail.com,
> emacs-de...@gnu.org
> From: Paul Eggert
> Date: Sat, 18 Aug 2018 11:59:03 -0700
>
> Eli Zaretskii wrote:
> > There's no need to disable this warning at all.
>
> I thought the problem was that people were using -Werror on MS-
Eli Zaretskii wrote:
There's no need to disable this warning at all.
I thought the problem was that people were using -Werror on MS-Windows and that
builds were failing. If that's not the case, then we can simply go with Bruno's
option (4), i.e., live with the warning.
> From: Paul Eggert
> Date: Sat, 18 Aug 2018 10:19:54 -0700
> Cc: Andy Moreton , emacs-de...@gnu.org
>
> Bruno Haible wrote:
> > This code uses GetProcAddress so that it can exploit
> > features of newer Windows versions while at the same time still
> > work on older Windows versions.
>
> Can th
> From: Bruno Haible
> Date: Sat, 18 Aug 2018 18:09:27 +0200
> Cc: Paul Eggert , Andy Moreton ,
> emacs-de...@gnu.org
>
> 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-fu
Paul Eggert wrote:
> Can this problem be addressed a bit better by using GetProcAddress only
> inside
> #ifndef HAVE_GETSYSTEMTIMEPRECISEASFILETIME code on builds for MS-Windows 7
> and
> earlier, and directly using GetSystemTimePreciseAsFileTime on builds for
> MS-Windows 8 and later?
I don'
Bruno Haible wrote:
This code uses GetProcAddress so that it can exploit
features of newer Windows versions while at the same time still
work on older Windows versions.
Can this problem be addressed a bit better by using GetProcAddress only inside
#ifndef HAVE_GETSYSTEMTIMEPRECISEASFILETIME co
> > There is also one function cast warning from gnulib code:
> > C:/emacs/git/emacs/master/lib/gettimeofday.c: In function 'initialize':
> > C:/emacs/git/emacs/master/lib/gettimeofday.c:48:9: warning: cast between
> > incompatible function types from 'FARPROC' {aka 'long long int (*)()'} to
> >
Ping!
> From: Paul Eggert
> Date: Tue, 14 Aug 2018 15:32:44 -0700
> Cc: emacs-de...@gnu.org
>
> On 08/14/2018 02:20 PM, Andy Moreton wrote:
> > There is also one function cast warning from gnulib code:
> > C:/emacs/git/emacs/master/lib/gettimeofday.c: In function 'initialize':
> > C:/emacs/git/e
On 08/14/2018 02:20 PM, Andy Moreton wrote:
There is also one function cast warning from gnulib code:
C:/emacs/git/emacs/master/lib/gettimeofday.c: In function 'initialize':
C:/emacs/git/emacs/master/lib/gettimeofday.c:48:9: warning: cast between
incompatible function types from 'FARPROC' {aka '
19 matches
Mail list logo