From: Karel Zak Date: Tue, 17 Jan 2023 15:36:13 +0000 (+0100) Subject: c.h: fix compiler warning [-Werror=shift-count-overflow] X-Git-Tag: v2.39-rc1~159 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1ef0be3a1acfbe5bb8aac80a24e0a1d9a17876d1;p=thirdparty%2Futil-linux.git c.h: fix compiler warning [-Werror=shift-count-overflow] It's probably typo in the original path (too many brackets:-)). Let's be explicit about the types used in the calculation. '1 << n' means the left shift is on 'int', but we need '(t)1 << n'. Addresses: e53463ea40c58a6f84a597966ac69be9be72cd7d Signed-off-by: Karel Zak --- diff --git a/include/c.h b/include/c.h index 0f25fb009d..1fa2dc766f 100644 --- a/include/c.h +++ b/include/c.h @@ -526,6 +526,6 @@ static inline void print_features(const char **features, const char *prefix) # define MAP_ANONYMOUS (MAP_ANON) #endif -#define SINT_MAX(t) ((t) (1 << (sizeof(t) * 8 - 2)) - 1 + ((t) 1 << (sizeof(t) * 8 - 2))) +#define SINT_MAX(t) (((t)1 << (sizeof(t) * 8 - 2)) - (t)1 + ((t)1 << (sizeof(t) * 8 - 2))) #endif /* UTIL_LINUX_C_H */