1
0
mirror of https://github.com/systemd/systemd synced 2024-07-08 20:15:55 +00:00

meson: refuse implicit int <-> pointer conversion

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
```
This commit is contained in:
Yu Watanabe 2021-09-25 00:16:20 +09:00
parent f0e2cfc6dc
commit ebbb1e364b

View File

@ -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',