Source-Changes-D archive

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

Re: CVS commit: src/lib/libc



Am 07.06.2024 um 22:50 schrieb Taylor R Campbell:
> libc: Pacify lint on aarch64.
>
> +++ src/lib/libc/stdlib/Makefile.inc	Fri Jun  7 20:50:13 2024
> +# lint(1) spuriously complains about `*s == CHAR_MAX' even though *s
> +# has type char.
> +LINTFLAGS.strfmon.c += -X 230

I guess the "spuriously" here means "on platforms where 'char' is
unsigned", not "sometimes on the same platform, unpredictably".

When CHAR_MAX is defined as 0xff, lint assumes that the same constant
with the same value is used on other platforms as well, thus the
warning.  This is due to lint's -p flag for portability checks.

Lint does not warn if the constant is defined as a character constant,
so '\xff' instead of 0xff would work, but I don't know what else would
be affected if the definition of CHAR_MAX were changed.

Ideally, lint would not warn about this expression, but since lint only
looks at the preprocessed translation unit, it cannot know that the 0xff
comes from CHAR_MAX and thus is fine.  Practically, suppressing the
warning in this particular case makes sense.

Any ideas how to resolve this situation?

Roland



Home | Main Index | Thread Index | Old Index