Skip to content

-Wunreachable-code

Junio C Hamano git 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v3 Latest3 patches 6 repliesIn review
  2. v23 patches 5 repliesSuperseded

Patches in v3 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3run-command: use errno to check for sigfillset() errorrun-command.c+9 -10 replies
2/3git-compat-util: add NOT_CONSTANT macro and use it in atfork_prepare()Makefile compiler-tricks/not-a-constant.c git-compat-util.h +2 more+18 -75 replies
3/3config.mak.dev: enable -Wunreachable-codeconfig.mak.dev meson.build+2 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v3 yet.

Read the v3 thread

Cover letter [PATCH v3 0/3] -Wunreachable-code

As Taylor noticed, we can still help macOS users by first dealing with the false positive in the code, and then flip the warning option for developers on.

[1/3] run-command: use errno to check for sigfillset() error

This was our first "workaround" that is very specific to the code that gets falsely flagged by the compiler.

[2/3] git-compat-util: add NOT_CONSTANT macro and use it in atfork_prepare()

This adds a more generic way to work around a false positive from -Wunreachable-code to prevent compilers from optimize away expressions that are used in conditionals, and rewrite the earlier workaround with it.

[3/3] config.mak.dev: enable -Wunreachable-code

Now we worked around known false positive of -Wunreachable-code, we force it upon our developers, including macOS ones.

This is totally offtopic, but I often find the short-log (list of commits, grouped by author) in the cover letter very awkward to work with. Between v2 and v3, aside from the NOT_CONSTANT() improvements in the patch [2/3] that used to be [3/3], one large change is the reordering of the patches but that is not seen in the shortlog (I ran "git log --oneline -reverse" to prepare the list of commits in the order they are applied to describe them in the above list).

Jeff King (2):
run-command: use errno to check for sigfillset() error config.mak.dev: enable -Wunreachable-code

Junio C Hamano (1):
git-compat-util: add NOT_CONSTANT macro and use it in atfork_prepare()

 Makefile                         | 1 +
 compiler-tricks/not-a-constant.c | 2 ++
 config.mak.dev                   | 1 +
 git-compat-util.h                | 9 +++++++++
 meson.build                      | 2 ++
 run-command.c                    | 8 +++++++-
 6 files changed, 22 insertions(+), 1 deletion(-)
 create mode 100644 compiler-tricks/not-a-constant.c
Signature · 1 line
2.49.0-207-gc8924421c3