b.a.t.m.a.n.lists.open-mesh.org archive mirror
 help / color / mirror / Atom feed
* [B.A.T.M.A.N.] [PATCH] batctl: Work around uclibc collision for __unused
@ 2016-09-04 18:23 Sven Eckelmann
  2016-09-15 14:02 ` [B.A.T.M.A.N.] " Andreas Pape
  2016-10-18 12:29 ` Sven Eckelmann
  0 siblings, 2 replies; 3+ messages in thread
From: Sven Eckelmann @ 2016-09-04 18:23 UTC (permalink / raw)
  To: b.a.t.m.a.n

uclibc on 64 bit systems uses struct members called __unused. These
conflict with the definition of __unused in batctl. Such a conflict results
in a build error because the struct member will be replaced with the
__attribute__((unused)).

This can be avoided by renaming it to the Linux kernel name
"__maybe_unused".

Signed-off-by: Sven Eckelmann <sven@narfation.org>
---
 genl.c     |  4 ++--
 main.h     |  2 +-
 netlink.c  | 10 +++++-----
 tp_meter.c |  5 +++--
 4 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/genl.c b/genl.c
index b6f66fd..36fc27e 100644
--- a/genl.c
+++ b/genl.c
@@ -34,7 +34,7 @@
 
 #include "batman_adv.h"
 
