From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932627AbdBVOWt (ORCPT ); Wed, 22 Feb 2017 09:22:49 -0500 Received: from out4-smtp.messagingengine.com ([66.111.4.28]:44427 "EHLO out4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932368AbdBVOWk (ORCPT ); Wed, 22 Feb 2017 09:22:40 -0500 X-ME-Sender: X-Sasl-enc: own1CSYs/ZqyV919JokOJgIEXXX67p99TFa7GHVp8yaE 1487773358 Date: Wed, 22 Feb 2017 15:22:14 +0100 From: "greg@kroah.com" To: Joakim Tjernlund Cc: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" Subject: Re: [PATCH 1/2] Correct function definition for C++ Message-ID: <20170222142214.GA6830@kroah.com> References: <20170221152405.7552-1-joakim.tjernlund@infinera.com> <20170222071022.GA9186@kroah.com> <1487749844.5760.17.camel@infinera.com> <20170222130318.GB15769@kroah.com> <1487772051.5760.20.camel@infinera.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1487772051.5760.20.camel@infinera.com> User-Agent: Mutt/1.7.2 (2016-11-26) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 22, 2017 at 02:00:53PM +0000, Joakim Tjernlund wrote: > On Wed, 2017-02-22 at 14:03 +0100, greg@kroah.com wrote: > > On Wed, Feb 22, 2017 at 07:50:46AM +0000, Joakim Tjernlund wrote: > > > On Wed, 2017-02-22 at 08:10 +0100, Greg KH wrote: > > > > On Tue, Feb 21, 2017 at 04:24:04PM +0100, Joakim Tjernlund wrote: > > > > > C++ does does not like the extra extern before asmlinkage, remove it. > > > > > > > > > > Signed-off-by: Joakim Tjernlund > > > > > --- > > > > > include/linux/printk.h | 4 ++-- > > > > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > > > > > > > diff --git a/include/linux/printk.h b/include/linux/printk.h > > > > > index 3472cc6..be823f5 100644 > > > > > --- a/include/linux/printk.h > > > > > +++ b/include/linux/printk.h > > > > > > > > > > > > Why are you building this file with a C++ compiler? > > > > > > virtualbox uses C++ and includes various kernel headers and the build > > > fails, virtualbox guest additions has not build for quite some time now and > > > this is one of the problems. > > > > Virtualbox is a horrid pile of crap. You can quote me on that. We > > don't care about out-of-tree drivers, the authors should work to get > > them merged properly if they do care. > > Sure, I believe you :) > > But in this case it is not the kernel modules that fails, it is their > guest additions/xf86 video driver. Seem like that these need to include some > kernel herders there too. Seems like their build system is broken, it should not be including non uapi header files at all. > > Kernel code should be C, not C++, and if you do want to use C++, then > > you are on your own, sorry. > > But there are already a lot of C++ adjustments!? Just grepping for __cplusplus shows > plenty of hits and what is the point of asmlinkage then: > #ifdef __cplusplus > #define CPP_ASMLINKAGE extern "C" > #else > #define CPP_ASMLINKAGE > #endif > > #ifndef asmlinkage > #define asmlinkage CPP_ASMLINKAGE > #endif The usages in include/uapi/ make a bit of sense, but not much. Everything outside of there makes no sense at all (really just some drm and one scsi file.) They should be removed. > I read all of this that C++ code should be able to at least include kernel headers > without fatal errors.  For uapi stuff, yes. But that's not what you are doing here. You are trying to build kernel code with a c++ compiler. That's not going to work. How is a C++ compiler supposed to parse the following line in device.h struct class; (one of my most proud moments...) thanks, greg k-h