From 466e1de674b42b2afe13d2edd998acbf656a9c76 Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Thu, 19 Mar 2020 18:40:16 +0000 Subject: Fix remaining clang -Wcast-align compilation warnings Introduce DIAG_PUSH_IGNORE_CAST_ALIGN and DIAG_POP_IGNORE_CAST_ALIGN macros, use them to silence remaining clang -Wcast-align compilation warnings. * libpam/include/pam_cc_compat.h (DIAG_PUSH_IGNORE_CAST_ALIGN, DIAG_POP_IGNORE_CAST_ALIGN): New macros. * modules/pam_access/pam_access.c: Include "pam_cc_compat.h". (from_match, network_netmask_match): Wrap inet_ntop invocations in DIAG_PUSH_IGNORE_CAST_ALIGN and DIAG_POP_IGNORE_CAST_ALIGN. --- libpam/include/pam_cc_compat.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'libpam/include') diff --git a/libpam/include/pam_cc_compat.h b/libpam/include/pam_cc_compat.h index d4c905df..c43989f7 100644 --- a/libpam/include/pam_cc_compat.h +++ b/libpam/include/pam_cc_compat.h @@ -27,15 +27,27 @@ _Pragma("GCC diagnostic ignored \"-Wcast-qual\"") # define DIAG_POP_IGNORE_CAST_QUAL \ _Pragma("GCC diagnostic pop") +# define DIAG_PUSH_IGNORE_CAST_ALIGN \ + _Pragma("GCC diagnostic push"); \ + _Pragma("GCC diagnostic ignored \"-Wcast-align\"") +# define DIAG_POP_IGNORE_CAST_ALIGN \ + _Pragma("GCC diagnostic pop") #elif PAM_CLANG_PREREQ(2, 6) # define DIAG_PUSH_IGNORE_CAST_QUAL \ _Pragma("clang diagnostic push"); \ _Pragma("clang diagnostic ignored \"-Wcast-qual\"") # define DIAG_POP_IGNORE_CAST_QUAL \ _Pragma("clang diagnostic pop") +# define DIAG_PUSH_IGNORE_CAST_ALIGN \ + _Pragma("clang diagnostic push"); \ + _Pragma("clang diagnostic ignored \"-Wcast-align\"") +# define DIAG_POP_IGNORE_CAST_ALIGN \ + _Pragma("clang diagnostic pop") #else # define DIAG_PUSH_IGNORE_CAST_QUAL /* empty */ # define DIAG_POP_IGNORE_CAST_QUAL /* empty */ +# define DIAG_PUSH_IGNORE_CAST_ALIGN /* empty */ +# define DIAG_POP_IGNORE_CAST_ALIGN /* empty */ #endif #endif /* PAM_CC_COMPAT_H */ -- cgit v1.2.3