[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 2/7] b2sum: simplify attribute usage
From: |
Paul Eggert |
Subject: |
[PATCH 2/7] b2sum: simplify attribute usage |
Date: |
Sun, 31 Oct 2021 22:37:25 -0700 |
* src/blake2/blake2.h (BLAKE2_PACKED): Simplify, and port better
to older GCC, by using _GL_ATTRIBUTE_PACKED.
---
src/blake2/blake2.h | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
diff --git a/src/blake2/blake2.h b/src/blake2/blake2.h
index 3960bdb2d..dc4672d1d 100644
--- a/src/blake2/blake2.h
+++ b/src/blake2/blake2.h
@@ -18,18 +18,12 @@
#include <stddef.h>
#include <stdint.h>
-#ifdef __has_attribute
-# if __has_attribute (packed)
-# define BLAKE2_PACKED(x) x __attribute__ ((packed))
-# endif
-#endif
-#if !defined BLAKE2_PACKED && defined _MSC_VER
+/* Pack a structure if possible. This might save space, and is not
+ needed for correctness. */
+#ifdef _MSC_VER
# define BLAKE2_PACKED(x) __pragma (pack (push, 1)) x __pragma (pack (pop))
-#endif
-#ifndef BLAKE2_PACKED
-/* This should be good enough on other platforms.
- If it's not good on yours, please file a bug report. */
-# define BLAKE2_PACKED(x) x
+#else
+# define BLAKE2_PACKED(x) x _GL_ATTRIBUTE_PACKED
#endif
#if defined(__cplusplus)
--
2.31.1
- [PATCH 1/7] maint: prefer attribute.h in .c files, Paul Eggert, 2021/11/01
- [PATCH 3/7] maint: remove unused __attribute__ defn, Paul Eggert, 2021/11/01
- [PATCH 2/7] b2sum: simplify attribute usage,
Paul Eggert <=
- [PATCH 4/7] maint: modernize attribute usage, Paul Eggert, 2021/11/01
- [PATCH 5/7] maint: enable -Wsuggest-attribute=format, Paul Eggert, 2021/11/01
- [PATCH 7/7] maint: use minmax.h instead of rolling our own, Paul Eggert, 2021/11/01
- [PATCH 6/7] maint: add function attributes to .h files, Paul Eggert, 2021/11/01
- Re: [PATCH 1/7] maint: prefer attribute.h in .c files, Pádraig Brady, 2021/11/01