From 91fc5678cae1e7421e46e1e0af32c91a41b65aa1 Mon Sep 17 00:00:00 2001
From: sje <sje@138bc75d-0d04-0410-961f-82ee72b054a4>
Date: Sun, 3 Jul 2005 15:38:39 +0000
Subject: [PATCH] 	PR other/13906 	* ansidecl.h
 (ATTRIBUTE_ALIGNED_ALIGNOF): New. 	* md5.h (md5_uintptr): New. 
 (md5_ctx): Align buffer field.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@101556 138bc75d-0d04-0410-961f-82ee72b054a4
---
 include/ChangeLog  | 7 +++++++
 include/ansidecl.h | 9 +++++++++
 include/md5.h      | 6 +++++-
 3 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/include/ChangeLog b/include/ChangeLog
index d2730a6fa382..8799b295896e 100644
--- a/include/ChangeLog
+++ b/include/ChangeLog
@@ -1,3 +1,10 @@
+2005-07-03  Steve Ellcey  <sje@cup.hp.com>
+
+	PR other/13906
+	* ansidecl.h (ATTRIBUTE_ALIGNED_ALIGNOF): New.
+	* md5.h (md5_uintptr): New.
+	(md5_ctx): Align buffer field.
+
 2005-06-30  Daniel Berlin  <dberlin@dberlin.org>
 	
 	* hashtab.h (HTAB_DELETED_ENTRY): New macro.
diff --git a/include/ansidecl.h b/include/ansidecl.h
index 439431182dc4..a1a765d63f32 100644
--- a/include/ansidecl.h
+++ b/include/ansidecl.h
@@ -352,6 +352,15 @@ So instead we use the macro below and test it against specific values.  */
 # endif /* GNUC >= 3.5 */
 #endif /* ATTRIBUTE_SENTINEL */
 
+
+#ifndef ATTRIBUTE_ALIGNED_ALIGNOF
+# if (GCC_VERSION >= 3000)
+#  define ATTRIBUTE_ALIGNED_ALIGNOF(m) __attribute__ ((__aligned__ (__alignof__ (m))))
+# else
+#  define ATTRIBUTE_ALIGNED_ALIGNOF(m)
+# endif /* GNUC >= 3.0 */
+#endif /* ATTRIBUTE_ALIGNED_ALIGNOF */
+
 /* We use __extension__ in some places to suppress -pedantic warnings
    about GCC extensions.  This feature didn't work properly before
    gcc 2.8.  */
diff --git a/include/md5.h b/include/md5.h
index 655933f75339..e35789346b1a 100644
--- a/include/md5.h
+++ b/include/md5.h
@@ -37,6 +37,7 @@
 #ifdef _LIBC
 # include <sys/types.h>
 typedef u_int32_t md5_uint32;
+typedef uintptr_t md5_uintptr;
 #else
 #  define INT_MAX_32_BITS 2147483647
 
@@ -64,6 +65,9 @@ typedef u_int32_t md5_uint32;
 #   endif
 #  endif
 # endif
+/* We have to make a guess about the integer type equivalent in size
+   to pointers which should always be correct.  */
+typedef unsigned long int md5_uintptr;
 #endif
 
 /* Structure to save state of computation between the single steps.  */
@@ -76,7 +80,7 @@ struct md5_ctx
 
   md5_uint32 total[2];
   md5_uint32 buflen;
-  char buffer[128];
+  char buffer[128] ATTRIBUTE_ALIGNED_ALIGNOF(md5_uint32);
 };
 
 /*
-- 
GitLab