summaryrefslogtreecommitdiff
path: root/libpam/include
diff options
context:
space:
mode:
authorDmitry V. Levin <ldv@altlinux.org>2020-03-19 18:40:16 +0000
committerDmitry V. Levin <ldv@altlinux.org>2020-03-19 18:40:16 +0000
commitf6c60926adc9fa08feaeb696ffa5bfbac7c8c9e8 (patch)
treee6a3393a6eeb6b844e858cb8d8ad20e867297e39 /libpam/include
parent2dc4cc4dcecf1ba299de1bd1eb40d8f9d9d0e054 (diff)
Fix most of clang -Wcast-align compilation warnings
Unlike gcc, clang is not smart enough to infer the alignment of structure fields, so add some alignment hints to the code. * libpam/include/pam_cc_compat.h (PAM_ATTRIBUTE_ALIGNED): New macro. * modules/pam_namespace/md5.h: Include "pam_cc_compat.h". (struct MD5Context): Add PAM_ATTRIBUTE_ALIGNED to "in" field. * modules/pam_namespace/md5.c [!(__i386__ || __x86_64__)] (uint8_aligned): New type. [!(__i386__ || __x86_64__)] (byteReverse): Use it instead of unsigned char. * modules/pam_timestamp/sha1.h: Include "pam_cc_compat.h". (struct sha1_context): Add PAM_ATTRIBUTE_ALIGNED to pending field. * modules/pam_unix/md5.h: Include "pam_cc_compat.h". (struct MD5Context): Add PAM_ATTRIBUTE_ALIGNED to "in" field. * modules/pam_unix/md5.c [!HIGHFIRST] (uint8_aligned): New type. [!HIGHFIRST] (byteReverse): Use it instead of unsigned char.
Diffstat (limited to 'libpam/include')
-rw-r--r--libpam/include/pam_cc_compat.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/libpam/include/pam_cc_compat.h b/libpam/include/pam_cc_compat.h
index a4b84c62..d4c905df 100644
--- a/libpam/include/pam_cc_compat.h
+++ b/libpam/include/pam_cc_compat.h
@@ -15,6 +15,12 @@
# define PAM_CLANG_PREREQ(maj, min) 0
#endif
+#if PAM_GNUC_PREREQ(2, 7)
+# define PAM_ATTRIBUTE_ALIGNED(arg) __attribute__((__aligned__(arg)))
+#else
+# define PAM_ATTRIBUTE_ALIGNED(arg) /* empty */
+#endif
+
#if PAM_GNUC_PREREQ(4, 6)
# define DIAG_PUSH_IGNORE_CAST_QUAL \
_Pragma("GCC diagnostic push"); \