diff options
author | Ævar Arnfjörð Bjarmason <avarab@gmail.com> | 2017-05-25 19:45:25 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-05-26 12:52:37 +0900 |
commit | 374166cb381eef5498ac41f1f2835163ac656bdc (patch) | |
tree | 70adb68ff457a76a4e92e7b98d306bbf88535512 /streaming.h | |
parent | perf: add a comparison test of log --grep regex engines with -F (diff) | |
download | tgif-374166cb381eef5498ac41f1f2835163ac656bdc.tar.xz |
grep: catch a missing enum in switch statement
Add a die(...) to a default case for the switch statement selecting
between grep pattern types under --recurse-submodules.
Normally this would be caught by -Wswitch, but the grep_pattern_type
type is converted to int by going through parse_options(). Changing
the argument type passed to compile_submodule_options() won't work,
the value will just get coerced. The -Wswitch-default warning will
warn about it, but that produces a lot of noise across the codebase,
this potential issue would be drowned in that noise.
Thus catching this at runtime is the least bad option. This won't ever
trigger in practice, but if a new pattern type were to be added this
catches an otherwise silent bug during development.
See commit 0281e487fd ("grep: optionally recurse into submodules",
2016-12-16) for the initial addition of this code.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'streaming.h')
0 files changed, 0 insertions, 0 deletions