summaryrefslogtreecommitdiff
path: root/include/opus_defines.h
diff options
context:
space:
mode:
authorGregory Maxwell <greg@xiph.org>2012-07-18 12:12:35 -0400
committerGregory Maxwell <greg@xiph.org>2012-07-18 12:12:35 -0400
commitde0b5324b687c9e9a33722d84151de08ee7f82a9 (patch)
tree4d80ef9939e11bf1796dc50949c9790cb77930c9 /include/opus_defines.h
parent31e8a845923ace3cb818dd12839188cf3f29af80 (diff)
downloadopus-de0b5324b687c9e9a33722d84151de08ee7f82a9.tar.gz
Replace C99 restrict keyword with OPUS_RESTRICT.
We had previously advised people to -Drestrict on non-C99 compilers, but this creates problems for some of the MSVC headers. Instead this just uses a macro and defines it sanely.
Diffstat (limited to 'include/opus_defines.h')
-rw-r--r--include/opus_defines.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/opus_defines.h b/include/opus_defines.h
index aad47fc4..a16bd648 100644
--- a/include/opus_defines.h
+++ b/include/opus_defines.h
@@ -84,6 +84,18 @@ extern "C" {
# endif
# endif
+#if (!defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L) )
+# if OPUS_GNUC_PREREQ(3,0)
+# define OPUS_RESTRICT __restrict__
+# elif (_MSC_VER >= 1400)
+# define OPUS_RESTRICT __restrict
+# else
+# define OPUS_RESTRICT
+# endif
+#else
+# define OPUS_RESTRICT restrict
+#endif
+
/**Warning attributes for opus functions
* NONNULL is not used in OPUS_BUILD to avoid the compiler optimizing out
* some paranoid null checks. */