Compile using -std=c99 when available
This commit is contained in:
+1
-1
@@ -35,7 +35,7 @@ static const ALCchar alsaDevice[] = "ALSA Default";
|
||||
|
||||
#ifdef HAVE_DYNLOAD
|
||||
static void *alsa_handle;
|
||||
#define MAKE_FUNC(f) static typeof(f) * p##f
|
||||
#define MAKE_FUNC(f) static __typeof(f) * p##f
|
||||
MAKE_FUNC(snd_strerror);
|
||||
MAKE_FUNC(snd_pcm_open);
|
||||
MAKE_FUNC(snd_pcm_close);
|
||||
|
||||
@@ -35,7 +35,7 @@ static const ALCchar pa_device[] = "PortAudio Default";
|
||||
|
||||
#ifdef HAVE_DYNLOAD
|
||||
static void *pa_handle;
|
||||
#define MAKE_FUNC(x) static typeof(x) * p##x
|
||||
#define MAKE_FUNC(x) static __typeof(x) * p##x
|
||||
MAKE_FUNC(Pa_Initialize);
|
||||
MAKE_FUNC(Pa_Terminate);
|
||||
MAKE_FUNC(Pa_GetErrorText);
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
|
||||
#ifdef HAVE_DYNLOAD
|
||||
static void *pa_handle;
|
||||
#define MAKE_FUNC(x) static typeof(x) * p##x
|
||||
#define MAKE_FUNC(x) static __typeof(x) * p##x
|
||||
MAKE_FUNC(pa_context_unref);
|
||||
MAKE_FUNC(pa_sample_spec_valid);
|
||||
MAKE_FUNC(pa_frame_size);
|
||||
|
||||
+8
-1
@@ -100,10 +100,17 @@ CHECK_TYPE_SIZE("long" SIZEOF_LONG)
|
||||
CHECK_TYPE_SIZE("long long" SIZEOF_LONG_LONG)
|
||||
|
||||
|
||||
CHECK_C_COMPILER_FLAG(-std=c99 HAVE_STD_C99)
|
||||
IF(HAVE_STD_C99)
|
||||
SET(CMAKE_C_FLAGS "-std=c99 ${CMAKE_C_FLAGS}")
|
||||
ENDIF()
|
||||
|
||||
# TODO: Once we truly require C99, these restrict and inline checks should go
|
||||
# away. Currently they're needed to maintain MSVC compatibility.
|
||||
CHECK_C_SOURCE_COMPILES("int *restrict foo;
|
||||
int main() {return 0;}" HAVE_RESTRICT)
|
||||
IF(NOT HAVE_RESTRICT)
|
||||
# Slightly convoluted way to do this, because MSVC may barf is restrict is
|
||||
# Slightly convoluted way to do this, because MSVC may barf if restrict is
|
||||
# defined to __restrict.
|
||||
CHECK_C_SOURCE_COMPILES("#define restrict __restrict
|
||||
#include <stdlib.h>
|
||||
|
||||
Reference in New Issue
Block a user