[FFmpeg-devel] [PATCH] libavutil: Don't require __STDC_CONSTANT_MACROS on C++11

Calvin Walton calvin.walton at kepstin.ca
Mon Nov 30 22:32:02 EET 2020


Prior to C++11, some of the C99 macros in stdint.h were not defined
unless __STDC_CONSTANT_MACROS was defined before including the header.

C++11 updated this so that the C99 macros are unconditionally defined -
__STDC_CONSTANT_MACROS is no longer required.

Update the conditional on the error message in common.h so that it does
not trigger when using a C++11 or later compiler.
---
 libavutil/common.h | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavutil/common.h b/libavutil/common.h
index b9fbcc4d60..f90de59157 100644
--- a/libavutil/common.h
+++ b/libavutil/common.h
@@ -26,7 +26,11 @@
 #ifndef AVUTIL_COMMON_H
 #define AVUTIL_COMMON_H
 
-#if defined(__cplusplus) && !defined(__STDC_CONSTANT_MACROS) && !defined(UINT64_C)
+/*
+ * In C++ prior to C++11, some of the C99 defines in stdint.h are omitted unless
+ * you request to enable them by setting __STDC_CONSTANT_MACROS
+ */
+#if defined(__cplusplus) && __cplusplus < 201103L && !defined(__STDC_CONSTANT_MACROS) && !defined(UINT64_C)
 #error missing -D__STDC_CONSTANT_MACROS / #define __STDC_CONSTANT_MACROS
 #endif
 
-- 
2.29.2



More information about the ffmpeg-devel mailing list