]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
b2sum: port to HP-UX C
authorPaul Eggert <eggert@cs.ucla.edu>
Sat, 11 May 2019 20:48:16 +0000 (13:48 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sat, 11 May 2019 20:55:54 +0000 (13:55 -0700)
* src/blake2/blake2.h (BLAKE2_PACKED):
Don’t assume __attribute__ ((packed)) works on non-Microsoft
compilers.  Instead, assume it works only if we have good
reason to assume so, and fall back on Microsoft (or not packing)
otherwise.  In practice, not packing is good enough and the
BLAKE2_PACKED macro is mostly just for documentation.

src/blake2/blake2.h

index d25d5fdb94da8986ebe9ac87ef595427c3ec8a7b..3960bdb2dc284848662cb068ece72264a1362e14 100644 (file)
 #include <stddef.h>
 #include <stdint.h>
 
-#if defined(_MSC_VER)
-#define BLAKE2_PACKED(x) __pragma(pack(push, 1)) x __pragma(pack(pop))
-#else
-#define BLAKE2_PACKED(x) x __attribute__((packed))
+#ifdef __has_attribute
+# if __has_attribute (packed)
+#  define BLAKE2_PACKED(x) x __attribute__ ((packed))
+# endif
+#endif
+#if !defined BLAKE2_PACKED && defined _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
 #endif
 
 #if defined(__cplusplus)