3 ms·
No, it is rare for compiler warnings to be about important errors. But once in a blue moon they are, so why not be cautious? While your library is fairly small
by bjourne 5y ago
No, it is rare for compiler warnings to be about important errors. But once in a blue moon they are, so why not be cautious? While your library is fairly small (only 3k lines), so I don't know what conclusions can be drawn from it, I checked out a version of it from 2017. Compiling it with gcc 11 generates only two warnings:
x25519.c:9:22: warning: '_0' defined but not used [-Wunused-const-variable=]
9 | static const uint8_t _0[16];
| ^~
ed25519.c:302:14: warning: argument 1 of type 'u8[64]' {aka 'unsigned char[64]'} with mismatched bound [-Warray-parameter=]
302 | void HASH(u8 hash[64], const u8 in, size_t inlen);
| ~~~^~~~~~~~
In file included from ed25519.c:285:
sha512.h:19:29: note: previously declared as 'uint8_t ' {aka 'unsigned char '}
19 | void crypto_sha512(uint8_t out,const uint8_t *input, size_t input_size);
Thus it appears to me that both the benefit and the cost of -Werror for your library is small.
- deleted 5y ago[deleted]
- loup-vaillant 5y ago> But once in a blue moon they are, so why not be cautious? You have to balance the inconvenience of false positives against the consequences of false negatives. If the false negatives are rare enough, compared to the false positives, it might be best not to be cautious. Still, in practice I am fairly cautious, and tolerate zero warning. When someone reports a warning to me, I always try to fix it. So in practice, what I do is fairly close to -Werror, with one big difference: if some compiler comes up with some new warning, or if a set of compilers are impossible to please at the same time, my users aren't blocked. Which is important, because new warnings are now overwhelmingly likely to be false positives. That mismatch bound you just showed however does set off my alarm bells. I'll need to make sure I actually got rid of it.