[MPlayer-dev-eng] [PATCH] Adapts to -std=c11 on OS/2

KO Myung-Hun komh78 at gmail.com
Fri Sep 27 18:36:26 EEST 2024


-std=c11 disables many extensions of OS/2 kLIBC. And this causes many
compilation errors such as implicit functions.

To enable extensions of OS/2 kLIBC, define _EMX_SOURCE before including
any headers.
---
 libao2/ao_dart.c | 3 +++
 libao2/ao_kai.c  | 3 +++
 libvo/vo_kva.c   | 3 +++
 stream/cache2.c  | 6 ++++++
 4 files changed, 15 insertions(+)

diff --git a/libao2/ao_dart.c b/libao2/ao_dart.c
index e1df7d32f..bd8ae6cf9 100644
--- a/libao2/ao_dart.c
+++ b/libao2/ao_dart.c
@@ -20,6 +20,9 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
+// Define to enable extensions of OS/2 kLIBC such as _control87() stuffs.
+#define _EMX_SOURCE
+
 #define INCL_DOS
 #define INCL_DOSERRORS
 #include <os2.h>
diff --git a/libao2/ao_kai.c b/libao2/ao_kai.c
index 3cf84b77e..2a3eff5b0 100644
--- a/libao2/ao_kai.c
+++ b/libao2/ao_kai.c
@@ -20,6 +20,9 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
+// Define to enable extensions of OS/2 kLIBC such as _control87() stuffs.
+#define _EMX_SOURCE
+
 #define INCL_DOS
 #define INCL_DOSERRORS
 #include <os2.h>
diff --git a/libvo/vo_kva.c b/libvo/vo_kva.c
index 42b273dd7..8d327fd88 100644
--- a/libvo/vo_kva.c
+++ b/libvo/vo_kva.c
@@ -20,6 +20,9 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
+// Define to enable extensions of OS/2 kLIBC such as _control87() stuffs.
+#define _EMX_SOURCE
+
 #define INCL_WIN
 #define INCL_GPI
 #define INCL_DOS
diff --git a/stream/cache2.c b/stream/cache2.c
index 3ec2732a7..60cc2653a 100644
--- a/stream/cache2.c
+++ b/stream/cache2.c
@@ -16,6 +16,12 @@
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
+#ifdef __OS2__
+// Define to enable extensions of OS/2 kLIBC such as _beginthread() and
+// _endthread().
+#define _EMX_SOURCE
+#endif
+
 #include "config.h"
 
 // Initial draft of my new cache system...
-- 
2.42.0



More information about the MPlayer-dev-eng mailing list