threads / patch / 33636

patch, 6 partsclone: Make the 'junk_mode' symbol a file static

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

## tl;dr

3 messages between Apr 27, 2013 and Apr 28, 2013. Diffs are folded; open one to read it.

replies: 2people: 3as markdown or json

Ramsay Jones· Apr 27, 2013, 18:39 UTC · lore

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.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
---
 builtin/clone.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Show changes to builtin/clone.c +1 −1
diff --git a/builtin/clone.c b/builtin/clone.c
index 58fee98..035ab64 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -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
-- 
1.8.2
Jeff King· Apr 27, 2013, 23:21 UTC · re: Ramsay Jones · lore

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

On Sat, Apr 27, 2013 at 07:39:04PM +0100, Ramsay Jones wrote:
Show 8 quoted lines
> 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.
> [...]
> -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
Eric Sunshine· Apr 28, 2013, 01:55 UTC · re: Ramsay Jones · lore

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

On Sat, Apr 27, 2013 at 2:39 PM, Ramsay Jones <ramsay@ramsay1.demon.co.uk> wrote:

> 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/
> Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>

← back to recent threads