From 6d59c062d8245a68e80b3a0bb2924ab49ab7dd49 Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Sat, 6 Jul 2024 10:02:25 -0600 Subject: [PATCH 1/5] cdefs.h: Retire __const and __signed These are no longer used in the base system. Once upon a time they were used to ease the transition from K&R to ANSI C. These days, we use both of these keywords in their bare form everywhere, even in our headers. Any uses of __const or __signed will be converted to their ANSI meaning in the compiler, but is beyond the scope of cdefs.h's charter. For pure K&R compilation, with an enforced only use K&R features and meanings, one needs to define NO_ANSI_KEYWORDS (though even that support is wobbly at best, being active only for !GCC or gcc-adjacent compilers which currently appears to be none). Sponsored by: Netflix Reviewed by: brooks Differential Revision: https://reviews.freebsd.org/D45860 --- sys/sys/cdefs.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h index b92992c1b5c3..e08da15e1d91 100644 --- a/sys/sys/cdefs.h +++ b/sys/sys/cdefs.h @@ -124,8 +124,6 @@ #define __STRING(x) #x /* stringify without expanding x */ #define __XSTRING(x) __STRING(x) /* expand x, then stringify */ -#define __const const /* define reserved names to standard */ -#define __signed signed #define __volatile volatile #if defined(__cplusplus) #define __inline inline /* convert to C++ keyword */ @@ -141,9 +139,7 @@ #define __STRING(x) "x" #if !defined(__CC_SUPPORTS___INLINE) -#define __const /* delete pseudo-ANSI C keywords */ #define __inline -#define __signed #define __volatile /* * In non-ANSI C environments, new programs will want ANSI-only C keywords From 9a04df0515c9bdc21cc26b31b0cdba14c0e12584 Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Sat, 6 Jul 2024 10:02:35 -0600 Subject: [PATCH 2/5] cdefs.h: Remove NO_ANSI_KEYWORDS Remove very old, deletion of ANSI keywords. Once upon a time, it was common to want to do this. Then we only did it for non gcc compilers, then all compilers claimed to be gcc, so we never did it. These days, it's about useless to keep around since there's no compilers we can test it with. It's an odd little artifact. Also, the advice in the comment is wrong: if you define NO_ANSI_KEYWORDS, you can't have progams that use const, etc as identifiers because they will be deleted. Further, our header files have the 'bare' ANSI forms of these, so it's a catch 22: You'd need them deleted for .h files, but not for the code. It's such a niche case these days that it's best to just remove it. Sponsored by: Netflix Reviewed by: brooks Differential Revision: https://reviews.freebsd.org/D45861 --- sys/sys/cdefs.h | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h index e08da15e1d91..b8908138bd65 100644 --- a/sys/sys/cdefs.h +++ b/sys/sys/cdefs.h @@ -137,24 +137,10 @@ #define __P(protos) () /* traditional C preprocessor */ #define __CONCAT(x,y) x/**/y #define __STRING(x) "x" - #if !defined(__CC_SUPPORTS___INLINE) +/* Just delete these in a K&R environment */ #define __inline #define __volatile -/* - * In non-ANSI C environments, new programs will want ANSI-only C keywords - * deleted from the program and old programs will want them left alone. - * When using a compiler other than gcc, programs using the ANSI C keywords - * const, inline etc. as normal identifiers should define -DNO_ANSI_KEYWORDS. - * When using "gcc -traditional", we assume that this is the intent; if - * __GNUC__ is defined but __STDC__ is not, we leave the new keywords alone. - */ -#ifndef NO_ANSI_KEYWORDS -#define const /* delete ANSI C keywords */ -#define inline -#define signed -#define volatile -#endif /* !NO_ANSI_KEYWORDS */ #endif /* !__CC_SUPPORTS___INLINE */ #endif /* !(__STDC__ || __cplusplus) */ From 0b82dac337e7db79fa1a78bb29f2de6825a877ab Mon Sep 17 00:00:00 2001 From: Warner Losh Date: Sat, 6 Jul 2024 10:07:52 -0600 Subject: [PATCH 3/5] cdefs.h: Add back fallback define for __printf0like The format function printf0 is originally a FreeBSD extension. clang has adopted it as an alias for printf. Starting with gcc 11, gcc doesn't do a NULL pointer check for fmtarg. Instead, it has to be tagged with a nonnull attribute, so this gives us the behavior we want. For earlier gcc and other cmopilers, define it away so do not get false positives for NULL pointers for the err*/warn* family of functions. This also fixes -Wsystem-headers by avoiding print0 entirely. My testing for 67d1a1cd9e77 didn't test that case, so I introduced a regression. All these compilers need to be considered because __printf0like is used in err.h and stdlib.h. Since it's used in system headers, it has to work on all the compilers we support on FreeBSD, not just the ones that can build FreeBSD itself. __printf0like will likely be deleted in the future, since the proper way to do this is with _Nullable or _Nonnull, but the compiler support for those hasn't been completely evaluated. Noticed by: jhb Fixes: 67d1a1cd9e77 Sponsored by: Netflix Suggestions by: jhb Differential Revision: https://reviews.freebsd.org/D45836 --- sys/sys/cdefs.h | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h index b8908138bd65..6b861b1903f6 100644 --- a/sys/sys/cdefs.h +++ b/sys/sys/cdefs.h @@ -338,9 +338,7 @@ /* * Compiler-dependent macros to declare that functions take printf-like - * or scanf-like arguments. They are null except for versions of gcc - * that are known to support the features properly (old versions of gcc-2 - * didn't permit keeping the keywords out of the application namespace). + * or scanf-like arguments. */ #define __printflike(fmtarg, firstvararg) \ __attribute__((__format__ (__printf__, fmtarg, firstvararg))) @@ -352,8 +350,18 @@ #define __strftimelike(fmtarg, firstvararg) \ __attribute__((__format__ (__strftime__, fmtarg, firstvararg))) -#define __printf0like(fmtarg, firstvararg) \ - __attribute__((__format__ (__printf0__, fmtarg, firstvararg))) +/* + * Like __printflike, but allows fmtarg to be NULL. FreeBSD invented 'printf0' + * for this because older versions of gcc issued warnings for NULL first args. + * Clang has always had printf and printf0 as aliases. gcc 11.0 now follows + * clang. So now this is an alias for __printflike, or nothing. In the future + * _Nullable or _Nonnull will replace this. + */ +#if defined(__clang__) || __GNUC_PREREQ__(11, 0) +#define __printf0like(fmtarg, firstvararg) __printflike(fmtarg, firstvararg) +#else +#define __printf0like(fmtarg, firstvararg) +#endif #define __strong_reference(sym,aliassym) \ extern __typeof (sym) aliassym __attribute__ ((__alias__ (#sym))) From ed807f7bcaecbf32b0b81a7d18cee489a3666157 Mon Sep 17 00:00:00 2001 From: Colin Percival Date: Sat, 6 Jul 2024 10:15:22 -0700 Subject: [PATCH 4/5] release.sh: Pass ARCH_FLAGS when setting VMSIZE The default VM size may depend on the architecture. In particular, it is currently larged on riscv64 due to a toolchain issue which results in bloated binaries. MFC after: 3 days Fixes: 59c21ed6e811 "release: Bump default VM size for riscv64 to 6 GB" Sponsored by: Amazon --- release/release.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/release/release.sh b/release/release.sh index 3c68f89c2cc3..cee0fbd5643d 100755 --- a/release/release.sh +++ b/release/release.sh @@ -337,7 +337,7 @@ chroot_build_release() { fi if [ -z "${VMSIZE}" ]; then VMSIZE="$(eval chroot ${CHROOTDIR} \ - make -C /usr/src/release -V VMSIZE)" + make -C /usr/src/release ${ARCH_FLAGS} -V VMSIZE)" fi RELEASE_RMAKEFLAGS="${RELEASE_RMAKEFLAGS} \ VMFORMATS=\"${VMFORMATS}\" VMSIZE=${VMSIZE}" From a9d7f098b86576006f5aeb312521bfde5ac77c77 Mon Sep 17 00:00:00 2001 From: Gordon Bergling Date: Sat, 6 Jul 2024 19:49:30 +0200 Subject: [PATCH 5/5] mps(4): Correct a typo in a source code comment - s/vender/vendor/ MFC after: 3 days --- sys/dev/mps/mps_pci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/mps/mps_pci.c b/sys/dev/mps/mps_pci.c index ece49435b39e..7a0c577eb72a 100644 --- a/sys/dev/mps/mps_pci.c +++ b/sys/dev/mps/mps_pci.c @@ -122,8 +122,8 @@ struct mps_ident { 0xffff, 0xffff, 0, "Avago Technologies (LSI) SAS2208" }, { MPI2_MFGPAGE_VENDORID_LSI, MPI2_MFGPAGE_DEVID_SAS2308_1, 0xffff, 0xffff, 0, "Avago Technologies (LSI) SAS2308" }, - // Add Customer specific vender/subdevice id before generic - // (0xffff) vender/subdevice id. + // Add Customer specific vendor/subdevice id before generic + // (0xffff) vendor/subdevice id. { MPI2_MFGPAGE_VENDORID_LSI, MPI2_MFGPAGE_DEVID_SAS2308_2, 0x8086, 0x3516, 0, "Intel(R) Integrated RAID Module RMS25JB080" }, { MPI2_MFGPAGE_VENDORID_LSI, MPI2_MFGPAGE_DEVID_SAS2308_2,