All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] curses: build with -std=gnu99
@ 2016-10-27 11:46 Gerd Hoffmann
  2016-10-27 15:04 ` Peter Maydell
  0 siblings, 1 reply; 15+ messages in thread
From: Gerd Hoffmann @ 2016-10-27 11:46 UTC (permalink / raw)
  To: qemu-devel; +Cc: Samuel Thibault, Gerd Hoffmann

---
 ui/Makefile.objs | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/ui/Makefile.objs b/ui/Makefile.objs
index dc936f1..62f4cf3 100644
--- a/ui/Makefile.objs
+++ b/ui/Makefile.objs
@@ -17,6 +17,9 @@ common-obj-$(CONFIG_CURSES) += curses.o
 common-obj-$(CONFIG_VNC) += $(vnc-obj-y)
 common-obj-$(CONFIG_GTK) += gtk.o x_keymap.o
 
+# needed to make gcc accept wide unicode chars without warning
+curses.o-cflags := -std=gnu99
+
 ifeq ($(CONFIG_SDLABI),1.2)
 sdl.mo-objs := sdl.o sdl_zoom.o
 endif
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 15+ messages in thread

* Re: [Qemu-devel] [PATCH] curses: build with -std=gnu99
  2016-10-27 11:46 [Qemu-devel] [PATCH] curses: build with -std=gnu99 Gerd Hoffmann
@ 2016-10-27 15:04 ` Peter Maydell
  2016-10-27 15:55   ` Gerd Hoffmann
  0 siblings, 1 reply; 15+ messages in thread
From: Peter Maydell @ 2016-10-27 15:04 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: QEMU Developers, Samuel Thibault

On 27 October 2016 at 12:46, Gerd Hoffmann <kraxel@redhat.com> wrote:
> ---
>  ui/Makefile.objs | 3 +++
>  1 file changed, 3 insertions(+)

Missing commit message and signed-off-by line...

> diff --git a/ui/Makefile.objs b/ui/Makefile.objs
> index dc936f1..62f4cf3 100644
> --- a/ui/Makefile.objs
> +++ b/ui/Makefile.objs
> @@ -17,6 +17,9 @@ common-obj-$(CONFIG_CURSES) += curses.o
>  common-obj-$(CONFIG_VNC) += $(vnc-obj-y)
>  common-obj-$(CONFIG_GTK) += gtk.o x_keymap.o
>
> +# needed to make gcc accept wide unicode chars without warning
> +curses.o-cflags := -std=gnu99
> +
>  ifeq ($(CONFIG_SDLABI),1.2)
>  sdl.mo-objs := sdl.o sdl_zoom.o
>  endif
> --
> 1.8.3.1

I'm not sure about this.

Do we really want gnu99 and not c99? Should we just enable
std=c99 for all source files, given that we already assume
C99 anyway?

It would also be helpful if the commit message quoted the
compiler warning that you get otherwise, so it's easier
to see why we're doing this.

thanks
-- PMM

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Qemu-devel] [PATCH] curses: build with -std=gnu99
  2016-10-27 15:04 ` Peter Maydell
@ 2016-10-27 15:55   ` Gerd Hoffmann
  2016-10-27 15:58     ` Samuel Thibault
  0 siblings, 1 reply; 15+ messages in thread
From: Gerd Hoffmann @ 2016-10-27 15:55 UTC (permalink / raw)
  To: Peter Maydell; +Cc: QEMU Developers, Samuel Thibault

  Hi,

> > +# needed to make gcc accept wide unicode chars without warning
> > +curses.o-cflags := -std=gnu99
> > +
> >  ifeq ($(CONFIG_SDLABI),1.2)
> >  sdl.mo-objs := sdl.o sdl_zoom.o
> >  endif
> > --
> > 1.8.3.1
> 
> I'm not sure about this.
> 
> Do we really want gnu99 and not c99? Should we just enable
> std=c99 for all source files, given that we already assume
> C99 anyway?

-std=c99 doesn't fly, throws errors on (gcc-specific) asm.
So we have to use -std=gnu99.

Tried to do that tree-wide by patching configure but got build errors
then (somewhere in iscsi code).

> It would also be helpful if the commit message quoted the
> compiler warning that you get otherwise, so it's easier
> to see why we're doing this.

With the wide char curses patches by samuel applied I get errors like
this one:

/home/kraxel/projects/qemu/ui/curses.c:627:18: error: universal
character names are only valid in C++ and C99 [-Werror]
             case L'\u23bd':
                  ^

I'm open to better ideas to handle this.

Failing that I can cut+paste this reply into the commit message to
clarify things.

cheers,
  Gerd

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Qemu-devel] [PATCH] curses: build with -std=gnu99
  2016-10-27 15:55   ` Gerd Hoffmann
@ 2016-10-27 15:58     ` Samuel Thibault
  2016-10-27 16:14       ` Peter Maydell
  0 siblings, 1 reply; 15+ messages in thread
From: Samuel Thibault @ 2016-10-27 15:58 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: Peter Maydell, QEMU Developers

Gerd Hoffmann, on Thu 27 Oct 2016 17:55:47 +0200, wrote:
> /home/kraxel/projects/qemu/ui/curses.c:627:18: error: universal
> character names are only valid in C++ and C99 [-Werror]
>              case L'\u23bd':

Another way could be to assume unicode encoding of wchar_t characters
(which looks very reasonable to me) and just write "case 0x23bd:".

Samuel

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Qemu-devel] [PATCH] curses: build with -std=gnu99
  2016-10-27 15:58     ` Samuel Thibault
@ 2016-10-27 16:14       ` Peter Maydell
  2016-10-27 16:36         ` Samuel Thibault
  0 siblings, 1 reply; 15+ messages in thread
From: Peter Maydell @ 2016-10-27 16:14 UTC (permalink / raw)
  To: Samuel Thibault; +Cc: Gerd Hoffmann, QEMU Developers

On 27 October 2016 at 16:58, Samuel Thibault <samuel.thibault@gnu.org> wrote:
> Gerd Hoffmann, on Thu 27 Oct 2016 17:55:47 +0200, wrote:
>> /home/kraxel/projects/qemu/ui/curses.c:627:18: error: universal
>> character names are only valid in C++ and C99 [-Werror]
>>              case L'\u23bd':
>
> Another way could be to assume unicode encoding of wchar_t characters
> (which looks very reasonable to me) and just write "case 0x23bd:".

Does this still work if you're using curses on mingw32?

thanks
-- PMM

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Qemu-devel] [PATCH] curses: build with -std=gnu99
  2016-10-27 16:14       ` Peter Maydell
@ 2016-10-27 16:36         ` Samuel Thibault
  2016-10-27 16:52           ` Peter Maydell
  0 siblings, 1 reply; 15+ messages in thread
From: Samuel Thibault @ 2016-10-27 16:36 UTC (permalink / raw)
  To: Peter Maydell; +Cc: Gerd Hoffmann, QEMU Developers

Peter Maydell, on Thu 27 Oct 2016 17:14:52 +0100, wrote:
> On 27 October 2016 at 16:58, Samuel Thibault <samuel.thibault@gnu.org> wrote:
> > Gerd Hoffmann, on Thu 27 Oct 2016 17:55:47 +0200, wrote:
> >> /home/kraxel/projects/qemu/ui/curses.c:627:18: error: universal
> >> character names are only valid in C++ and C99 [-Werror]
> >>              case L'\u23bd':
> >
> > Another way could be to assume unicode encoding of wchar_t characters
> > (which looks very reasonable to me) and just write "case 0x23bd:".
> 
> Does this still work if you're using curses on mingw32?

Windows' wchar_t uses unicode encoding, yes (and its limitation to 16bit
doesn't pose problem to the values we care about).

Samuel

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Qemu-devel] [PATCH] curses: build with -std=gnu99
  2016-10-27 16:36         ` Samuel Thibault
@ 2016-10-27 16:52           ` Peter Maydell
  2016-10-27 17:02             ` Samuel Thibault
  0 siblings, 1 reply; 15+ messages in thread
From: Peter Maydell @ 2016-10-27 16:52 UTC (permalink / raw)
  To: Samuel Thibault; +Cc: Gerd Hoffmann, QEMU Developers

On 27 October 2016 at 17:36, Samuel Thibault <samuel.thibault@gnu.org> wrote:
> Peter Maydell, on Thu 27 Oct 2016 17:14:52 +0100, wrote:
>> On 27 October 2016 at 16:58, Samuel Thibault <samuel.thibault@gnu.org> wrote:
>> > Gerd Hoffmann, on Thu 27 Oct 2016 17:55:47 +0200, wrote:
>> >> /home/kraxel/projects/qemu/ui/curses.c:627:18: error: universal
>> >> character names are only valid in C++ and C99 [-Werror]
>> >>              case L'\u23bd':
>> >
>> > Another way could be to assume unicode encoding of wchar_t characters
>> > (which looks very reasonable to me) and just write "case 0x23bd:".
>>
>> Does this still work if you're using curses on mingw32?
>
> Windows' wchar_t uses unicode encoding, yes (and its limitation to 16bit
> doesn't pose problem to the values we care about).

