From: Jason Gunthorpe <jgg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
To: linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: [PATCH rdma-core] Fix compiler warnings on PPC64 and others
Date: Thu, 8 Feb 2018 15:45:06 -0700 [thread overview]
Message-ID: <20180208224506.GA2462@ziepe.ca> (raw)
We have places in our code that assume __u64 is unsigned long long, and in
general this is the Linux kernel standard. However a few archs still use
unsigned long by default and require a -D__SANE_USERSPACE_TYPES__ to get
long long.
Detect this and provide the define to eliminate compilation warnings.
Signed-off-by: Jason Gunthorpe <jgg-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>
---
CMakeLists.txt | 14 ++++++++++++++
1 file changed, 14 insertions(+)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e63f4cf563677a..b08d3fd2cf4246 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -250,6 +250,20 @@ CHECK_C_SOURCE_COMPILES("
HAVE_FUNC_ATTRIBUTE_ALWAYS_INLINE
FAIL_REGEX "warning")
+# Linux __u64 is an unsigned long long
+CHECK_C_SOURCE_COMPILES("
+#include <linux/types.h>
+ int main(int argc,const char *argv[]) { __u64 tmp = 0; unsigned long long *tmp2 = &tmp; return *tmp2; }"
+ HAVE_LONG_LONG_U64
+ FAIL_REGEX "warning")
+
+if (NOT HAVE_LONG_LONG_U64)
+ # Modern Linux has switched to use ull in all cases, but to avoid disturbing
+ # userspace some platforms continued to use unsigned long by default. This
+ # define will cause kernel headers to consistently use unsigned long long
+ add_definitions("-D__SANE_USERSPACE_TYPES__")
+endif()
+
# Provide a shim if C11 stdatomic.h is not supported.
if (NOT HAVE_SPARSE)
CHECK_INCLUDE_FILE("stdatomic.h" HAVE_STDATOMIC)
--
2.16.1
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
reply other threads:[~2018-02-08 22:45 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20180208224506.GA2462@ziepe.ca \
--to=jgg-vpraknaxozvwk0htik3j/w@public.gmane.org \
--cc=linux-rdma-u79uwXL29TY76Z2rM5mHXA@public.gmane.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 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).