* [PATCH] Fix -Wunused error
@ 2016-11-25 1:37 Yury Norov
2016-11-27 2:56 ` Dave Jones
0 siblings, 1 reply; 3+ messages in thread
From: Yury Norov @ 2016-11-25 1:37 UTC (permalink / raw)
To: trinity; +Cc: Yury Norov, Andrew Pinski, Steve Ellcey
I try to build trinity for aarch64. In my configuration USE_PPPOL2TPIN6
is not defined, and it makes some functions have unused variables. GCC
treats it as error. This patch fixes it.
Signed-off-by: Yury Norov <ynorov@caviumnetworks.com>
---
net/proto-pppox.c | 9 +++++++++
rand/seed.c | 2 ++
2 files changed, 11 insertions(+)
diff --git a/net/proto-pppox.c b/net/proto-pppox.c
index 9deb045..bdec306 100644
--- a/net/proto-pppox.c
+++ b/net/proto-pppox.c
@@ -83,6 +83,9 @@ static void pppox_PX_PROTO_OL2TP_PPPoL2TPin6(struct sockaddr **addr, socklen_t *
pppol2tpin6->pppol2tp.addr.sin6_scope_id = rnd();
*addr = (struct sockaddr *) pppol2tpin6;
*addrlen = sizeof(struct sockaddr_pppol2tpin6);
+#else
+ (void) addr;
+ (void) addrlen;
#endif
}
@@ -104,6 +107,9 @@ static void pppox_PX_PROTO_OL2TP_PPPoL2TPv3(struct sockaddr **addr, socklen_t *a
pppol2tpv3->pppol2tp.d_session = rnd();
*addr = (struct sockaddr *) pppol2tpv3;
*addrlen = sizeof(struct sockaddr_pppol2tpv3);
+#else
+ (void) addr;
+ (void) addrlen;
#endif
}
@@ -132,6 +138,9 @@ static void pppox_PX_PROTO_OL2TP_PPPoL2TPv3in6(struct sockaddr **addr, socklen_t
pppol2tpv3in6->pppol2tp.addr.sin6_scope_id = rnd();
*addr = (struct sockaddr *) pppol2tpv3in6;
*addrlen = sizeof(struct sockaddr_pppol2tpv3in6);
+#else
+ (void) addr;
+ (void) addrlen;
#endif
}
diff --git a/rand/seed.c b/rand/seed.c
index 2e4f84f..1490f79 100644
--- a/rand/seed.c
+++ b/rand/seed.c
@@ -48,6 +48,8 @@ static int do_getrandom(unsigned int *buf)
ret = syscall(SYS_getrandom, buf, 4, 0);
if (ret > 0)
return TRUE;
+#else
+ (void) buf;
#endif
return FALSE;
}
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] Fix -Wunused error
2016-11-25 1:37 [PATCH] Fix -Wunused error Yury Norov
@ 2016-11-27 2:56 ` Dave Jones
2016-11-27 7:20 ` Yury Norov
0 siblings, 1 reply; 3+ messages in thread
From: Dave Jones @ 2016-11-27 2:56 UTC (permalink / raw)
To: Yury Norov; +Cc: trinity, Andrew Pinski, Steve Ellcey
On Fri, Nov 25, 2016 at 07:07:48AM +0530, Yury Norov wrote:
> I try to build trinity for aarch64. In my configuration USE_PPPOL2TPIN6
> is not defined, and it makes some functions have unused variables. GCC
> treats it as error. This patch fixes it.
>
> Signed-off-by: Yury Norov <ynorov@caviumnetworks.com>
> ---
> net/proto-pppox.c | 9 +++++++++
> rand/seed.c | 2 ++
> 2 files changed, 11 insertions(+)
>
> diff --git a/net/proto-pppox.c b/net/proto-pppox.c
> index 9deb045..bdec306 100644
> --- a/net/proto-pppox.c
> +++ b/net/proto-pppox.c
> @@ -83,6 +83,9 @@ static void pppox_PX_PROTO_OL2TP_PPPoL2TPin6(struct sockaddr **addr, socklen_t *
> pppol2tpin6->pppol2tp.addr.sin6_scope_id = rnd();
> *addr = (struct sockaddr *) pppol2tpin6;
> *addrlen = sizeof(struct sockaddr_pppol2tpin6);
> +#else
> + (void) addr;
> + (void) addrlen;
Instead of doing it this way, just add __unused__ tags to the variable
declarations. (In the case where they're actually used, it doesn't
matter)
thanks,
Dave
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Fix -Wunused error
2016-11-27 2:56 ` Dave Jones
@ 2016-11-27 7:20 ` Yury Norov
0 siblings, 0 replies; 3+ messages in thread
From: Yury Norov @ 2016-11-27 7:20 UTC (permalink / raw)
To: Dave Jones; +Cc: trinity, Andrew Pinski, Steve Ellcey
On Sat, Nov 26, 2016 at 09:56:15PM -0500, Dave Jones wrote:
> On Fri, Nov 25, 2016 at 07:07:48AM +0530, Yury Norov wrote:
> > I try to build trinity for aarch64. In my configuration USE_PPPOL2TPIN6
> > is not defined, and it makes some functions have unused variables. GCC
> > treats it as error. This patch fixes it.
> >
> > Signed-off-by: Yury Norov <ynorov@caviumnetworks.com>
> > ---
> > net/proto-pppox.c | 9 +++++++++
> > rand/seed.c | 2 ++
> > 2 files changed, 11 insertions(+)
> >
> > diff --git a/net/proto-pppox.c b/net/proto-pppox.c
> > index 9deb045..bdec306 100644
> > --- a/net/proto-pppox.c
> > +++ b/net/proto-pppox.c
> > @@ -83,6 +83,9 @@ static void pppox_PX_PROTO_OL2TP_PPPoL2TPin6(struct sockaddr **addr, socklen_t *
> > pppol2tpin6->pppol2tp.addr.sin6_scope_id = rnd();
> > *addr = (struct sockaddr *) pppol2tpin6;
> > *addrlen = sizeof(struct sockaddr_pppol2tpin6);
> > +#else
> > + (void) addr;
> > + (void) addrlen;
>
> Instead of doing it this way, just add __unused__ tags to the variable
> declarations. (In the case where they're actually used, it doesn't
> matter)
>
> thanks,
>
> Dave
OK
Signed-off-by: Yury Norov <ynorov@caviumnetworks.com>
---
net/proto-pppox.c | 9 ++++++---
rand/seed.c | 2 +-
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/net/proto-pppox.c b/net/proto-pppox.c
index 9deb045..52288fa 100644
--- a/net/proto-pppox.c
+++ b/net/proto-pppox.c
@@ -58,7 +58,8 @@ static void pppox_PX_PROTO_OL2TP_PPPoL2TP(struct sockaddr **addr, socklen_t *add
*addrlen = sizeof(struct sockaddr_pppol2tp);
}
-static void pppox_PX_PROTO_OL2TP_PPPoL2TPin6(struct sockaddr **addr, socklen_t *addrlen)
+static void pppox_PX_PROTO_OL2TP_PPPoL2TPin6(__unused__ struct sockaddr **addr,
+ __unused__ socklen_t *addrlen)
{
#ifdef USE_PPPOL2TPIN6
struct sockaddr_pppol2tpin6 *pppol2tpin6;
@@ -86,7 +87,8 @@ static void pppox_PX_PROTO_OL2TP_PPPoL2TPin6(struct sockaddr **addr, socklen_t *
#endif
}
-static void pppox_PX_PROTO_OL2TP_PPPoL2TPv3(struct sockaddr **addr, socklen_t *addrlen)
+static void pppox_PX_PROTO_OL2TP_PPPoL2TPv3(__unused__ struct sockaddr **addr,
+ __unused__ socklen_t *addrlen)
{
#ifdef USE_PPPOL2TPV3
struct sockaddr_pppol2tpv3 *pppol2tpv3;
@@ -107,7 +109,8 @@ static void pppox_PX_PROTO_OL2TP_PPPoL2TPv3(struct sockaddr **addr, socklen_t *a
#endif
}
-static void pppox_PX_PROTO_OL2TP_PPPoL2TPv3in6(struct sockaddr **addr, socklen_t *addrlen)
+static void pppox_PX_PROTO_OL2TP_PPPoL2TPv3in6(__unused__ struct sockaddr **addr,
+ __unused__ socklen_t *addrlen)
{
#ifdef USE_PPPOL2TPIN6
struct sockaddr_pppol2tpv3in6 *pppol2tpv3in6;
diff --git a/rand/seed.c b/rand/seed.c
index 2e4f84f..87880a6 100644
--- a/rand/seed.c
+++ b/rand/seed.c
@@ -40,7 +40,7 @@ static int urandomfd;
* to store what gets passed in from the command line -s argument */
unsigned int seed = 0;
-static int do_getrandom(unsigned int *buf)
+static int do_getrandom(__unused__ unsigned int *buf)
{
#ifdef SYS_getrandom
int ret;
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-11-27 7:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-25 1:37 [PATCH] Fix -Wunused error Yury Norov
2016-11-27 2:56 ` Dave Jones
2016-11-27 7:20 ` Yury Norov
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 NNTP newsgroup(s).