RFC Compile cleanly in pedantic mode
Get series with b4
b4 am [email protected]Versions newest first
- v1 RFC Latest6 patches 18 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/6 | connect.h: avoid forward declaration of an enumconnect.h | +2 | 0 replies | |
| 1/6 | connect.h: avoid forward declaration of an enumconnect.h | +2 | 0 replies | |
| 2/6 | refs/refs-internal.h: avoid forward declaration of an enumrefs/ | +2 | 3 replies | |
| 2/6 | refs/refs-internal.h: avoid forward declaration of an enumrefs/ | +2 | 0 replies | |
| 3/6 | convert.c: replace "\e" escapes with "\033".convert.c | +1 | 0 replies | |
| 3/6 | convert.c: replace "\e" escapes with "\033".convert.c | +1 | 0 replies | |
| 4/6 | sequencer.c: avoid empty statements at top levelsequencer.c | +2 | 5 replies | |
| 4/6 | sequencer.c: avoid empty statements at top levelpath.h sequencer.c | +3 | 1 reply | |
| 5/6 | string-list.c: avoid conversion from void * to function pointerstring-list.c | +14 | 0 replies | |
| 5/6 | string-list.c: avoid conversion from void * to function pointerstring-list.c | +14 | 0 replies | |
| 6/6 | utf8.c: avoid char overflowutf8.c | +5 | 7 replies | |
| 6/6 | utf8.c: avoid char overflowutf8.c | +4 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [RFC PATCH 0/6] Compile cleanly in pedantic mode
While developing 6aaded550 ("builtin/config: work around an unsized array forward declaration", 2018-07-05), I have compiled Git with CFLAGS="-std=c99 -pedantic".
This is an RFC patch series that fixes a few compiler warnings when compiling with these options, always assuming that this is a worthwile goal.
Note that all warnings were produced by -pedantic; the C99 standard option by itself didn't cause any of them.
The warnings were:
1) Char arrays initialized from a parenthesized string.
Suppressed by defining USE_PARENS_AROUND_GETTEXT_N to 0 globally. This was done just to keep the amount of warnings manageable; this series leaves that knob alone. The advantage of not mistakenly concatenating two translated strings is greater.
2) connect.h, refs/refs-internal.h: Forward reference to an enum.
Added two #includes that define the enums. This was already (inconclusively) talked about in [0].
3) convert.c: Invalid escape sequence "\e".
Replaced with "\033".
4) seqencer.c: Empty statements at top level.
Removed the extra semicolons.
5) string-list.c: Forbidden to cast from void * to a function pointer and vice versa.
Encapsulated the function pointer in a context struct. This is controversial because it has a performance impact, namely one additional pointer dereference per string comparison. An alternative might be to use multiple casts via intptr_t. But I'm not sure if this is worth the trouble.
6) utf8.c: overflow of char values.
Use unsigned char for the BOM constants.
This series has patches for 2) to 6).
Regards,
Beat