git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH] submodule.h: use a named enum for RECURSE_SUBMODULES_*
@ 2022-01-05 19:26 Philippe Blain via GitGitGadget
  2022-01-05 21:20 ` Junio C Hamano
  2022-04-04 17:10 ` [PATCH v2] " Philippe Blain via GitGitGadget
  0 siblings, 2 replies; 7+ messages in thread
From: Philippe Blain via GitGitGadget @ 2022-01-05 19:26 UTC (permalink / raw)
  To: git; +Cc: Emily Shaffer, Glen Choo, Philippe Blain, Philippe Blain

From: Philippe Blain <levraiphilippeblain@gmail.com>

Using a named enum allows casting an integer to the enum type in both
GDB and LLDB:

    (gdb) p (enum diff_submodule_format) options->submodule_format
    $1 = DIFF_SUBMODULE_LOG

    (lldb) p (diff_submodule_format) options->submodule_format
    (diff_submodule_format) $1 = DIFF_SUBMODULE_LOG

In LLDB, it's also required to cast in the reversed direction, i.e.
cast an enum constant into its corresponding integer:

    (lldb) p (int) diff_submodule_format::DIFF_SUBMODULE_SHORT
    (int) $0 = 0

Name the enum listing the different RECURSE_SUBMODULES_* modes, to make
debugging easier.

Signed-off-by: Philippe Blain <levraiphilippeblain@gmail.com>
---
    submodule.h: use a named enum for RECURSE_SUBMODULES_*

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-1111%2Fphil-blain%2Fsubmodule-recurse-enum-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-1111/phil-blain/submodule-recurse-enum-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/1111

 submodule.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/submodule.h b/submodule.h
index 6bd2c99fd99..55cf6f01d0c 100644
--- a/submodule.h
+++ b/submodule.h
@@ -13,7 +13,7 @@ struct repository;
 struct string_list;
 struct strbuf;
 
-enum {
+enum submodule_recurse_mode {
 	RECURSE_SUBMODULES_ONLY = -5,
 	RECURSE_SUBMODULES_CHECK = -4,
 	RECURSE_SUBMODULES_ERROR = -3,

base-commit: 2ae0a9cb8298185a94e5998086f380a355dd8907
-- 
gitgitgadget

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

end of thread, other threads:[~2022-04-04 21:42 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-01-05 19:26 [PATCH] submodule.h: use a named enum for RECURSE_SUBMODULES_* Philippe Blain via GitGitGadget
2022-01-05 21:20 ` Junio C Hamano
2022-01-07 13:27   ` Philippe Blain
2022-01-07 17:43     ` Glen Choo
2022-01-18 18:20   ` Glen Choo
2022-04-04 17:10 ` [PATCH v2] " Philippe Blain via GitGitGadget
2022-04-04 17:52   ` Glen Choo

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).