All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 0/6] Compile cleanly in pedantic mode
@ 2018-07-08 14:43 Beat Bolli
  2018-07-08 14:43 ` [RFC PATCH 1/6] connect.h: avoid forward declaration of an enum Beat Bolli
                   ` (14 more replies)
  0 siblings, 15 replies; 39+ messages in thread
From: Beat Bolli @ 2018-07-08 14:43 UTC (permalink / raw)
  To: git; +Cc: gitster, Beat Bolli

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

[0] https://public-inbox.org/git/53ab8626-f862-a732-b369-abeab69a468f@ramsayjones.plus.com/T/

^ permalink raw reply	[flat|nested] 39+ messages in thread

end of thread, other threads:[~2018-07-12 15:40 UTC | newest]

Thread overview: 39+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-08 14:43 [RFC PATCH 0/6] Compile cleanly in pedantic mode Beat Bolli
2018-07-08 14:43 ` [RFC PATCH 1/6] connect.h: avoid forward declaration of an enum Beat Bolli
2018-07-08 14:43 ` [RFC PATCH 2/6] refs/refs-internal.h: " Beat Bolli
2018-07-09 18:46   ` Jeff King
2018-07-09 19:30     ` Beat Bolli
2018-07-10  2:15       ` Jeff King
2018-07-08 14:43 ` [RFC PATCH 3/6] convert.c: replace "\e" escapes with "\033" Beat Bolli
2018-07-08 14:43 ` [RFC PATCH 4/6] sequencer.c: avoid empty statements at top level Beat Bolli
2018-07-08 20:54   ` Eric Sunshine
2018-07-08 21:17     ` Philip Oakley
2018-07-09  9:37       ` ig
2018-07-09 21:34   ` Junio C Hamano
2018-07-09 21:37     ` Beat Bolli
2018-07-08 14:43 ` [RFC PATCH 5/6] string-list.c: avoid conversion from void * to function pointer Beat Bolli
2018-07-08 14:43 ` [RFC PATCH 6/6] utf8.c: avoid char overflow Beat Bolli
2018-07-09 13:14   ` Johannes Schindelin
2018-07-09 14:48     ` Beat Bolli
2018-07-09 15:45       ` Beat Bolli
2018-07-09 16:33       ` Junio C Hamano
2018-07-09 17:56         ` Beat Bolli
2018-07-09 18:18         ` Junio C Hamano
2018-07-09 20:04       ` Johannes Schindelin
2018-07-09 13:40 ` [RFC PATCH 0/6] Compile cleanly in pedantic mode Johannes Schindelin
2018-07-09 16:25 ` Junio C Hamano
2018-07-09 19:25 ` [PATCH " Beat Bolli
2018-07-09 20:25   ` Beat Bolli
2018-07-09 21:45   ` Junio C Hamano
2018-07-09 21:47     ` Beat Bolli
2018-07-10  7:34     ` Beat Bolli
2018-07-11 15:42       ` Junio C Hamano
2018-07-12 13:25         ` Johannes Schindelin
2018-07-12 15:40           ` Junio C Hamano
2018-07-09 19:25 ` [PATCH 1/6] connect.h: avoid forward declaration of an enum Beat Bolli
2018-07-09 19:25 ` [PATCH 2/6] refs/refs-internal.h: " Beat Bolli
2018-07-09 19:25 ` [PATCH 3/6] convert.c: replace "\e" escapes with "\033" Beat Bolli
2018-07-09 19:25 ` [PATCH 4/6] sequencer.c: avoid empty statements at top level Beat Bolli
2018-07-09 21:37   ` Junio C Hamano
2018-07-09 19:25 ` [PATCH 5/6] string-list.c: avoid conversion from void * to function pointer Beat Bolli
2018-07-09 19:25 ` [PATCH 6/6] utf8.c: avoid char overflow Beat Bolli

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.