On the other hand apparently FreeBSD and Solaris have a wchar_t
whose encoding is locale-dependent:

http://www.thecodingforums.com/threads/wchar_t-is-useless.806149/#post-4398211

thanks
-- PMM

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Qemu-devel] [PATCH] curses: build with -std=gnu99
  2016-10-27 16:52           ` Peter Maydell
@ 2016-10-27 17:02             ` Samuel Thibault
  2016-10-28  6:51               ` Markus Armbruster
  0 siblings, 1 reply; 15+ messages in thread
From: Samuel Thibault @ 2016-10-27 17:02 UTC (permalink / raw)
  To: Peter Maydell; +Cc: Gerd Hoffmann, QEMU Developers

Peter Maydell, on Thu 27 Oct 2016 17:52:17 +0100, wrote:
> On 27 October 2016 at 17:36, Samuel Thibault <samuel.thibault@gnu.org> wrote:
> > Peter Maydell, on Thu 27 Oct 2016 17:14:52 +0100, wrote:
> >> On 27 October 2016 at 16:58, Samuel Thibault <samuel.thibault@gnu.org> wrote:
> >> > Gerd Hoffmann, on Thu 27 Oct 2016 17:55:47 +0200, wrote:
> >> >> /home/kraxel/projects/qemu/ui/curses.c:627:18: error: universal
> >> >> character names are only valid in C++ and C99 [-Werror]
> >> >>              case L'\u23bd':
> >> >
> >> > Another way could be to assume unicode encoding of wchar_t characters
> >> > (which looks very reasonable to me) and just write "case 0x23bd:".
> >>
> >> Does this still work if you're using curses on mingw32?
> >
> > Windows' wchar_t uses unicode encoding, yes (and its limitation to 16bit
> > doesn't pose problem to the values we care about).
> 
> On the other hand apparently FreeBSD and Solaris have a wchar_t
> whose encoding is locale-dependent:
> 
> http://www.thecodingforums.com/threads/wchar_t-is-useless.806149/#post-4398211

UURrgll... So we can't use L'\u23bd' on such systems, it would just not
work either, we have to use iconv to get these right...

Samuel

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Qemu-devel] [PATCH] curses: build with -std=gnu99
  2016-10-27 17:02             ` Samuel Thibault
@ 2016-10-28  6:51               ` Markus Armbruster
  2016-10-28  7:40                 ` Samuel Thibault
  0 siblings, 1 reply; 15+ messages in thread
From: Markus Armbruster @ 2016-10-28  6:51 UTC (permalink / raw)
  To: Samuel Thibault; +Cc: Peter Maydell, Gerd Hoffmann, QEMU Developers

Samuel Thibault <samuel.thibault@gnu.org> writes:

> Peter Maydell, on Thu 27 Oct 2016 17:52:17 +0100, wrote:
>> On 27 October 2016 at 17:36, Samuel Thibault <samuel.thibault@gnu.org> wrote:
>> > Peter Maydell, on Thu 27 Oct 2016 17:14:52 +0100, wrote:
>> >> On 27 October 2016 at 16:58, Samuel Thibault <samuel.thibault@gnu.org> wrote:
>> >> > Gerd Hoffmann, on Thu 27 Oct 2016 17:55:47 +0200, wrote:
>> >> >> /home/kraxel/projects/qemu/ui/curses.c:627:18: error: universal
>> >> >> character names are only valid in C++ and C99 [-Werror]
>> >> >>              case L'\u23bd':
>> >> >
>> >> > Another way could be to assume unicode encoding of wchar_t characters
>> >> > (which looks very reasonable to me) and just write "case 0x23bd:".
>> >>
>> >> Does this still work if you're using curses on mingw32?
>> >
>> > Windows' wchar_t uses unicode encoding, yes (and its limitation to 16bit
>> > doesn't pose problem to the values we care about).
>> 
>> On the other hand apparently FreeBSD and Solaris have a wchar_t
>> whose encoding is locale-dependent:
>> 
>> http://www.thecodingforums.com/threads/wchar_t-is-useless.806149/#post-4398211
>
> UURrgll... So we can't use L'\u23bd' on such systems, it would just not
> work either, we have to use iconv to get these right...

I guess we can if they actually bother to conform to C99.  6.4.3
Universal character names:

    The universal character name \Unnnnnnnn designates the character
    whose eight-digit short identifier (as specified by ISO/IEC 10646)
    is nnnnnnnn.  Similarly, the universal character name \unnnn
    designates the character whose four-digit short identifier is nnnn
    (and whose eight-digit short identifier is 0000nnnn).

Note that it doesn't say here that L'\u23bd' should be equal to 0x23bd.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Qemu-devel] [PATCH] curses: build with -std=gnu99
  2016-10-28  6:51               ` Markus Armbruster
@ 2016-10-28  7:40                 ` Samuel Thibault
  2016-10-28  8:37                   ` Markus Armbruster
  0 siblings, 1 reply; 15+ messages in thread
From: Samuel Thibault @ 2016-10-28  7:40 UTC (permalink / raw)
  To: Markus Armbruster; +Cc: Peter Maydell, Gerd Hoffmann, QEMU Developers

Markus Armbruster, on Fri 28 Oct 2016 08:51:20 +0200, wrote:
> Samuel Thibault <samuel.thibault@gnu.org> writes:
> 
> > Peter Maydell, on Thu 27 Oct 2016 17:52:17 +0100, wrote:
> >> http://www.thecodingforums.com/threads/wchar_t-is-useless.806149/#post-4398211
> >
> > UURrgll... So we can't use L'\u23bd' on such systems, it would just not
> > work either, we have to use iconv to get these right...
> 
> I guess we can if they actually bother to conform to C99.  6.4.3
> Universal character names:
> 
>     The universal character name \Unnnnnnnn designates the character
>     whose eight-digit short identifier (as specified by ISO/IEC 10646)
>     is nnnnnnnn.  Similarly, the universal character name \unnnn
>     designates the character whose four-digit short identifier is nnnn
>     (and whose eight-digit short identifier is 0000nnnn).
> 
> Note that it doesn't say here that L'\u23bd' should be equal to 0x23bd.

I know, but as discussed in the thread, that could only work if gcc
embeds something like calls to nl_langinfo and iconv to properly convert
from the unicode value to the proper wchar_t according to the locale.  I
wouldn't be surprised that they don't.

Samuel

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Qemu-devel] [PATCH] curses: build with -std=gnu99
  2016-10-28  7:40                 ` Samuel Thibault
@ 2016-10-28  8:37                   ` Markus Armbruster
  2016-10-28  9:45                     ` Gerd Hoffmann
  0 siblings, 1 reply; 15+ messages in thread
From: Markus Armbruster @ 2016-10-28  8:37 UTC (permalink / raw)
  To: Samuel Thibault; +Cc: Peter Maydell, Gerd Hoffmann, QEMU Developers

Samuel Thibault <samuel.thibault@gnu.org> writes:

> Markus Armbruster, on Fri 28 Oct 2016 08:51:20 +0200, wrote:
>> Samuel Thibault <samuel.thibault@gnu.org> writes:
>> 
>> > Peter Maydell, on Thu 27 Oct 2016 17:52:17 +0100, wrote:
>> >> http://www.thecodingforums.com/threads/wchar_t-is-useless.806149/#post-4398211
>> >
>> > UURrgll... So we can't use L'\u23bd' on such systems, it would just not
>> > work either, we have to use iconv to get these right...
>> 
>> I guess we can if they actually bother to conform to C99.  6.4.3
>> Universal character names:
>> 
>>     The universal character name \Unnnnnnnn designates the character
>>     whose eight-digit short identifier (as specified by ISO/IEC 10646)
>>     is nnnnnnnn.  Similarly, the universal character name \unnnn
>>     designates the character whose four-digit short identifier is nnnn
>>     (and whose eight-digit short identifier is 0000nnnn).
>> 
>> Note that it doesn't say here that L'\u23bd' should be equal to 0x23bd.
>
> I know, but as discussed in the thread, that could only work if gcc
> embeds something like calls to nl_langinfo and iconv to properly convert
> from the unicode value to the proper wchar_t according to the locale.  I
> wouldn't be surprised that they don't.

Before we uglify our code to work around (egregious!) defects in certain
compilers, we should find out whether and where exactly these defects
exist, and whether it's worth targeting the defective compilers.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Qemu-devel] [PATCH] curses: build with -std=gnu99
  2016-10-28  8:37                   ` Markus Armbruster
@ 2016-10-28  9:45                     ` Gerd Hoffmann
  0 siblings, 0 replies; 15+ messages in thread
From: Gerd Hoffmann @ 2016-10-28  9:45 UTC (permalink / raw)
  To: Markus Armbruster; +Cc: Samuel Thibault, Peter Maydell, QEMU Developers

  Hi,

> Before we uglify our code to work around (egregious!) defects in certain
> compilers, we should find out whether and where exactly these defects
> exist, and whether it's worth targeting the defective compilers.

Using iconv is on the table _anyway_, to properly support
"-display curses,charset=$something", so using that for the cp437 table
too actually simplifies things and avoids hard-coding tables using
\uxxxx as side effect.

