Received: by 10.213.65.68 with SMTP id h4csp1741080imn; Sun, 1 Apr 2018 13:42:41 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+cIA3BfdmLooxgwP1fznwVDhoQDdXnUwqzs3cc2aoMJjmffNF0otmmQ4OF8aFGHkGQJxhh X-Received: by 10.99.3.140 with SMTP id 134mr4533579pgd.92.1522615361645; Sun, 01 Apr 2018 13:42:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522615361; cv=none; d=google.com; s=arc-20160816; b=pX6WHPnSD4m6vMcRzBmgeLSb4C5FB/Uwn2maaCSvOydflSZ9tDhTqLyBdwztev4bng o3mteXLCN0HEf/1X3eMjfoiaBTFbCa6S2ZCSRwZX2vNj73jxI2vfLert1eyyk18ZiVf0 TvLZ1Ou5MLSwAxhEw7k7aBgixnGYpRjDGwlwlsA4LvFMU0LsG2nw6t6t/ry+nScdDcP3 Q3tnImRhCk0kKRTYvDG6adOUgKJiPTxaXua371okQMPq1rfZkzKCzO8oFOH3X2wR88IL jZa7GorF2760mVC1g832K/kKZ5QC+SOjR7a0SQwA56yX9KVnj1jvanPm3Ku2NcgEEHNd YwzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:to:from:subject :organization:arc-authentication-results; bh=8WqXY1pqr00tYLsT9Uo8FdpjbKXfG0htYc6W9YNFMC4=; b=P4jWrzUN9ZMAbV9qekj2CSgbJrczvO1On5ATJrV+onmBTo+xXdZJRBi4czbXDnpTPy 3Qt/Gk9apmuZH/779kH1t/fF+gzRFDNvJxdKI3DcT3VCwzcZk/RalmRGUF80f4ti9ROT wHPhawh0LUoVLlqe62NlMnBVJe3NzPvHEP38ja1SxUPsdYugXGmHsm1FOKKIwGFphlYy O7Vn0M5Xlfc9FrAbXGE8ggHbx53N4n+ysCjEr4pBQtyeixE8AsXI1eGr9ClluN1dY0Z/ pIqPiQIUB1CoQJPax0I7r4kq4NOIkUXTLuqGnx9zzQ4qjGQBDPwgsqykqwQPE0FMEDTf NyJg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y7-v6si8390501plk.347.2018.04.01.13.42.26; Sun, 01 Apr 2018 13:42:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754076AbeDAUkt (ORCPT + 99 others); Sun, 1 Apr 2018 16:40:49 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:43034 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753999AbeDAUkq (ORCPT ); Sun, 1 Apr 2018 16:40:46 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 42FBC406F890 for ; Sun, 1 Apr 2018 20:40:46 +0000 (UTC) Received: from warthog.procyon.org.uk (ovpn-120-59.rdu2.redhat.com [10.10.120.59]) by smtp.corp.redhat.com (Postfix) with ESMTP id CEF8CD7DF5; Sun, 1 Apr 2018 20:40:45 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 Subject: [PATCH 05/45] C++: Set compilation as C++ for .c files From: David Howells To: linux-kernel@vger.kernel.org Date: Sun, 01 Apr 2018 21:40:45 +0100 Message-ID: <152261524532.30503.16094079179209557382.stgit@warthog.procyon.org.uk> In-Reply-To: <152261521484.30503.16131389653845029164.stgit@warthog.procyon.org.uk> References: <152261521484.30503.16131389653845029164.stgit@warthog.procyon.org.uk> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Sun, 01 Apr 2018 20:40:46 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.7]); Sun, 01 Apr 2018 20:40:46 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'dhowells@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --- Makefile | 13 ++++--------- arch/x86/Makefile | 2 +- arch/x86/purgatory/Makefile | 2 +- include/linux/types.h | 4 ++++ scripts/checksyscalls.sh | 2 +- tools/power/cpupower/Makefile | 1 - tools/virtio/Makefile | 2 +- 7 files changed, 12 insertions(+), 14 deletions(-) diff --git a/Makefile b/Makefile index e02d092bc2d6..76e2ca8bf0fe 100644 --- a/Makefile +++ b/Makefile @@ -370,7 +370,7 @@ HOST_LOADLIBES := $(HOST_LFS_LIBS) # Make variables (CC, etc...) AS = $(CROSS_COMPILE)as LD = $(CROSS_COMPILE)ld -CC = $(CROSS_COMPILE)gcc +CC = $(CROSS_COMPILE)g++ CPP = $(CC) -E AR = $(CROSS_COMPILE)ar NM = $(CROSS_COMPILE)nm @@ -415,11 +415,12 @@ LINUXINCLUDE := \ $(USERINCLUDE) KBUILD_AFLAGS := -D__ASSEMBLY__ -KBUILD_CFLAGS := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \ +KBUILD_CFLAGS := -Wall -Wundef -Wno-trigraphs \ -fno-strict-aliasing -fno-common -fshort-wchar \ -Werror-implicit-function-declaration \ -Wno-format-security \ - -std=gnu89 + -std=gnu89 -Wno-pointer-arith \ + -fno-rtti -fno-exceptions -fpermissive KBUILD_CPPFLAGS := -D__KERNEL__ KBUILD_AFLAGS_KERNEL := KBUILD_CFLAGS_KERNEL := @@ -817,12 +818,6 @@ endif NOSTDINC_FLAGS += -nostdinc -isystem $(call shell-cached,$(CC) -print-file-name=include) CHECKFLAGS += $(NOSTDINC_FLAGS) -# warn about C99 declaration after statement -KBUILD_CFLAGS += $(call cc-option,-Wdeclaration-after-statement,) - -# disable pointer signed / unsigned warnings in gcc 4.0 -KBUILD_CFLAGS += $(call cc-disable-warning, pointer-sign) - # disable invalid "can't wrap" optimizations for signed / pointers KBUILD_CFLAGS += $(call cc-option,-fno-strict-overflow) diff --git a/arch/x86/Makefile b/arch/x86/Makefile index 498c1b812300..9933a5f2e628 100644 --- a/arch/x86/Makefile +++ b/arch/x86/Makefile @@ -33,7 +33,7 @@ M16_CFLAGS := $(call cc-option, -m16, $(CODE16GCC_CFLAGS)) REALMODE_CFLAGS := $(M16_CFLAGS) -g -Os -D__KERNEL__ \ -DDISABLE_BRANCH_PROFILING \ - -Wall -Wstrict-prototypes -march=i386 -mregparm=3 \ + -Wall -march=i386 -mregparm=3 \ -fno-strict-aliasing -fomit-frame-pointer -fno-pic \ -mno-mmx -mno-sse diff --git a/arch/x86/purgatory/Makefile b/arch/x86/purgatory/Makefile index 2f15a2ac4209..3911b8b1b140 100644 --- a/arch/x86/purgatory/Makefile +++ b/arch/x86/purgatory/Makefile @@ -16,7 +16,7 @@ KCOV_INSTRUMENT := n # in turn leaves some undefined symbols like __fentry__ in purgatory and not # sure how to relocate those. Like kexec-tools, use custom flags. -KBUILD_CFLAGS := -fno-strict-aliasing -Wall -Wstrict-prototypes -fno-zero-initialized-in-bss -fno-builtin -ffreestanding -c -MD -Os -mcmodel=large +KBUILD_CFLAGS := -fno-strict-aliasing -Wall -Wstrict-prototypes -fno-zero-initialized-in-bss -fno-builtin -ffreestanding -c -MD -Os -mcmodel=large -x c++ -Wno-pointer-arith KBUILD_CFLAGS += -m$(BITS) KBUILD_CFLAGS += $(call cc-option,-fno-PIE) diff --git a/include/linux/types.h b/include/linux/types.h index c94d59ef96cc..31e8258ac048 100644 --- a/include/linux/types.h +++ b/include/linux/types.h @@ -2,6 +2,10 @@ #ifndef _LINUX_TYPES_H #define _LINUX_TYPES_H +#ifndef __cplusplus +#error not c++ +#endif + #define __EXPORTED_HEADERS__ #include diff --git a/scripts/checksyscalls.sh b/scripts/checksyscalls.sh index ee3dfb5be6cd..2f9aa09602e7 100755 --- a/scripts/checksyscalls.sh +++ b/scripts/checksyscalls.sh @@ -212,4 +212,4 @@ syscall_list() { } (ignore_list && syscall_list $(dirname $0)/../arch/x86/entry/syscalls/syscall_32.tbl) | \ -$* -E -x c - > /dev/null +$* -E -x c++ - > /dev/null diff --git a/tools/power/cpupower/Makefile b/tools/power/cpupower/Makefile index 1dd5f4fcffd5..68d2e199b402 100644 --- a/tools/power/cpupower/Makefile +++ b/tools/power/cpupower/Makefile @@ -125,7 +125,6 @@ cc-supports = ${shell if $(CC) ${1} -S -o /dev/null -x c /dev/null > /dev/null 2 OPTIMIZATION := $(call cc-supports,-Os,-O2) WARNINGS := -Wall -Wchar-subscripts -Wpointer-arith -Wsign-compare -WARNINGS += $(call cc-supports,-Wno-pointer-sign) WARNINGS += $(call cc-supports,-Wdeclaration-after-statement) WARNINGS += -Wshadow diff --git a/tools/virtio/Makefile b/tools/virtio/Makefile index 8e2a908115c2..fde1fccb019d 100644 --- a/tools/virtio/Makefile +++ b/tools/virtio/Makefile @@ -4,7 +4,7 @@ test: virtio_test vringh_test virtio_test: virtio_ring.o virtio_test.o vringh_test: vringh_test.o vringh.o virtio_ring.o -CFLAGS += -g -O2 -Werror -Wall -I. -I../include/ -I ../../usr/include/ -Wno-pointer-sign -fno-strict-overflow -fno-strict-aliasing -fno-common -MMD -U_FORTIFY_SOURCE +CFLAGS += -g -O2 -Werror -Wall -I. -I../include/ -I ../../usr/include/ -fno-strict-overflow -fno-strict-aliasing -fno-common -MMD -U_FORTIFY_SOURCE vpath %.c ../../drivers/virtio ../../drivers/vhost mod: ${MAKE} -C `pwd`/../.. M=`pwd`/vhost_test V=${V}