From 24ed947cc35ebb9f50ac0685f1b88ec164d46c6c Mon Sep 17 00:00:00 2001
From: Frank Praznik <[EMAIL REDACTED]>
Date: Wed, 4 Dec 2024 12:06:18 -0500
Subject: [PATCH] kmsdrm: Fix an LTO type mismatch warning
Include SDL_kmsdrmopengles.h before SDL_kmsdrmvulkan.h, as the Vulkan header can pull in Wayland headers, which pull in EGL headers with EGL types defined as Wayland types, which causes warnings when building with strict-aliasing and LTO.
---
src/video/kmsdrm/SDL_kmsdrmvideo.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/video/kmsdrm/SDL_kmsdrmvideo.c b/src/video/kmsdrm/SDL_kmsdrmvideo.c
index fdc7c1090ae73..e5cdaed351ba8 100644
--- a/src/video/kmsdrm/SDL_kmsdrmvideo.c
+++ b/src/video/kmsdrm/SDL_kmsdrmvideo.c
@@ -23,6 +23,12 @@
#ifdef SDL_VIDEO_DRIVER_KMSDRM
+/* Include this before SDL_kmsdrmvulkan.h, as the Vulkan header can pull in
+ * Wayland headers, which pull in EGL headers with EGL types defined as Wayland
+ * types, which causes warnings when building with strict-aliasing and LTO.
+ */
+#include "SDL_kmsdrmopengles.h"
+
/* include this here before SDL_sysvideo.h to avoid vulkan type
* redefinition errors. it already includes SDL_sysvideo.h. */
#include "SDL_kmsdrmvulkan.h"
@@ -43,7 +49,6 @@
#include "SDL_kmsdrmevents.h"
#include "SDL_kmsdrmmouse.h"
#include "SDL_kmsdrmvideo.h"
-#include "SDL_kmsdrmopengles.h"
#include <dirent.h>
#include <errno.h>
#include <poll.h>