-static int mcast_error_handler(struct sockaddr_nl *nla __unused,
+static int mcast_error_handler(struct sockaddr_nl *nla __maybe_unused,
 			       struct nlmsgerr *err, void *arg)
 {
 	int *ret = arg;
@@ -42,7 +42,7 @@ static int mcast_error_handler(struct sockaddr_nl *nla __unused,
 	return NL_STOP;
 }
 
-static int mcast_ack_handler(struct nl_msg *msg __unused, void *arg)
+static int mcast_ack_handler(struct nl_msg *msg __maybe_unused, void *arg)
 {
 	int *ret = arg;
 	*ret = 0;
diff --git a/main.h b/main.h
index 6365cdb..dbde6dd 100644
--- a/main.h
+++ b/main.h
@@ -47,7 +47,7 @@
 #endif
 
 #define __packed __attribute((packed))   /* linux kernel compat */
-#define __unused __attribute__((unused))
+#define __maybe_unused __attribute__((unused))
 #define BIT(nr)                 (1UL << (nr)) /* linux kernel compat */
 
 typedef uint8_t u8; /* linux kernel compat */
diff --git a/netlink.c b/netlink.c
index e8e94b2..8fce3d8 100644
--- a/netlink.c
+++ b/netlink.c
@@ -134,9 +134,9 @@ static int missing_mandatory_attrs(struct nlattr *attrs[],
 	return 0;
 }
 
-static int print_error(struct sockaddr_nl *nla __unused,
+static int print_error(struct sockaddr_nl *nla __maybe_unused,
 		       struct nlmsgerr *nlerr,
-		       void *arg __unused)
+		       void *arg __maybe_unused)
 {
 	if (nlerr->error != -EOPNOTSUPP)
 		fprintf(stderr, "Error received: %s\n",
@@ -147,7 +147,7 @@ static int print_error(struct sockaddr_nl *nla __unused,
 	return NL_STOP;
 }
 
-static int stop_callback(struct nl_msg *msg, void *arg __unused)
+static int stop_callback(struct nl_msg *msg, void *arg __maybe_unused)
 {
 	struct nlmsghdr *nlh = nlmsg_hdr(msg);
 	int *error = nlmsg_data(nlh);
@@ -345,7 +345,7 @@ static const int routing_algos_mandatory[] = {
 	BATADV_ATTR_ALGO_NAME,
 };
 
-static int routing_algos_callback(struct nl_msg *msg, void *arg __unused)
+static int routing_algos_callback(struct nl_msg *msg, void *arg __maybe_unused)
 {
 	struct nlattr *attrs[BATADV_ATTR_MAX+1];
 	struct nlmsghdr *nlh = nlmsg_hdr(msg);
@@ -1286,7 +1286,7 @@ int netlink_print_bla_backbone(char *mesh_iface, char *orig_iface, int read_opts
 				    bla_backbone_callback);
 }
 
-static int nlquery_error_cb(struct sockaddr_nl *nla __unused,
+static int nlquery_error_cb(struct sockaddr_nl *nla __maybe_unused,
 			    struct nlmsgerr *nlerr, void *arg)
 {
 	struct nlquery_opts *query_opts = arg;
diff --git a/tp_meter.c b/tp_meter.c
index 43c19da..a402e45 100644
--- a/tp_meter.c
+++ b/tp_meter.c
@@ -66,7 +66,7 @@ struct tp_cookie {
 	uint32_t cookie;
 };
 
-static int tpmeter_nl_print_error(struct sockaddr_nl *nla __unused,
+static int tpmeter_nl_print_error(struct sockaddr_nl *nla __maybe_unused,
 				  struct nlmsgerr *nlerr,
 				  void *arg)
 {
@@ -236,7 +236,8 @@ out:
 	return err;
 }
 
-static int no_seq_check(struct nl_msg *msg __unused, void *arg __unused)
+static int no_seq_check(struct nl_msg *msg __maybe_unused,
+			void *arg __maybe_unused)
 {
 	return NL_OK;
 }
-- 
2.9.3


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

* Re: [B.A.T.M.A.N.] batctl: Work around uclibc collision for __unused
  2016-09-04 18:23 [B.A.T.M.A.N.] [PATCH] batctl: Work around uclibc collision for __unused Sven Eckelmann
@ 2016-09-15 14:02 ` Andreas Pape
  2016-10-18 12:29 ` Sven Eckelmann
  1 sibling, 0 replies; 3+ messages in thread
From: Andreas Pape @ 2016-09-15 14:02 UTC (permalink / raw)
  To: Sven Eckelmann; +Cc: b.a.t.m.a.n

On Sun,  4 Sep 2016 20:23:31 +0200
Sven Eckelmann <sven@narfation.org> wrote:

> uclibc on 64 bit systems uses struct members called __unused. These
> conflict with the definition of __unused in batctl. Such a conflict
> results in a build error because the struct member will be replaced with
> the __attribute__((unused)).
>
> This can be avoided by renaming it to the Linux kernel name
> "__maybe_unused".
>
> Signed-off-by: Sven Eckelmann <sven@narfation.org>

Tested-by: Andreas Pape <apape@phoenixcontact.com>


..................................................................
PHOENIX CONTACT ELECTRONICS GmbH

Sitz der Gesellschaft / registered office of the company: 31812 Bad Pyrmont
USt-Id-Nr.: DE811742156
Amtsgericht Hannover HRB 100528 / district court Hannover HRB 100528
Geschäftsführer / Executive Board: Ulrich Leidecker, Christoph Leifer
__________________________________________________________________
Diese E-Mail enthält vertrauliche und/oder rechtlich geschützte Informationen. Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben, informieren Sie bitte sofort den Absender und vernichten Sie diese Mail. Das unerlaubte Kopieren, jegliche anderweitige Verwendung sowie die unbefugte Weitergabe dieser Mail ist nicht gestattet.
----------------------------------------------------------------------------------------------------
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure, distribution or other use of the material or parts thereof is strictly forbidden.
___________________________________________________________________

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

* Re: [B.A.T.M.A.N.] batctl: Work around uclibc collision for __unused
  2016-09-04 18:23 [B.A.T.M.A.N.] [PATCH] batctl: Work around uclibc collision for __unused Sven Eckelmann
  2016-09-15 14:02 ` [B.A.T.M.A.N.] " Andreas Pape
@ 2016-10-18 12:29 ` Sven Eckelmann
  1 sibling, 0 replies; 3+ messages in thread
From: Sven Eckelmann @ 2016-10-18 12:29 UTC (permalink / raw)
  To: b.a.t.m.a.n

[-- Attachment #1: Type: text/plain, Size: 836 bytes --]

On Sonntag, 4. September 2016 20:23:31 CEST Sven Eckelmann wrote:
> uclibc on 64 bit systems uses struct members called __unused. These
> conflict with the definition of __unused in batctl. Such a conflict results
> in a build error because the struct member will be replaced with the
> __attribute__((unused)).
> 
> This can be avoided by renaming it to the Linux kernel name
> "__maybe_unused".
> 
> Signed-off-by: Sven Eckelmann <sven@narfation.org>
> Tested-by: Andreas Pape <apape@phoenixcontact.com>
> ---
>  genl.c     |  4 ++--
>  main.h     |  2 +-
>  netlink.c  | 10 +++++-----
>  tp_meter.c |  5 +++--
>  4 files changed, 11 insertions(+), 10 deletions(-)

Applied in 7402351d3bef02d8dac2e9b68a9e3eca472fd33d [1].

Kind regards,
	Sven

[1] https://git.open-mesh.org/batctl.git/commit/7402351d3bef02d8dac2e9b68a9e3eca472fd33d

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 801 bytes --]

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

end of thread, other threads:[~2016-10-18 12:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-04 18:23 [B.A.T.M.A.N.] [PATCH] batctl: Work around uclibc collision for __unused Sven Eckelmann
2016-09-15 14:02 ` [B.A.T.M.A.N.] " Andreas Pape
2016-10-18 12:29 ` Sven Eckelmann

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).