NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: toupper and warnings



On 2021-05-06 02:26, Greg A. Woods wrote:
At Wed, 5 May 2021 20:33:30 -0000 (UTC), christos%astron.com@localhost (Christos Zoulas) wrote:
Subject: Re: toupper and warnings

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

Does that really make the difference?

(I can't quickly test it at the moment as I've fixed my test system such
that I don't ever get these warnings from the ctype macros.  I.e. I went
the other way and chose to make my implementation's "undefined
behaviour" to be to behave as conservative as possible and allow the
caller to use these macros in the traditional naive way without fear and
without noisy warnings from picky compilers when char is signed.)

I'm not sure I understand why you'd get a warning in the first place.
toupper should take an int as input. Which is signed.
If you pass in a char, it should always fit and work.
Why should you get a warning?

  Johnny

--
Johnny Billquist                  || "I'm on a bus
                                  ||  on a psychedelic trip
email: bqt%softjar.se@localhost             ||  Reading murder books
pdp is alive!                     ||  tryin' to stay hip" - B. Idol


Home | Main Index | Thread Index | Old Index