Browse code

fix for windows

Nat! authored on 28-08-2016 18:47:32
Showing 1 changed files
... ...
@@ -9,12 +9,28 @@
9 9
 #ifndef mulle_align_h__
10 10
 #define mulle_align_h__
11 11
 
12
-#include <stdalign.h>
13 12
 #include <stdint.h>
14 13
 #include <stddef.h>
15 14
 
16
-
17
-__attribute(( const))
15
+// ugliness creeps in due to windows
16
+#ifdef _WIN32
17
+# define alignof( x)  __alignof( x)
18
+#else
19
+# include <stdalign.h>
20
+#endif
21
+
22
+#if ! defined( __clang__) && ! defined( __GNUC__)
23
+# ifndef MULLE_CONST_VALUE_RETURN
24
+#  define MULLE_CONST_VALUE_RETURN   __attribute__(( const))
25
+# endif
26
+#else
27
+# ifndef MULLE_CONST_VALUE_RETURN
28
+#  define MULLE_CONST_VALUE_RETURN
29
+# endif
30
+#endif
31
+
32
+
33
+MULLE_CONST_VALUE_RETURN
18 34
 static inline uintptr_t   mulle_align( uintptr_t p, unsigned int alignment)
19 35
 {
20 36
    intptr_t   misalignment;
... ...
@@ -29,7 +45,7 @@ static inline uintptr_t   mulle_align( uintptr_t p, unsigned int alignment)
29 45
 }
30 46
 
31 47
 
32
-__attribute(( const))
48
+MULLE_CONST_VALUE_RETURN
33 49
 static inline void   *mulle_align_pointer( void *p, unsigned int alignment)
34 50
 {
35 51
    return( (void *) mulle_align( (uintptr_t) p, alignment));