linuxkpi: Don't clobber result on failure
In kstrto*(), don't assign to *res until we know the conversion is
successful, and address issues that may result in warnings if code
that uses <linux/kstrtox.h> is compiled at high warning levels.
MFC after: 1 week
Sponsored by: Klara, Inc.
Sponsored by: NetApp, Inc.
Reviewed by: bz, emaste
Differential Revision: https://reviews.freebsd.org/D54440
libc: Fix TESTSDIR for new stdbit tests
Otherwise the directory created by etc/mtree/BSD.tests.dist, which is
where these belong, and referred to by the generated Kyuafile for
/usr/tests/lib/libc (via stdbit's existence in TESTS_SUBDIRS), ends up
empty with no Kyuafile, which is an error for kyua.
Reported by: kp
Fixes: 2fb8cbc6ef1b ("libc/tests: add stdbit test framework and unit tests")
(cherry picked from commit 5f529f9e292a30c065c316ed5fd0d23e07b26e5c)
man/man3: add stdbit.3
This is the overview man page for the <stdbit.h> functions.
Reviewed by: pauamma at gundo.com, adrian
Approved by: markj (mentor)
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D53658
(cherry picked from commit d39e310c7d6a42b459aa7919310e3c99cc478d50)
libc/stdc_has_single_bit.c: fix gcc warning (-Wparentheses)
gcc14 is concerned that the operator precedence between - and & might
be confusing. Throw in some redundant parentheses to make it shut up.
The LLVM build was fine before this change.
Reported by: Martin Filla <freebsd at sysctl.cz>
Approved by: markj (mentor)
MFC after: 1 month
Fixes: 6296500a85c8474e3ff3fe2f8e4a9d56dd0acd64
Differential Revision: https://reviews.freebsd.org/D54057
(cherry picked from commit 3d71ce92eae9f1417f35a0d07912858fd8f6fa0b)
libc/tests: add stdbit test framework and unit tests
This adds unit tests for all 70 functions in <stdbit.h>.
I'm sorry for the test framework, but it makes it so I don't
have to write 70 unit tests by hand.
Reviewed by: adrian, des
Approved by: markj (mentor)
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D53660
(cherry picked from commit 2fb8cbc6ef1b3cc6cd60e5db07f8305623f9b044)
libc/stdbit: add man pages for stdbit functions
This adds man pages for each group of functions in <stdbit.h>.
The man pages have cross references to one-another.
Cross references from external man pages to these will be added
in a later commit.
Reviewed by: pauamma at gundo.com, kib
Approved by: markj (mentor)
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D53659
(cherry picked from commit d790b16bbf0c3055ef00200d01659dfb3c0e5e5e)
libc/limits_test: add no-op testcase to satisfy kyua
This test suite is purely tested with compile-time assertions, so
it needs a dummy runtime test to ensure that kyua reports the
file as passing.
Pull Request: https://github.com/freebsd/freebsd-src/pull/1915
Sponsored by: The FreeBSD Foundation
Reviewed by: fuz
Approved by: markj (mentor)
MFC after: 1 month
Signed-off-by: Siva Mahadevan <me at svmhdvn.name>
(cherry picked from commit 27ff0bbcfd27df588d3f486cb21180a26031b889)
powerpc/_stdint.h: fix SIG_ATOMIC_{MIN,MAX,WIDTH}
On powerpc/powerpc64, sig_atomic_t is an int, but was treated as if
it was a long by <machine/_stdint.h>. This was finally caught by the
unit test added with 4a1c752 / D53831.
Reported by: kib
Reviewed by: kib, imp
Approved by: markj (mentor)
Fixes: c3e289e1ce8c9af8d14e9f727632e22b3bf901f9
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D54026
(cherry picked from commit f417c9ed6642836c386c922d6e184b618d28127d)
sys/stdint.h: add C23 _WIDTH macros
The platform-dependent macros are added to the various
_stdint.h headers, those that are always the same are
added directly to _stdint.h.
We may want to move the definitions for WCHAR_* and
WINT_* out of the platform header files as those are
always the same.
Approved by: markj (mentor)
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D53830
(cherry picked from commit 7998a82d2f99a00086baf64b2a3343ba10f8806d)
libc/tests: add test for *_MAX, *_MIN, and *_WIDTH
This file checks the correctness of the various _MAX, _MIN, and
_WIDTH macros defined for the libc types. It assumes that none
of the types have padding bits.
Approved by: markj (mentor)
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D53831
(cherry picked from commit 4a1c7529c96ff54657ef701fa89b92230ee6bac2)
libc: implement C23 <stdbit.h> functions
This new header complies with ISO/IEC 9899:2024 (C23).
Contrary to glibc, we do not provide inline definitions in
<stdbit.h> as we expect our system compiler to soon recognise
these as builtins anyway.
Relnotes: yes
MFC after: 1 month
Reviewed by: adrian
Approved by: markj (mentor)
Differential Revision: https://reviews.freebsd.org/D53657
(cherry picked from commit 6296500a85c8474e3ff3fe2f8e4a9d56dd0acd64)
sys/limits.h: add C23 _WIDTH macros
For compliance with IOS/IEC 9899:2024 ("C23").
These macros define the width in bits of the basic integer types.
Another new macro, BITINT_MAXWIDTH, is not yet included as I do not
understand what it should be set to. Perhaps it is compiler-specific.
Approved by: markj (mentor)
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D53825
(cherry picked from commit 7326bc7f9c14f86976a7769906b167ff96140809)
uchar.h: add char8_t
A type similar to char16 and char32_t, for compliance with C23.
The related type atomic_char8_t is added to stdatomic.h.
As char8_t is always unsigned char, I've skipped adding __char8_t.
This can be added, too, if desired.
Reviewed by: imp
Approved by: markj (mentor)
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D53952
(cherry picked from commit f0e541118c374869a8226eaa1320bb6eda248a20)
camcontrol.8: Descriptions before examples
This page has a lot of examples, so having them in the previous order
can be confusing. Rewrite to the normal order where the descriptions
come before the command, followed by a colon, which is still clear even
jumping to the middle of the section.
PR: 291759
MFC after: 3 days
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D54285
(cherry picked from commit fbc321b9cdceecd3c97742868da5d500423cf484)
vt.4: Style pass
Outstanding: I'm not sure kernel configuration declarations are defined
variables. Dv does not allow arguments, but some why allowed paths, so
non-path arguments were being incorrectly marked up as paths.
MFC after: 3 days (with resolved conflicts)
Reviewed by: 0mp, emaste
Differential Revision: https://reviews.freebsd.org/D49565
(cherry picked from commit 7cd6da268a8fbf34b16564dd9a94c86853eb7c56)