NetBSD-Users archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: toupper and warnings
In article <rmiy2ctlzli.fsf%s1.lexort.com@localhost>,
Greg Troxel <gdt%lexort.com@localhost> wrote:
>-=-=-=-=-=-
>
>
>We used to get warnings when toupper was called with char, because it is
>UB pe POSIX if the value is negative.
>
>I am not seeing this any more on NetBSD 9.
>
>I wonder if this is intended, and if the UB is safely avoided somhow, or
>if the warning is just missing, or ?
>
>example program that I think should get a UB warning; doesn't on
>netbsd-9.
>
>----------------------------------------
>#include <ctype.h>
>#include <stdio.h>
>
>int
>main()
>{
> char c, d;
>
> c = getchar();
>
> d = toupper(c);
>
> if (d != c)
> return 1;
> else
> return 0;
>}
gcc hides warnings from system headers by default (my guess is because
the Linux system headers have a concealed firearms license).
Our bsd.sys.mk turns it on... Try gcc -Wall -Wsystem-headers
I've been considering to make it the default for our native gcc,
but then again I am against gratuitous user facing changes...
christos
Home |
Main Index |
Thread Index |
Old Index