]> git.sesse.net Git - ffmpeg/commitdiff
libfdk-aac: Don't use defined() in a #define
authorMartin Storsjö <martin@martin.st>
Wed, 12 Sep 2018 20:03:12 +0000 (23:03 +0300)
committerMartin Storsjö <martin@martin.st>
Thu, 13 Sep 2018 19:11:50 +0000 (22:11 +0300)
MSVC expands the preprocessor directives differently, making the
version check fail in the previous form.

Clang can warn about this with -Wexpansion-to-defined (not currently
enabled by default):
warning: macro expansion producing 'defined' has undefined behavior [-Wexpansion-to-defined]

Signed-off-by: Martin Storsjö <martin@martin.st>
libavcodec/libfdk-aacdec.c
libavcodec/libfdk-aacenc.c

index ca70a49ad4612b68f6b4a58d75a98c1998bb1169..63856232d9e14c2cd8d8ca5454d2d477852b0fe6 100644 (file)
 #include "avcodec.h"
 #include "internal.h"
 
+#ifdef AACDECODER_LIB_VL0
 #define FDKDEC_VER_AT_LEAST(vl0, vl1) \
-    (defined(AACDECODER_LIB_VL0) && \
-        ((AACDECODER_LIB_VL0 > vl0) || \
-         (AACDECODER_LIB_VL0 == vl0 && AACDECODER_LIB_VL1 >= vl1)))
+    ((AACDECODER_LIB_VL0 > vl0) || \
+     (AACDECODER_LIB_VL0 == vl0 && AACDECODER_LIB_VL1 >= vl1))
+#else
+#define FDKDEC_VER_AT_LEAST(vl0, vl1) 0
+#endif
 
 #if !FDKDEC_VER_AT_LEAST(2, 5) // < 2.5.10
 #define AAC_PCM_MAX_OUTPUT_CHANNELS AAC_PCM_OUTPUT_CHANNELS
index f71a276403e014762432e9c5af32afe0783442b8..3b492ef8f48f65ca70cb6be3ac106ae117b546be 100644 (file)
 #include "audio_frame_queue.h"
 #include "internal.h"
 
+#ifdef AACENCODER_LIB_VL0
 #define FDKENC_VER_AT_LEAST(vl0, vl1) \
-    (defined(AACENCODER_LIB_VL0) && \
-        ((AACENCODER_LIB_VL0 > vl0) || \
-         (AACENCODER_LIB_VL0 == vl0 && AACENCODER_LIB_VL1 >= vl1)))
+    ((AACENCODER_LIB_VL0 > vl0) || \
+     (AACENCODER_LIB_VL0 == vl0 && AACENCODER_LIB_VL1 >= vl1))
+#else
+#define FDKENC_VER_AT_LEAST(vl0, vl1) 0
+#endif
 
 typedef struct AACContext {
     const AVClass *class;