qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH v3 1/7] meson: Run some compiler checks using -Wno-unused-val


From: Richard Henderson
Subject: Re: [PATCH v3 1/7] meson: Run some compiler checks using -Wno-unused-value
Date: Thu, 19 Dec 2024 10:14:15 -0800
User-agent: Mozilla Thunderbird

On 12/19/24 09:39, Philippe Mathieu-Daudé wrote:
@@ -885,7 +885,8 @@ class CLikeCompiler(Compiler):
                  dependencies: T.Optional[T.List['Dependency']] = None) -> T.Tuple[bool, bool]:
          t = f'''{prefix}
          void bar(void) {{
-            (void) sizeof({typename});
+            size_t foo = sizeof({typename});
+            (void) foo;
          }}'''

As I mentioned elsewhere, sizeof is a compile-time constant.
The function wrapper is getting in the way.  This can be just

unsigned long foo = sizeof({typename});

I.e. initialization of a global variable, with no need for <stddef.h> or any other system header for size_t.


r~



reply via email to

[Prev in Thread] Current Thread [Next in Thread]