From ebbb1e364b0560089a7994897d55092ba42ec66b Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Sat, 25 Sep 2021 00:16:20 +0900 Subject: [PATCH] meson: refuse implicit int <-> pointer conversion MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before: ``` Compiling C object src/libsystemd-network/libsystemd-network.a.p/dhcp6-option.c.o ../src/libsystemd-network/dhcp6-option.c: In function ‘dhcp6_option_parse_ia’: ../src/libsystemd-network/dhcp6-option.c:633:70: warning: passing argument 3 of ‘dhcp6_option_parse’ makes pointer from integer without a cast [-Wint-conversion] 633 | r = dhcp6_option_parse(option_data, option_data_len, offset, &subopt, &subdata_len, &subdata); | ^~~~~~ | | | size_t {aka long unsigned int} ../src/libsystemd-network/dhcp6-option.c:358:25: note: expected ‘size_t *’ {aka ‘long unsigned int *’} but argument is of type ‘size_t’ {aka ‘long unsigned int’} 358 | size_t *offset, | ~~~~~~~~^~~~~~ ``` After: ``` ../src/libsystemd-network/dhcp6-option.c: In function ‘dhcp6_option_parse_ia’: ../src/libsystemd-network/dhcp6-option.c:633:70: error: passing argument 3 of ‘dhcp6_option_parse’ makes pointer from integer without a cast [-Werror=int-conversion] 633 | r = dhcp6_option_parse(option_data, option_data_len, offset, &subopt, &subdata_len, &subdata); | ^~~~~~ | | | size_t {aka long unsigned int} ../src/libsystemd-network/dhcp6-option.c:358:25: note: expected ‘size_t *’ {aka ‘long unsigned int *’} but argument is of type ‘size_t’ {aka ‘long unsigned int’} 358 | size_t *offset, | ~~~~~~~~^~~~~~ cc1: some warnings being treated as errors ``` --- meson.build | 1 + 1 file changed, 1 insertion(+) diff --git a/meson.build b/meson.build index 1447f55521..9db035c3b7 100644 --- a/meson.build +++ b/meson.build @@ -340,6 +340,7 @@ possible_common_cc_flags = [ '-Werror=format=2', '-Werror=implicit-function-declaration', '-Werror=incompatible-pointer-types', + '-Werror=int-conversion', '-Werror=overflow', '-Werror=return-type', '-Werror=shift-count-overflow',