Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misc nitpicks #519

Merged
merged 5 commits into from
Jun 27, 2024
Merged

Misc nitpicks #519

merged 5 commits into from
Jun 27, 2024

Conversation

gperciva
Copy link
Member

No description provided.

gperciva added 5 commits June 26, 2024 17:55
apisupport-{LIBSSL-HOST_NAME,NONPOSIX-SETGROUPS}.c: <stddef.h> for NULL

elasticarray_perftest.c: <sys/time.h> for struct timeval

mpool.h: <stdint.h> for uint8_t

setuidgid.c: <sys/types.h> for gid_t, uid_t

Reported by:	iwyu
We cannot rely on "%d" to print the pid correctly; POSIX specifies that:
    pid_t... shall be signed integer types.
    https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/sys_types.h.html

That page also says:
    The implementation shall support one or more programming
    environments in which the widths of ... pid_t, ...  are no greater
    than the width of type long.
but if we were to rely on that, we'd need to check that we were in the
relevant programming environment.  Easier just to use "%jd".
Also, ensure that we always print an error message before quitting.  The
exception is test_assert_failure() in tests/parsenum/main.c, which has a
series of tests which (deliberately) end with an abort(), so any
subsequent lines of code aren't going to be called.
This should have been part of:
    2024-01-13 tests: add fork_func
    19efda2

Reported by:	cppcheck 2.12.1
This should have been done shortly after:
    2024-01-01 Import millisleep.h
    bfffdd7
@gperciva gperciva changed the title Misc Misc nitpicks Jun 27, 2024
@cperciva cperciva merged commit 43c4ede into master Jun 27, 2024
2 checks passed
@gperciva gperciva deleted the misc branch June 27, 2024 16:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants