Roland Illig
2024-06-08 09:51:43 UTC
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+++ 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
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
--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-***@muc.de