Skip to contentSkip to conversation

clone: Make the 'junk_mode' symbol a file static

PATCH In review Ramsay Jones 3 participants 3 messages Jun 15, 2016

lore
Share & tools
lore
#0 lore raw

PATCH 1/6 clone: Make the 'junk_mode' symbol a file static

Sparse issues an "'junk_mode' not declared. Should it be static?" warning. In order to suppress the warning, since this symbol does not need more than file visibility, we simply add the static modifier to it's declaration.

---
 builtin/clone.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
builtin/clone.c +1 -1
index 58fee98..035ab64 100644
@@ -387,7 +387,7 @@ static void clone_local(const char *src_repo, const char *dest_repo)
 static const char *junk_work_tree;
 static const char *junk_git_dir;
 static pid_t junk_pid;
-enum {
+static enum {
 	JUNK_LEAVE_NONE,
 	JUNK_LEAVE_REPO,
 	JUNK_LEAVE_ALL
Signature · 1 line
1.8.2
#1 lore raw

builtin/clone.c static void clone_local(const char *src_repo, const char *dest_repo) · line 391

Quoted 8 lines · Ramsay Jones

Sparse issues an "'junk_mode' not declared. Should it be static?" warning. In order to suppress the warning, since this symbol does not need more than file visibility, we simply add the static modifier to it's declaration.
[...]

builtin/clone.c +1 -1
-enum {
+static enum {
 	JUNK_LEAVE_NONE,

Thanks. This one was done by me, and yes it should be static. I think it is because I originally typed:

  enum junk_mode {
    ...
  };
  static enum junk_mode junk_mode;

and then later dropped the named type, but forgot to keep the static keyword.

-Peff

#2 lore raw
In reply to Ramsay Jones
Quoted 4 lines · Ramsay Jones

Sparse issues an "'junk_mode' not declared. Should it be static?" warning. In order to suppress the warning, since this symbol does not need more than file visibility, we simply add the static modifier to it's declaration.

s/it's/its/

Quoted 1 line