Yo Greg!

On Sat, 31 Oct 2026 08:11:27 -0400
Greg Troxel <[email protected]> wrote:

> I thought we had fixed all of these, but I'm building/testing git
> master (to verify that WRITE_PAD is still needed), and see the
> following warnings in the build.   This is the signature of invoking
> a ctype(3) function with type char, which could be signed, and if
> negative, would be promoted to a negative int, which gets you into
> UB, per ISO C -- the only allowable values are those representable as
> unsigned char and EOF.

Huh?

$ man ctype
No manual entry for ctype

[...]

> gpsd-3.27.6~dev/gpsd/gpsd_json.c:79:21: warning: array subscript has
> type ‘char’ [-Wchar-subscripts] gpsd-3.27.6~dev/gpsd/gpsd.c:959:22:
> warning: array subscript has type ‘char’ [-Wchar-subscripts]

That line is:

            iscntrl(*sp)) {

iscntrl(3) clearly shows this prototype:

       int iscntrl(int c);

The C compiler promotes the char to an int, and all is well.  If your
iscontrl() is different, then it is not POSIX.

RGDS
GARY
---------------------------------------------------------------------------
Gary E. Miller Rellim 109 NW Wilmington Ave., Suite E, Bend, OR 97703
        [email protected]  Tel:+1 541 382 8588

            Veritas liberabit vos. -- Quid est veritas?
    "If you can't measure it, you can't improve it." - Lord Kelvin

Attachment: pgposU0jsgVtn.pgp
Description: OpenPGP digital signature

Reply via email to