--- /dev/null
+From ea328b246d093477cf26a68b42e975aaaef6abad Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Tue, 28 Nov 2023 21:55:36 -0800
+Subject: [PATCH] vtest: Fix undefined behavior with clang
+
+This is seen when compiling with CC="clang -D_FORTIFY_SOURCE=2"
+Move #ifdef outside of printf() call.
+
+Fixes
+
+| ../git/vtest/vtest_server.c:244:2: error: embedding a directive within macro arguments has undefined behavior [-Werror,-Wembedded-directive]
+| 244 | #ifdef ENABLE_VENUS
+| | ^
+| ../git/vtest/vtest_server.c:246:2: error: embedding a directive within macro arguments has undefined behavior [-Werror,-Wembedded-directive]
+| 246 | #endif
+| | ^
+
+Upstream-Status: Submitted [https://gitlab.freedesktop.org/virgl/virglrenderer/-/merge_requests/1309]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ vtest/vtest_server.c | 12 ++++++++----
+ 1 file changed, 8 insertions(+), 4 deletions(-)
+
+diff --git a/vtest/vtest_server.c b/vtest/vtest_server.c
+index 1ca7f74f..93d949d7 100644
+--- a/vtest/vtest_server.c
++++ b/vtest/vtest_server.c
+@@ -197,6 +197,12 @@ static void vtest_server_parse_args(int argc, char **argv)
+ /* getopt_long stores the option index here. */
+ int option_index = 0;
+
++#ifdef ENABLE_VENUS
++ char* ven = " [--venus]";
++#else
++ char* ven = "";
++#endif
++
+ do {
+ ret = getopt_long(argc, argv, "", long_options, &option_index);
+
+@@ -244,10 +250,8 @@ static void vtest_server_parse_args(int argc, char **argv)
+ printf("Usage: %s [--no-fork] [--no-loop-or-fork] [--multi-clients] "
+ "[--use-glx] [--use-egl-surfaceless] [--use-gles] [--no-virgl]"
+ "[--rendernode <dev>] [--socket-path <path>] "
+-#ifdef ENABLE_VENUS
+- " [--venus]"
+-#endif
+- " [file]\n", argv[0]);
++ "%s"
++ " [file]\n", argv[0], ven);
+ exit(EXIT_FAILURE);
+ break;
+ }
+--
+2.43.0
+