mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alexander Alemayhu <alexander@alemayhu.com>
To: linux-kernel@vger.kernel.org
Cc: rientjes@google.com, torvalds@linux-foundation.org,
	Alexander Alemayhu <alexander@alemayhu.com>
Subject: [PATCH] compiler, clang: check before defining inline
Date: Sun, 11 Jun 2017 01:55:20 +0200	[thread overview]
Message-ID: <1497138920-27052-1-git-send-email-alexander@alemayhu.com> (raw)

Fixes the compiler warning below introduced in abb2ea7dfd82 (compiler, clang:
suppress warning for unused static inline functions, 2017-06-06)

./include/linux/compiler-gcc.h:78:9: note: previous definition is here
        ^
1 warning generated.
clang  -nostdinc -isystem /usr/lib/gcc/x86_64-redhat-linux/6.3.1/include -I./arch/x86/include -I./arch/x86/include/generated/uapi -I./arch/x86/include/generated  -I./include -I./arch/x86/include/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/kconfig.h  \
	-D__KERNEL__ -D__ASM_SYSREG_H -Wno-unused-value -Wno-pointer-sign \
	-Wno-compare-distinct-pointer-types \
	-Wno-gnu-variable-sized-type-not-at-end \
	-Wno-address-of-packed-member -Wno-tautological-compare \
	-Wno-unknown-warning-option \
	-O2 -emit-llvm -c /home/vagrant/kernels/net-next/samples/bpf/test_map_in_map_kern.c -o -| llc -march=bpf -filetype=obj -o /home/vagrant/kernels/net-next/samples/bpf/test_map_in_map_kern.o
In file included from /home/vagrant/kernels/net-next/samples/bpf/test_map_in_map_kern.c:9:
In file included from ./include/linux/ptrace.h:4:
In file included from ./include/linux/compiler.h:82:
./include/linux/compiler-clang.h:24:9: warning: 'inline' macro redefined [-Wmacro-redefined]
        ^
./include/linux/compiler-gcc.h:78:9: note: previous definition is here
        ^
1 warning generated.
make[1]: Leaving directory '/home/vagrant/kernels/net-next'

$ clang --version
clang version 3.9.1 (tags/RELEASE_391/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

$ gcc --version
gcc (GCC) 6.3.1 20161221 (Red Hat 6.3.1-1)
Copyright (C) 2016 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Fixes: abb2ea7dfd82 ("compiler, clang: suppress warning for unused static inline functions")
Signed-off-by: Alexander Alemayhu <alexander@alemayhu.com>
---

This is causing an error on out of tree builds for example using the
prototype-kernel repository. Should this be sent to Linus?

Thanks

 include/linux/compiler-clang.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/include/linux/compiler-clang.h b/include/linux/compiler-clang.h
index ea9126006a69..7cb55de2703c 100644
--- a/include/linux/compiler-clang.h
+++ b/include/linux/compiler-clang.h
@@ -21,4 +21,6 @@
  * -Wunused-function.  This turns out to avoid the need for complex #ifdef
  * directives.  Suppress the warning in clang as well.
  */
+#ifndef inline
 #define inline inline __attribute__((unused))
+#endif
-- 
2.7.4

             reply	other threads:[~2017-06-11  0:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-10 23:55 Alexander Alemayhu [this message]
2017-06-10 23:59 ` Alexander Alemayhu

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=1497138920-27052-1-git-send-email-alexander@alemayhu.com \
    --to=alexander@alemayhu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rientjes@google.com \
    --cc=torvalds@linux-foundation.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

all inboxes | Powered by JetHome®