shithub: opus

Download patch

ref: 936f52ca0ef4729f26dec092ef8388d2d4c0bf07
parent: efbb5ea40167c7b73f27235eaa787ca3705b4694
author: Gregory Maxwell <[email protected]>
date: Sun May 13 07:40:19 EDT 2012

Add #errors when !OPUS_BUILD or !(VAR_ARRAYS||USE_ALLOCA||NONTHREADSAFE_PSEUDOSTACK).

This will help prevent people using non-standard build environments from
footgunning themselves and becoming a support burden.

--- a/celt/stack_alloc.h
+++ b/celt/stack_alloc.h
@@ -32,6 +32,10 @@
 #ifndef STACK_ALLOC_H
 #define STACK_ALLOC_H
 
+#if (!defined (VAR_ARRAYS) && !defined (USE_ALLOCA) && !defined (NONTHREADSAFE_PSEUDOSTACK))
+#error "Opus requires one of VAR_ARRAYS, USE_ALLOCA, or NONTHREADSAFE_PSEUDOSTACK be defined to select the temporary allocation mode."
+#endif
+
 #ifdef USE_ALLOCA
 # ifdef WIN32
 #  include <malloc.h>
--- a/src/opus_decoder.c
+++ b/src/opus_decoder.c
@@ -29,6 +29,10 @@
 #include "config.h"
 #endif
 
+#ifndef OPUS_BUILD
+#error "OPUS_BUILD _MUST_ be defined to build Opus and you probably want a decent config.h, see README for more details."
+#endif
+
 #include <stdarg.h>
 #include "celt.h"
 #include "opus.h"