Message ID | 20180912202336.22128-1-martin@martin.st |
---|---|
State | Committed |
Commit | 2a9e1c122eed66be1b26b747342b848300b226c7 |
Headers | show |
Series |
|
Related | show |
On Wed, 12 Sep 2018, Martin Storsjö wrote: > MSVC expands the preprocessor directives differently, making the > version check fail in the previous form. > --- > I'm pretty sure I've seen a better description of this issue somewhere, > I don't remember off-hand right now where that was. But I think the > gist of it was that the previous form was undefined according to the > C standard, even if GCC and clang handle it in the same way. This is similar to 5e3f6dc70198426fe0741e3017826b8bf3ee5ad8, which points out that if building with -Wexpansion-to-defined, the compiler (at least clang) would warn about it, clarifying that macro expansion of 'defined' has undefined behaviour. // Martin
On 12/09/2018 22:23, Martin Storsjö wrote: > MSVC expands the preprocessor directives differently, making the > version check fail in the previous form. > --- > I'm pretty sure I've seen a better description of this issue somewhere, > I don't remember off-hand right now where that was. But I think the > gist of it was that the previous form was undefined according to the > C standard, even if GCC and clang handle it in the same way. > --- > libavcodec/libfdk-aacdec.c | 9 ++++++--- > libavcodec/libfdk-aacenc.c | 9 ++++++--- > 2 files changed, 12 insertions(+), 6 deletions(-) > Sure. lu
diff --git a/libavcodec/libfdk-aacdec.c b/libavcodec/libfdk-aacdec.c index ca70a49ad4..63856232d9 100644 --- a/libavcodec/libfdk-aacdec.c +++ b/libavcodec/libfdk-aacdec.c @@ -25,10 +25,13 @@ #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 diff --git a/libavcodec/libfdk-aacenc.c b/libavcodec/libfdk-aacenc.c index f71a276403..3b492ef8f4 100644 --- a/libavcodec/libfdk-aacenc.c +++ b/libavcodec/libfdk-aacenc.c @@ -26,10 +26,13 @@ #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;