]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/blob
48488d7be12143275a3d0ead9c3b355817f1be7f
[thirdparty/openembedded/openembedded-core-contrib.git] /
1 From ea328b246d093477cf26a68b42e975aaaef6abad Mon Sep 17 00:00:00 2001
2 From: Khem Raj <raj.khem@gmail.com>
3 Date: Tue, 28 Nov 2023 21:55:36 -0800
4 Subject: [PATCH] vtest: Fix undefined behavior with clang
5
6 This is seen when compiling with CC="clang -D_FORTIFY_SOURCE=2"
7 Move #ifdef outside of printf() call.
8
9 Fixes
10
11 | ../git/vtest/vtest_server.c:244:2: error: embedding a directive within macro arguments has undefined behavior [-Werror,-Wembedded-directive]
12 | 244 | #ifdef ENABLE_VENUS
13 | | ^
14 | ../git/vtest/vtest_server.c:246:2: error: embedding a directive within macro arguments has undefined behavior [-Werror,-Wembedded-directive]
15 | 246 | #endif
16 | | ^
17
18 Upstream-Status: Submitted [https://gitlab.freedesktop.org/virgl/virglrenderer/-/merge_requests/1309]
19 Signed-off-by: Khem Raj <raj.khem@gmail.com>
20 ---
21 vtest/vtest_server.c | 12 ++++++++----
22 1 file changed, 8 insertions(+), 4 deletions(-)
23
24 diff --git a/vtest/vtest_server.c b/vtest/vtest_server.c
25 index 1ca7f74f..93d949d7 100644
26 --- a/vtest/vtest_server.c
27 +++ b/vtest/vtest_server.c
28 @@ -197,6 +197,12 @@ static void vtest_server_parse_args(int argc, char **argv)
29 /* getopt_long stores the option index here. */
30 int option_index = 0;
31
32 +#ifdef ENABLE_VENUS
33 + char* ven = " [--venus]";
34 +#else
35 + char* ven = "";
36 +#endif
37 +
38 do {
39 ret = getopt_long(argc, argv, "", long_options, &option_index);
40
41 @@ -244,10 +250,8 @@ static void vtest_server_parse_args(int argc, char **argv)
42 printf("Usage: %s [--no-fork] [--no-loop-or-fork] [--multi-clients] "
43 "[--use-glx] [--use-egl-surfaceless] [--use-gles] [--no-virgl]"
44 "[--rendernode <dev>] [--socket-path <path>] "
45 -#ifdef ENABLE_VENUS
46 - " [--venus]"
47 -#endif
48 - " [file]\n", argv[0]);
49 + "%s"
50 + " [file]\n", argv[0], ven);
51 exit(EXIT_FAILURE);
52 break;
53 }
54 --
55 2.43.0
56