All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] meson: avoid unused arguments of main() in compiler tests
@ 2022-11-03 17:21 Paolo Bonzini
  2022-11-03 20:13 ` Stefan Weil via
  2022-11-03 21:27 ` Richard Henderson
  0 siblings, 2 replies; 3+ messages in thread
From: Paolo Bonzini @ 2022-11-03 17:21 UTC (permalink / raw)
  To: qemu-devel; +Cc: berrange, sw

meson.build has one test where "main" is declared unnecessarily
with argc and argv arguments, but does not use them.  Because
the test needs -Werror too, HAVE_BROKEN_SIZE_MAX is defined
incorrectly.

Fix the test and, for consistency, remove argc and argv whenever
they are not needed.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 meson.build | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/meson.build b/meson.build
index 17834b3c3def..7beeac6b5194 100644
--- a/meson.build
+++ b/meson.build
@@ -2143,7 +2143,7 @@ config_host_data.set('CONFIG_SPLICE', cc.links(gnu_source_prefix + '''
 
 config_host_data.set('HAVE_MLOCKALL', cc.links(gnu_source_prefix + '''
   #include <sys/mman.h>
-  int main(int argc, char *argv[]) {
+  int main(void) {
     return mlockall(MCL_FUTURE);
   }'''))
 
@@ -2188,7 +2188,7 @@ config_host_data.set('HAVE_FSXATTR', cc.links('''
 config_host_data.set('HAVE_BROKEN_SIZE_MAX', not cc.compiles('''
     #include <stdint.h>
     #include <stdio.h>
-    int main(int argc, char *argv[]) {
+    int main(void) {
         return printf("%zu", SIZE_MAX);
     }''', args: ['-Werror']))
 
@@ -2305,7 +2305,7 @@ config_host_data.set('CONFIG_AVX2_OPT', get_option('avx2') \
       __m256i x = *(__m256i *)a;
       return _mm256_testz_si256(x, x);
     }
-    int main(int argc, char *argv[]) { return bar(argv[0]); }
+    int main(int argc, char *argv[]) { return bar(argv[argc - 1]); }
   '''), error_message: 'AVX2 not available').allowed())
 
 config_host_data.set('CONFIG_AVX512F_OPT', get_option('avx512f') \
@@ -2319,7 +2319,7 @@ config_host_data.set('CONFIG_AVX512F_OPT', get_option('avx512f') \
       __m512i x = *(__m512i *)a;
       return _mm512_test_epi64_mask(x, x);
     }
-    int main(int argc, char *argv[]) { return bar(argv[0]); }
+    int main(int argc, char *argv[]) { return bar(argv[argc - 1]); }
   '''), error_message: 'AVX512F not available').allowed())
 
 have_pvrdma = get_option('pvrdma') \
-- 
2.38.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] meson: avoid unused arguments of main() in compiler tests
  2022-11-03 17:21 [PATCH] meson: avoid unused arguments of main() in compiler tests Paolo Bonzini
@ 2022-11-03 20:13 ` Stefan Weil via
  2022-11-03 21:27 ` Richard Henderson
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Weil via @ 2022-11-03 20:13 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel; +Cc: berrange


[-- Attachment #1.1.1: Type: text/plain, Size: 2281 bytes --]

Am 03.11.22 um 18:21 schrieb Paolo Bonzini:

> meson.build has one test where "main" is declared unnecessarily
> with argc and argv arguments, but does not use them.  Because
> the test needs -Werror too, HAVE_BROKEN_SIZE_MAX is defined
> incorrectly.
>
> Fix the test and, for consistency, remove argc and argv whenever
> they are not needed.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---


Reviewed-by: Stefan Weil <sw@weilnetz.de>

Thanks, Stefan


>   meson.build | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/meson.build b/meson.build
> index 17834b3c3def..7beeac6b5194 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -2143,7 +2143,7 @@ config_host_data.set('CONFIG_SPLICE', cc.links(gnu_source_prefix + '''
>   
>   config_host_data.set('HAVE_MLOCKALL', cc.links(gnu_source_prefix + '''
>     #include <sys/mman.h>
> -  int main(int argc, char *argv[]) {
> +  int main(void) {
>       return mlockall(MCL_FUTURE);
>     }'''))
>   
> @@ -2188,7 +2188,7 @@ config_host_data.set('HAVE_FSXATTR', cc.links('''
>   config_host_data.set('HAVE_BROKEN_SIZE_MAX', not cc.compiles('''
>       #include <stdint.h>
>       #include <stdio.h>
> -    int main(int argc, char *argv[]) {
> +    int main(void) {
>           return printf("%zu", SIZE_MAX);
>       }''', args: ['-Werror']))
>   
> @@ -2305,7 +2305,7 @@ config_host_data.set('CONFIG_AVX2_OPT', get_option('avx2') \
>         __m256i x = *(__m256i *)a;
>         return _mm256_testz_si256(x, x);
>       }
> -    int main(int argc, char *argv[]) { return bar(argv[0]); }
> +    int main(int argc, char *argv[]) { return bar(argv[argc - 1]); }
>     '''), error_message: 'AVX2 not available').allowed())
>   
>   config_host_data.set('CONFIG_AVX512F_OPT', get_option('avx512f') \
> @@ -2319,7 +2319,7 @@ config_host_data.set('CONFIG_AVX512F_OPT', get_option('avx512f') \
>         __m512i x = *(__m512i *)a;
>         return _mm512_test_epi64_mask(x, x);
>       }
> -    int main(int argc, char *argv[]) { return bar(argv[0]); }
> +    int main(int argc, char *argv[]) { return bar(argv[argc - 1]); }
>     '''), error_message: 'AVX512F not available').allowed())
>   
>   have_pvrdma = get_option('pvrdma') \

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 6511 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] meson: avoid unused arguments of main() in compiler tests
  2022-11-03 17:21 [PATCH] meson: avoid unused arguments of main() in compiler tests Paolo Bonzini
  2022-11-03 20:13 ` Stefan Weil via
@ 2022-11-03 21:27 ` Richard Henderson
  1 sibling, 0 replies; 3+ messages in thread
From: Richard Henderson @ 2022-11-03 21:27 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel; +Cc: berrange, sw

On 11/4/22 04:21, Paolo Bonzini wrote:
> meson.build has one test where "main" is declared unnecessarily
> with argc and argv arguments, but does not use them.  Because
> the test needs -Werror too, HAVE_BROKEN_SIZE_MAX is defined
> incorrectly.
> 
> Fix the test and, for consistency, remove argc and argv whenever
> they are not needed.
> 
> Signed-off-by: Paolo Bonzini<pbonzini@redhat.com>
> ---
>   meson.build | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-11-03 21:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-03 17:21 [PATCH] meson: avoid unused arguments of main() in compiler tests Paolo Bonzini
2022-11-03 20:13 ` Stefan Weil via
2022-11-03 21:27 ` Richard Henderson

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.