pboettch / json-schema-validator

JSON schema validator for JSON for Modern C++
Other
463 stars 133 forks source link

smtp-adress-validator.cpp build fails when compiling for ARM #285

Closed dpurgin closed 7 months ago

dpurgin commented 9 months ago

Hi,

when compiling the 2.2.0 version of the library for ARM with gcc 8.3, the build fails with the following:

smtp-address-validator.cpp:212:23: error: narrowing conversion of ‘-32’ from ‘int’ to ‘char’ inside { } [-Wnarrowing]
smtp-address-validator.cpp:212:23: error: narrowing conversion of ‘-19’ from ‘int’ to ‘char’ inside { } [-Wnarrowing]
smtp-address-validator.cpp:212:23: error: narrowing conversion of ‘-15’ from ‘int’ to ‘char’ inside { } [-Wnarrowing]
smtp-address-validator.cpp:212:23: error: narrowing conversion of ‘-13’ from ‘int’ to ‘char’ inside { } [-Wnarrowing]
smtp-address-validator.cpp:212:23: error: narrowing conversion of ‘-128’ from ‘int’ to ‘char’ inside { } [-Wnarrowing]
smtp-address-validator.cpp:212:23: error: narrowing conversion of ‘-65’ from ‘int’ to ‘char’ inside { } [-Wnarrowing]
smtp-address-validator.cpp:212:23: error: narrowing conversion of ‘-32’ from ‘int’ to ‘char’ inside { } [-Wnarrowing]
...

Apparently, this comes from the fact that the signedness of char is implementation-defined (https://stackoverflow.com/a/31635036). I've managed to work around this with -Wno-narrowing option, but no idea if it has implications on the email validator (and don't care since I'm not using one anyway).

I've tried to fix this by specifying signed char on _address_trans_keys but then it clashes with some obscure arithmetics later, so I gave it up, and the file seems to be generated by ragel anyway.

Cheers

sergeniously commented 8 months ago

Have the same problem when build for aarch64 by aarch64-linux-gnu-g++ compiler!

corneliusclaussen commented 8 months ago

This seems to be fixed in main