From 75c8133efec035ec1083ebd8e7d43ef340c2e581 Mon Sep 17 00:00:00 2001 From: Kushal Das Date: Wed, 18 Jan 2023 19:43:49 +0100 Subject: gh-100340: Allows -Wno-int-conversion for wasm (#100341) Fixes #100340 allows -Wno-int-conversion for wasm --- .../2023-01-17-21-32-51.gh-issue-100340.i9zRGM.rst | 2 ++ Tools/wasm/config.site-wasm32-wasi | 3 ++ configure | 38 ++++++++++++++++++++++ configure.ac | 4 +++ 4 files changed, 47 insertions(+) create mode 100644 Misc/NEWS.d/next/Build/2023-01-17-21-32-51.gh-issue-100340.i9zRGM.rst diff --git a/Misc/NEWS.d/next/Build/2023-01-17-21-32-51.gh-issue-100340.i9zRGM.rst b/Misc/NEWS.d/next/Build/2023-01-17-21-32-51.gh-issue-100340.i9zRGM.rst new file mode 100644 index 0000000..3a37f79 --- /dev/null +++ b/Misc/NEWS.d/next/Build/2023-01-17-21-32-51.gh-issue-100340.i9zRGM.rst @@ -0,0 +1,2 @@ +Allows -Wno-int-conversion for wasm-sdk 17 and onwards, thus enables +building WASI builds once against the latest sdk. diff --git a/Tools/wasm/config.site-wasm32-wasi b/Tools/wasm/config.site-wasm32-wasi index 4b8df22..5e98775 100644 --- a/Tools/wasm/config.site-wasm32-wasi +++ b/Tools/wasm/config.site-wasm32-wasi @@ -37,3 +37,6 @@ ac_cv_header_netpacket_packet_h=no # disable accept for WASM runtimes without sock_accept #ac_cv_func_accept=no #ac_cv_func_accept4=no + +# Disable int-conversion for wask-sdk as it triggers an error from version 17. +ac_cv_disable_int_conversion=yes diff --git a/configure b/configure index 5b6750a..144b35d 100755 --- a/configure +++ b/configure @@ -8743,6 +8743,44 @@ fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can disable $CC int-conversion warning" >&5 +$as_echo_n "checking if we can disable $CC int-conversion warning... " >&6; } +if ${ac_cv_disable_int_conversion_warning+:} false; then : + $as_echo_n "(cached) " >&6 +else + + py_cflags=$CFLAGS + as_fn_append CFLAGS "-Wint-conversion -Werror" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_disable_int_conversion_warning=yes +else + ac_cv_disable_int_conversion_warning=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS=$py_cflags + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_disable_int_conversion_warning" >&5 +$as_echo "$ac_cv_disable_int_conversion_warning" >&6; } + + + if test "x$ac_cv_disable_int_conversion" = xyes; then : + CFLAGS_NODIST="$CFLAGS_NODIST -Wno-int-conversion" +fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can disable $CC missing-field-initializers warning" >&5 $as_echo_n "checking if we can disable $CC missing-field-initializers warning... " >&6; } if ${ac_cv_disable_missing_field_initializers_warning+:} false; then : diff --git a/configure.ac b/configure.ac index 956334a..595adc6 100644 --- a/configure.ac +++ b/configure.ac @@ -2288,6 +2288,10 @@ yes) AS_VAR_IF([ac_cv_disable_unused_parameter_warning], [yes], [CFLAGS_NODIST="$CFLAGS_NODIST -Wno-unused-parameter"]) + PY_CHECK_CC_WARNING([disable], [int-conversion]) + AS_VAR_IF([ac_cv_disable_int_conversion], [yes], + [CFLAGS_NODIST="$CFLAGS_NODIST -Wno-int-conversion"]) + PY_CHECK_CC_WARNING([disable], [missing-field-initializers]) AS_VAR_IF([ac_cv_disable_missing_field_initializers_warning], [yes], [CFLAGS_NODIST="$CFLAGS_NODIST -Wno-missing-field-initializers"]) -- cgit v0.12