From f74b7718b31ce1d090ce7df89942128e382ffdf0 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Thu, 24 Sep 2020 13:30:39 +0200 Subject: [PATCH] shared: add typedefs for integers for different endianness Kernel uses such typedefs (__le32) and systemd too (le32_t). As we don't want to rely on systemd headers in our code base, let's also define them. They have of course very little effect beside making it clearer to the reviewer that a certain variable is not supposed to be in native endianness. --- shared/nm-std-aux/nm-std-aux.h | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/shared/nm-std-aux/nm-std-aux.h b/shared/nm-std-aux/nm-std-aux.h index 374d91f2c2..762f104be3 100644 --- a/shared/nm-std-aux/nm-std-aux.h +++ b/shared/nm-std-aux/nm-std-aux.h @@ -44,6 +44,23 @@ /*****************************************************************************/ +#ifdef __CHECKER__ + #define _nm_bitwise __attribute__((__bitwise__)) + #define _nm_force __attribute__((__force__)) +#else + #define _nm_bitwise + #define _nm_force +#endif + +typedef uint16_t _nm_bitwise nm_le16_t; +typedef uint16_t _nm_bitwise nm_be16_t; +typedef uint32_t _nm_bitwise nm_le32_t; +typedef uint32_t _nm_bitwise nm_be32_t; +typedef uint64_t _nm_bitwise nm_le64_t; +typedef uint64_t _nm_bitwise nm_be64_t; + +/*****************************************************************************/ + #ifdef thread_local #define _nm_thread_local thread_local /*