Ozkan Sezer
2017-Dec-16 18:17 UTC
[opus] [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 [patch also attached in `git format-patch` format] -------------- next part --------------
Reasonably Related Threads
- MSVC compatibility patch for current master branch
- [PATCH] Remove dead code
- [Fast Int64 1/4] Move OPUS_FAST_INT64 definition to celt/arch.h.
- [RFC PATCH v1 2/2] armv7(float): Optimize encode usecase using NE10 library
- [RFC PATCH v2] armv7(float): Optimize encode usecase using NE10 library