Skip to content
This repository has been archived by the owner on Dec 13, 2018. It is now read-only.

nsenter: fix the -Wunused-variable warning #439

Merged

Conversation

vbatts
Copy link
Contributor

@vbatts vbatts commented Mar 10, 2015

The change 699429e that allows the
constructor attribute to not be optimized out on gccgo has resulted in a
warning when compiling on the golang compiler.

./nsenter.go: In function ‘_cgo_51505a0edd5d_Cfunc_init’:
./nsenter.go:40:49: warning: unused variable ‘a’ [-Wunused-variable]

the generated code produced an unused struct like:

void
_cgo_d6cfae95ae01_Cfunc_init (void *v)
{
  struct
  {
    char unused;
  } __attribute__ ((__packed__, __gcc_struct__)) * a = v;
  init ();
}

Truly the "fix" would be upstream in cgo. If it knows it is producing an
unused struct, then it should also include attribute ((unused))

Signed-off-by: Vincent Batts vbatts@hashbangbash.com

The change 699429e that allows the
constructor attribute to not be optimized out on gccgo has resulted in a
warning when compiling on the golang compiler.

```
./nsenter.go: In function ‘_cgo_51505a0edd5d_Cfunc_init’:
./nsenter.go:40:49: warning: unused variable ‘a’ [-Wunused-variable]
```

the generated code produced an unused struct like:

```
void
_cgo_d6cfae95ae01_Cfunc_init (void *v)
{
  struct
  {
    char unused;
  } __attribute__ ((__packed__, __gcc_struct__)) * a = v;
  init ();
}
```

Truly the "fix" would be upstream in cgo. If it knows it is producing an
unused struct, then it should also include __attribute__ ((unused))

Signed-off-by: Vincent Batts <vbatts@hashbangbash.com>
@vbatts
Copy link
Contributor Author

vbatts commented Mar 10, 2015

ping @crosbymichael

@vmarmol
Copy link
Contributor

vmarmol commented Mar 10, 2015

LGTM, thanks! I was seeing this recently.

@mrunalp
Copy link
Contributor

mrunalp commented Mar 10, 2015

LGTM

mrunalp pushed a commit that referenced this pull request Mar 10, 2015
nsenter: fix the -Wunused-variable warning
@mrunalp mrunalp merged commit 2da1598 into docker-archive:master Mar 10, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants