aboutsummaryrefslogtreecommitdiffstats
path: root/Alc/align.h
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2014-04-19 02:11:04 -0700
committerChris Robinson <[email protected]>2014-04-19 02:11:04 -0700
commit59fc9aac0ee41518dba0cbd2f1518decffeaa480 (patch)
treeac9793a8e3015e595b2f679b82b7f11e4472f717 /Alc/align.h
parent8badd3740e1a2e13affb4553c69ca44b1649035b (diff)
Use C11 alignas when available
Diffstat (limited to 'Alc/align.h')
-rw-r--r--Alc/align.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/Alc/align.h b/Alc/align.h
new file mode 100644
index 00000000..babd4106
--- /dev/null
+++ b/Alc/align.h
@@ -0,0 +1,21 @@
+#ifndef AL_ALIGN_H
+#define AL_ALIGN_H
+
+#ifdef HAVE_STDALIGN_H
+#include <stdalign.h>
+#endif
+
+#ifndef alignas
+#ifdef HAVE_C11_ALIGNAS
+#define alignas _Alignas
+#elif defined(IN_IDE_PARSER)
+/* KDevelop has problems with our align macro, so just use nothing for parsing. */
+#define alignas(x)
+#else
+/* NOTE: Our custom ALIGN macro can't take a type name like alignas can. For
+ * maximum compatibility, only provide constant integer values to alignas. */
+#define alignas(_x) ALIGN(_x)
+#endif
+#endif
+
+#endif /* AL_ALIGN_H */