* GCC/clang warning for Complex integers?
@ 2024-07-01 8:40 Gerd Möllmann
2024-07-01 11:55 ` Eli Zaretskii
0 siblings, 1 reply; 5+ messages in thread
From: Gerd Möllmann @ 2024-07-01 8:40 UTC (permalink / raw)
To: Emacs Devel
Does someone know how to get a warning for using imaginary numbers like
so (typo)?
unsigned char *data = alloc (nbytes + 1i, IGC_OBJ_STRING_DATA);
That compiles without a warning for me, and one is in for a surprise. I
can't find the compiler flag that makes that a warning or error (tried with
clang 18 and GCC 14).
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: GCC/clang warning for Complex integers?
2024-07-01 8:40 GCC/clang warning for Complex integers? Gerd Möllmann
@ 2024-07-01 11:55 ` Eli Zaretskii
2024-07-01 12:54 ` Pip Cet
0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2024-07-01 11:55 UTC (permalink / raw)
To: Gerd Möllmann; +Cc: emacs-devel
> From: Gerd Möllmann <gerd.moellmann@gmail.com>
> Date: Mon, 01 Jul 2024 10:40:46 +0200
>
> Does someone know how to get a warning for using imaginary numbers like
> so (typo)?
>
> unsigned char *data = alloc (nbytes + 1i, IGC_OBJ_STRING_DATA);
>
> That compiles without a warning for me, and one is in for a surprise. I
> can't find the compiler flag that makes that a warning or error (tried with
> clang 18 and GCC 14).
Try compiling with -std=c99. (Caveat: you might get gobs of warnings
that way.)
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: GCC/clang warning for Complex integers?
2024-07-01 11:55 ` Eli Zaretskii
@ 2024-07-01 12:54 ` Pip Cet
2024-07-01 13:51 ` Po Lu
0 siblings, 1 reply; 5+ messages in thread
From: Pip Cet @ 2024-07-01 12:54 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: Gerd Möllmann, emacs-devel
On Monday, July 1st, 2024 at 11:55, Eli Zaretskii <eliz@gnu.org> wrote:
> > From: Gerd Möllmann gerd.moellmann@gmail.com
>
> > Date: Mon, 01 Jul 2024 10:40:46 +0200
> >
> > Does someone know how to get a warning for using imaginary numbers like
> > so (typo)?
> >
> > unsigned char *data = alloc (nbytes + 1i, IGC_OBJ_STRING_DATA);
> >
> > That compiles without a warning for me, and one is in for a surprise. I
> > can't find the compiler flag that makes that a warning or error (tried with
> > clang 18 and GCC 14).
>
>
> Try compiling with -std=c99. (Caveat: you might get gobs of warnings
> that way.)
That doesn't appear to work here. gcc -Wno-error=pedantic -Wpedantic does work, but causes an (easily-fixed) compilation error (I didn't know -W flags could do that!) in seccomp-filter.c, and tons of warnings about things like statement expressions:
igc.c:1917:25: warning: imaginary constants are a GCC extension
1917 | ssize_t count_total = 0i;
| ^~
I'm using the 20240614 version of gcc 13.3.1.
Pip
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: GCC/clang warning for Complex integers?
2024-07-01 12:54 ` Pip Cet
@ 2024-07-01 13:51 ` Po Lu
2024-07-01 14:31 ` Gerd Möllmann
0 siblings, 1 reply; 5+ messages in thread
From: Po Lu @ 2024-07-01 13:51 UTC (permalink / raw)
To: Pip Cet; +Cc: Eli Zaretskii, Gerd Möllmann, emacs-devel
Pip Cet <pipcet@protonmail.com> writes:
> That doesn't appear to work here. gcc -Wno-error=pedantic -Wpedantic does work, but causes an (easily-fixed) compilation error (I didn't know -W flags could do that!) in seccomp-filter.c, and tons of warnings about things like statement expressions:
>
> igc.c:1917:25: warning: imaginary constants are a GCC extension
> 1917 | ssize_t count_total = 0i;
> | ^~
This is a preprocessor warning, IIRC, only activated when -Wpedantic.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: GCC/clang warning for Complex integers?
2024-07-01 13:51 ` Po Lu
@ 2024-07-01 14:31 ` Gerd Möllmann
0 siblings, 0 replies; 5+ messages in thread
From: Gerd Möllmann @ 2024-07-01 14:31 UTC (permalink / raw)
To: Po Lu; +Cc: Pip Cet, Eli Zaretskii, emacs-devel
Po Lu <luangruo@yahoo.com> writes:
> Pip Cet <pipcet@protonmail.com> writes:
>
>> That doesn't appear to work here. gcc -Wno-error=pedantic -Wpedantic does work, but causes an (easily-fixed) compilation error (I didn't know -W flags could do that!) in seccomp-filter.c, and tons of warnings about things like statement expressions:
>>
>> igc.c:1917:25: warning: imaginary constants are a GCC extension
>> 1917 | ssize_t count_total = 0i;
>> | ^~
>
> This is a preprocessor warning, IIRC, only activated when -Wpedantic.
This seems to work, at least for clang 18. Didn't try GCC further
because it can't build Emacs on macOS:
CFLAGS = -Wgnu-imaginary-constant -g -O0
Gemini said something like that doesn't exist, the source code
disagreed :-).
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2024-07-01 14:31 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-01 8:40 GCC/clang warning for Complex integers? Gerd Möllmann
2024-07-01 11:55 ` Eli Zaretskii
2024-07-01 12:54 ` Pip Cet
2024-07-01 13:51 ` Po Lu
2024-07-01 14:31 ` Gerd Möllmann
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
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).