All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrea Claudi <aclaudi@redhat.com>
To: netdev@vger.kernel.org
Cc: stephen@networkplumber.org, dsahern@gmail.com, sgallagh@redhat.com
Subject: [PATCH] iproute2: fix build failure on ppc64le
Date: Fri,  9 Feb 2024 11:24:47 +0100	[thread overview]
Message-ID: <d13ef7c00b60a50a5e8ddbb7ff138399689d3483.1707474099.git.aclaudi@redhat.com> (raw)

ppc64le build fails with error on ifstat.c when
-Wincompatible-pointer-types is enabled:

ifstat.c: In function ‘dump_raw_db’:
ifstat.c:323:44: error: initialization of ‘long long unsigned int *’ from incompatible pointer type ‘__u64 *’ {aka ‘long unsigned int *’} [-Wincompatible-pointer-types]
  323 |                 unsigned long long *vals = n->val;

Several other warnings are produced when -Wformat= is set, for example:

ss.c:3244:34: warning: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 2 has type ‘__u64’ {aka ‘long unsigned int’} [-Wformat=]
 3244 |                 out(" rcv_nxt:%llu", s->mptcpi_rcv_nxt);
      |                               ~~~^   ~~~~~~~~~~~~~~~~~
      |                                  |    |
      |                                  |    __u64 {aka long unsigned int}
      |                                  long long unsigned int
      |                               %lu

This happens because __u64 is defined as long unsigned on ppc64le.  As
pointed out by Florian Weimar, we should use -D__SANE_USERSPACE_TYPES__
if we really want to use long long unsigned in iproute2.

This fix the build failure and all the warnings without any change on
the code itself.

Suggested-by: Florian Weimer <fweimer@redhat.com>
Signed-off-by: Andrea Claudi <aclaudi@redhat.com>
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 8024d45e..3b9daede 100644
--- a/Makefile
+++ b/Makefile
@@ -60,7 +60,7 @@ CC := gcc
 HOSTCC ?= $(CC)
 DEFINES += -D_GNU_SOURCE
 # Turn on transparent support for LFS
-DEFINES += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
+DEFINES += -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D__SANE_USERSPACE_TYPES__
 CCOPTS = -O2 -pipe
 WFLAGS := -Wall -Wstrict-prototypes  -Wmissing-prototypes
 WFLAGS += -Wmissing-declarations -Wold-style-definition -Wformat=2
-- 
2.43.0


             reply	other threads:[~2024-02-09 10:25 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-09 10:24 Andrea Claudi [this message]
2024-02-09 12:02 ` [PATCH] iproute2: fix build failure on ppc64le Andrea Claudi
2024-02-09 16:35 ` Stephen Hemminger
2024-02-09 22:14   ` David Ahern
2024-02-10  0:45     ` Stephen Hemminger
2024-02-14 15:30       ` Andrea Claudi
2024-02-14 15:49         ` David Ahern
2024-02-15  3:05           ` Stephen Hemminger
2024-02-15  3:10             ` David Ahern
2024-02-16  9:57               ` Andrea Claudi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d13ef7c00b60a50a5e8ddbb7ff138399689d3483.1707474099.git.aclaudi@redhat.com \
    --to=aclaudi@redhat.com \
    --cc=dsahern@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=sgallagh@redhat.com \
    --cc=stephen@networkplumber.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.