cheers,
  Gerd

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Qemu-devel] [PATCH] curses: build with -std=gnu99
  2016-10-27 15:07   ` Gerd Hoffmann
@ 2016-10-27 15:12     ` G 3
  0 siblings, 0 replies; 15+ messages in thread
From: G 3 @ 2016-10-27 15:12 UTC (permalink / raw)
  To: Gerd Hoffmann; +Cc: qemu-devel qemu-devel, Samuel Thibault


On Oct 27, 2016, at 11:07 AM, Gerd Hoffmann wrote:

>>> +# needed to make gcc accept wide unicode chars without warning
>>> +curses.o-cflags := -std=gnu99
>
>> Could we add a commit message to this patch? It could answer
>> questions like:
>>
>> Why this patch is needed?
>> Who needs this patch?
>> What problem it solves.
>
> The comment added by the patch explains things.
>
> I could cut+paste that into the commit msg, but given how small the
> patch is it looked pointless to me ...
>
> cheers,
>   Gerd

A commit message should go with every patch. It makes it easier for  
someone looking thru the commit history to understand your patch.

This might be good enough:

Makes gcc accept wide unicode characters without producing a warning  
during compilation.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [Qemu-devel] [PATCH] curses: build with -std=gnu99
  2016-10-27 14:51 ` G 3
@ 2016-10-27 15:07   ` Gerd Hoffmann
  2016-10-27 15:12     ` G 3
  0 siblings, 1 reply; 15+ messages in thread
From: Gerd Hoffmann @ 2016-10-27 15:07 UTC (permalink / raw)
  To: G 3; +Cc: qemu-devel qemu-devel, Samuel Thibault

> > +# needed to make gcc accept wide unicode chars without warning
> > +curses.o-cflags := -std=gnu99

> Could we add a commit message to this patch? It could answer  
> questions like:
> 
> Why this patch is needed?
> Who needs this patch?
> What problem it solves.

The comment added by the patch explains things.

I could cut+paste that into the commit msg, but given how small the
patch is it looked pointless to me ...

cheers,
  Gerd

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [Qemu-devel]  [PATCH] curses: build with -std=gnu99
       [not found] <mailman.13406.1477569887.22738.qemu-devel@nongnu.org>
@ 2016-10-27 14:51 ` G 3
  2016-10-27 15:07   ` Gerd Hoffmann
  0 siblings, 1 reply; 15+ messages in thread
From: G 3 @ 2016-10-27 14:51 UTC (permalink / raw)
  To: Gerd Hoffmann, qemu-devel qemu-devel; +Cc: Samuel Thibault


On Oct 27, 2016, at 8:04 AM, qemu-devel-request@nongnu.org wrote:

> ---
>  ui/Makefile.objs | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/ui/Makefile.objs b/ui/Makefile.objs
> index dc936f1..62f4cf3 100644
> --- a/ui/Makefile.objs
> +++ b/ui/Makefile.objs
> @@ -17,6 +17,9 @@ common-obj-$(CONFIG_CURSES) += curses.o
>  common-obj-$(CONFIG_VNC) += $(vnc-obj-y)
>  common-obj-$(CONFIG_GTK) += gtk.o x_keymap.o
>
> +# needed to make gcc accept wide unicode chars without warning
> +curses.o-cflags := -std=gnu99
> +
>  ifeq ($(CONFIG_SDLABI),1.2)
>  sdl.mo-objs := sdl.o sdl_zoom.o
>  endif
> --  
> 1.8.3.1

Could we add a commit message to this patch? It could answer  
questions like:

Why this patch is needed?
Who needs this patch?
What problem it solves.

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2016-10-28  9:45 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-27 11:46 [Qemu-devel] [PATCH] curses: build with -std=gnu99 Gerd Hoffmann
2016-10-27 15:04 ` Peter Maydell
2016-10-27 15:55   ` Gerd Hoffmann
2016-10-27 15:58     ` Samuel Thibault
2016-10-27 16:14       ` Peter Maydell
2016-10-27 16:36         ` Samuel Thibault
2016-10-27 16:52           ` Peter Maydell
2016-10-27 17:02             ` Samuel Thibault
2016-10-28  6:51               ` Markus Armbruster
2016-10-28  7:40                 ` Samuel Thibault
2016-10-28  8:37                   ` Markus Armbruster
2016-10-28  9:45                     ` Gerd Hoffmann
     [not found] <mailman.13406.1477569887.22738.qemu-devel@nongnu.org>
2016-10-27 14:51 ` G 3
2016-10-27 15:07   ` Gerd Hoffmann
2016-10-27 15:12     ` G 3

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.