[opus] [PATCH] opus_defines.h: disable restrict with gcc < 3.4

Ozkan Sezer sezeroz at gmail.com
Sat Dec 16 18:17:38 UTC 2017


With gcc-3.3, building opus fails with the following error:

In file included from silk/float/pitch_analysis_core_FLP.c:38:
celt/pitch.h:53: error: invalid use of `restrict'

This is because __restrict is broken with gcc < 3.4. See:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=6392

Therefore, disable restrict with gcc versions older than 3.4.
---
 include/opus_defines.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/include/opus_defines.h b/include/opus_defines.h
index 33c5acd..306887d 100644
--- a/include/opus_defines.h
+++ b/include/opus_defines.h
@@ -86,7 +86,11 @@ extern "C" {
 #  endif
 # endif

-#if (!defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L) )
+#if (defined(__GNUC__) && !OPUS_GNUC_PREREQ(3,4))
+/* __restrict is broken with gcc < 3.4
+   https://gcc.gnu.org/bugzilla/show_bug.cgi?id=6392 */
+# define OPUS_RESTRICT
+#elif (!defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L) )
 # if OPUS_GNUC_PREREQ(3,0)
 #  define OPUS_RESTRICT __restrict__
 # elif (defined(_MSC_VER) && _MSC_VER >= 1400)
-- 
1.8.5.5

[patch also attached in `git format-patch` format]
-------------- next part --------------
From e1dc1b1cf1a7a6be5fd301da67b597d3c0b48ea2 Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <sezero at users.sourceforge.net>
Date: Sat, 16 Dec 2017 21:11:00 +0300
Subject: [PATCH] opus_defines.h: disable restrict with gcc < 3.4

With gcc-3.3, building opus fails with the following error:

In file included from silk/float/pitch_analysis_core_FLP.c:38:
celt/pitch.h:53: error: invalid use of `restrict'

This is because __restrict is broken with gcc < 3.4. See:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=6392

Therefore, disable restrict with gcc versions older than 3.4.
---
 include/opus_defines.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/include/opus_defines.h b/include/opus_defines.h
index 33c5acd..306887d 100644
--- a/include/opus_defines.h
+++ b/include/opus_defines.h
@@ -86,7 +86,11 @@ extern "C" {
 #  endif
 # endif
 
-#if (!defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L) )
+#if (defined(__GNUC__) && !OPUS_GNUC_PREREQ(3,4))
+/* __restrict is broken with gcc < 3.4
+   https://gcc.gnu.org/bugzilla/show_bug.cgi?id=6392 */
+# define OPUS_RESTRICT
+#elif (!defined(__STDC_VERSION__) || (__STDC_VERSION__ < 199901L) )
 # if OPUS_GNUC_PREREQ(3,0)
 #  define OPUS_RESTRICT __restrict__
 # elif (defined(_MSC_VER) && _MSC_VER >= 1400)
-- 
1.8.5.5



More information about the opus mailing list