summaryrefslogtreecommitdiff
path: root/devel/cqual/patches/patch-bl
diff options
context:
space:
mode:
Diffstat (limited to 'devel/cqual/patches/patch-bl')
-rw-r--r--devel/cqual/patches/patch-bl30
1 files changed, 30 insertions, 0 deletions
diff --git a/devel/cqual/patches/patch-bl b/devel/cqual/patches/patch-bl
new file mode 100644
index 00000000000..5010cad0629
--- /dev/null
+++ b/devel/cqual/patches/patch-bl
@@ -0,0 +1,30 @@
+$NetBSD: patch-bl,v 1.1 2006/01/18 23:24:12 rillig Exp $
+
+SunPro does not know __alignof__. Replaced it with the size of ''x'',
+rounded up to the next power of two.
+
+--- src/types.c.orig 2003-12-12 17:09:49.000000000 +0100
++++ src/types.c 2006-01-16 14:27:49.278596800 +0100
+@@ -23,6 +23,22 @@ Boston, MA 02111-1307, USA. */
+ #include <stddef.h>
+ #include "user-qual.h"
+
++#if !defined(__GNUC__)
++
++/* http://www.hackersdelight.org/HDcode.htm, figure 3.3 */
++static inline size_t clp2(size_t x) {
++ x = x - 1;
++ x = x | (x >> 1);
++ x = x | (x >> 2);
++ x = x | (x >> 4);
++ x = x | (x >> 8);
++ x = x | (x >>16);
++ return x + 1;
++}
++
++# define __alignof__(x) (clp2(sizeof(x)))
++#endif
++
+ struct type
+ {
+ enum { tk_primitive, tk_complex, tk_tagged, tk_error, tk_void,