aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2016-05-05 16:04:11 +0200
committerMattias Andrée <maandree@kth.se>2016-05-05 16:04:11 +0200
commit683babd645e3a41b26326beea30879ee30920392 (patch)
treec8379976d7339b58a313c941b7d10ef4cb84b8ae
parentRename zahl-{inlines,internals}.h => zahl/{inlines,internals}.h (diff)
downloadlibzahl-683babd645e3a41b26326beea30879ee30920392.tar.gz
libzahl-683babd645e3a41b26326beea30879ee30920392.tar.bz2
libzahl-683babd645e3a41b26326beea30879ee30920392.tar.xz
Optimise and use __ around all compiler extensions
Signed-off-by: Mattias Andrée <maandree@kth.se>
-rw-r--r--zahl/internals.h22
1 files changed, 13 insertions, 9 deletions
diff --git a/zahl/internals.h b/zahl/internals.h
index 5c9cc5e..b7cd230 100644
--- a/zahl/internals.h
+++ b/zahl/internals.h
@@ -2,7 +2,11 @@
#ifndef ZAHL_INLINE
# if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
-# define ZAHL_INLINE static inline
+# if defined(__GNUC__) || defined(__clang__)
+# define ZAHL_INLINE __attribute__((__always_inline__, __gnu_inline__)) static inline
+# else
+# define ZAHL_INLINE static inline
+# endif
# else
# define ZAHL_INLINE static
# endif
@@ -20,15 +24,15 @@
#if defined(__GNUC__) && !defined(__clang__)
-# define ZAHL_O0 __attribute__((optimize("O0")))
-# define ZAHL_O1 __attribute__((optimize("O1")))
-# define ZAHL_O2 __attribute__((optimize("O2")))
-# define ZAHL_O3 __attribute__((optimize("O3")))
-# define ZAHL_Ofast __attribute__((optimize("Ofast")))
-# define ZAHL_Os __attribute__((optimize("Os")))
-# define ZAHL_Oz __attribute__((optimize("Os")))
+# define ZAHL_O0 __attribute__((__optimize__("O0")))
+# define ZAHL_O1 __attribute__((__optimize__("O1")))
+# define ZAHL_O2 __attribute__((__optimize__("O2")))
+# define ZAHL_O3 __attribute__((__optimize__("O3")))
+# define ZAHL_Ofast __attribute__((__optimize__("Ofast")))
+# define ZAHL_Os __attribute__((__optimize__("Os")))
+# define ZAHL_Oz __attribute__((__optimize__("Os")))
#elif defined(__clang__)
-# define ZAHL_O0 __attribute__((optnone))
+# define ZAHL_O0 __attribute__((__optnone__))
# define ZAHL_O1 /* Don't know how. */
# define ZAHL_O2 /* Don't know how. */
# define ZAHL_O3 /* Don't know how. */