Re: New warnings on emacs-26 branch with gcc 8.2.0

2018-08-21 Thread Richard Stallman
[[[ 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

Re: New warnings on emacs-26 branch with gcc 8.2.0

2018-08-20 Thread Paul Eggert
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.

Re: New warnings on emacs-26 branch with gcc 8.2.0

2018-08-20 Thread Richard Stallman
[[[ 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

Re: New warnings on emacs-26 branch with gcc 8.2.0

2018-08-19 Thread Richard Stallman
[[[ 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.

Re: New warnings on emacs-26 branch with gcc 8.2.0

2018-08-19 Thread Yuri Khan
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

Re: New warnings on emacs-26 branch with gcc 8.2.0

2018-08-19 Thread Bruno Haible
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

Re: New warnings on emacs-26 branch with gcc 8.2.0

2018-08-18 Thread Eli Zaretskii
> 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

Re: New warnings on emacs-26 branch with gcc 8.2.0

2018-08-18 Thread Bruno Haible
> 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

Re: New warnings on emacs-26 branch with gcc 8.2.0

2018-08-18 Thread Bruno Haible
Eli Zaretskii wrote: > There's also this additional option: > > 5) Cast through (void *). Like this: > > GetSystemTimePreciseAsFileTimeFunc = > (GetSystemTimePreciseAsFileTimeFuncType) (void (*) (void)) > GetProcAddress (kernel32, "GetSystemTimePreciseAsFileTime"); Indeed, cast

Re: New warnings on emacs-26 branch with gcc 8.2.0

2018-08-18 Thread Paul Eggert
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

Re: New warnings on emacs-26 branch with gcc 8.2.0

2018-08-18 Thread Eli Zaretskii
> 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-

Re: New warnings on emacs-26 branch with gcc 8.2.0

2018-08-18 Thread Paul Eggert
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.

Re: New warnings on emacs-26 branch with gcc 8.2.0

2018-08-18 Thread Eli Zaretskii
> 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

Re: New warnings on emacs-26 branch with gcc 8.2.0

2018-08-18 Thread Eli Zaretskii
> 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

Re: New warnings on emacs-26 branch with gcc 8.2.0

2018-08-18 Thread Bruno Haible
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'

Re: New warnings on emacs-26 branch with gcc 8.2.0

2018-08-18 Thread Paul Eggert
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

Re: New warnings on emacs-26 branch with gcc 8.2.0

2018-08-18 Thread Bruno Haible
> > 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 > >

Re: New warnings on emacs-26 branch with gcc 8.2.0

2018-08-17 Thread Eli Zaretskii
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

Re: New warnings on emacs-26 branch with gcc 8.2.0

2018-08-14 Thread Paul Eggert
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 '