git: 3a450f6a64ee - main - devel/util-linux: Future-proofing patch
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Fri, 29 Apr 2022 23:21:36 UTC
The branch main has been updated by yuri: URL: https://cgit.FreeBSD.org/ports/commit/?id=3a450f6a64eebec85170be0a698ad98f3a930584 commit 3a450f6a64eebec85170be0a698ad98f3a930584 Author: Warner Losh <imp@bsdimp.com> AuthorDate: 2022-04-29 23:20:47 +0000 Commit: Yuri Victorovich <yuri@FreeBSD.org> CommitDate: 2022-04-29 23:21:30 +0000 devel/util-linux: Future-proofing patch --- devel/util-linux/files/patch-include_bitops.h | 40 +++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/devel/util-linux/files/patch-include_bitops.h b/devel/util-linux/files/patch-include_bitops.h new file mode 100644 index 000000000000..063fd8d843bb --- /dev/null +++ b/devel/util-linux/files/patch-include_bitops.h @@ -0,0 +1,40 @@ +commit a38d1f69fee5ca7e883b09ed3668a7da3b161051 +Author: Warner Losh <imp@FreeBSD.org> +Date: Fri Apr 29 15:29:44 2022 -0600 + + BSD: Use byteswap.h and endian.h defined macos when present + + Newer versions of FreeBSD will have a glibc compatible + byteswap.h. Currently, this file assumes that FreeBSD requires + bswap{16,32,64} to always be defined. This isn't the case when we're + using the byteswap.h file (which is enabled by HAVE_BYTESWAP_H + define). Assume that if byteswap.h and endian.h are present, then the + proper macros are defined. Otherwise, assume that sys/endian.h is + present and paper over the small differences between the BSDs for this + file. + + Signed-off-by: Warner Losh <imp@bsdimp.com> + +--- include/bitops.h ++++ include/bitops.h +@@ -20,6 +20,12 @@ + # include <sys/endian.h> + #endif + ++#if !(defined(HAVE_BYTESWAP_H) && defined(HAVE_ENDIAN_H)) ++/* ++ * When both byteswap.h and endian.h are preseent, the proper macros are defined ++ * as those files are glibc compatible. Otherwise, compensate for the slightly ++ * different interfaces between the different BSDs. ++ */ + #if defined(__OpenBSD__) + # include <sys/types.h> + # define be16toh(x) betoh16(x) +@@ -47,6 +53,7 @@ + # define bswap_32(x) OSSwapInt32(x) + # define bswap_64(x) OSSwapInt64(x) + #endif ++#endif + + /* + * Fallbacks