Received: by 10.213.65.68 with SMTP id h4csp374742imn; Tue, 3 Apr 2018 23:18:37 -0700 (PDT) X-Google-Smtp-Source: AIpwx48KVUqeY4Jps28yGTWo90pNZ8vPGWUaaYlc7chxGDheRqyljHA7iHYFbZg0BktQQF2JHyyE X-Received: by 2002:a17:902:8d82:: with SMTP id v2-v6mr17463638plo.101.1522822717223; Tue, 03 Apr 2018 23:18:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522822717; cv=none; d=google.com; s=arc-20160816; b=tnp4zS6uXxioSmx6tZYetiaCsEebLbUipLi+Adg0qix31v+EWft74XO0HjBOn1eoWJ N+cNfr/zzagNcAOui2ggwHouUhsT9omYEh8HtEtwFPVTMI+uvgx1bBdIu5KW8+O+FZDq a5/FizYDxYeiynADwkZQmUkFolVZcnXZ91VJbAjb1MYtafPyVJtbWI42v8pHcr1IbiYU mvUADWRNFeUoVSU21iWvCvycwMxEZaQ9hnz9FDtHtmfEMKP4v6snLCIyfKtV+Gnztq/U sWzXthkxWpdbBd7C7pbIM4t5bp/ljsXdzTcdw6k7R82u2YgDXmnfZvjmEYvNn/YGUfb6 Vivw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date:from :references:cc:to:subject:arc-authentication-results; bh=Xjn8rbaYAONXAsfBbM1yOTog5h1OR2OpZc0l98/ucZc=; b=F/EZMPk+lQ1EUKO3zqxTmDGb2JLSPv7fMowflD2Br9wZVYtKa6M6imkDRJXfxc8Hzs lGsWgSV6qrQ/e1bIpzmf6KM+UhbZMXG8mGHn9RI3ehQOGeEXBTbuzluuOMo5zYmE6/8t OLlH4GsGK0mM+2ExTr38fTLz/2NB5F/c/uFCqljQ4taZGUWJD/v2Bjjm8+0dCib7ThZC NPMu0jX7rcVBgzDfVwG+DThft1Hi0p2fHbUTX06ri2fE2rJLgSVd4eQ4CxRpystt5ouJ lDYwQpGvVkiOuutOANNtx2wkchfYUdyKb4LkCNU2zNJaQ9Ntbq5l6uCvxLgt5C+nCXlp rsFQ== 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=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m11-v6si2412575pln.350.2018.04.03.23.18.23; Tue, 03 Apr 2018 23:18:37 -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=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752589AbeDDGQt (ORCPT + 99 others); Wed, 4 Apr 2018 02:16:49 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:60778 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751643AbeDDGQs (ORCPT ); Wed, 4 Apr 2018 02:16:48 -0400 Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w346FXfK078293 for ; Wed, 4 Apr 2018 02:16:47 -0400 Received: from e06smtp14.uk.ibm.com (e06smtp14.uk.ibm.com [195.75.94.110]) by mx0a-001b2d01.pphosted.com with ESMTP id 2h4pvhn8cu-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Wed, 04 Apr 2018 02:16:46 -0400 Received: from localhost by e06smtp14.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 4 Apr 2018 07:16:44 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (9.149.109.198) by e06smtp14.uk.ibm.com (192.168.101.144) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 4 Apr 2018 07:16:41 +0100 Received: from d06av24.portsmouth.uk.ibm.com (mk.ibm.com [9.149.105.60]) by b06cxnps4076.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w346Gerf57409708; Wed, 4 Apr 2018 06:16:40 GMT Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6CEE742041; Wed, 4 Apr 2018 07:08:31 +0100 (BST) Received: from d06av24.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 23A8842049; Wed, 4 Apr 2018 07:08:30 +0100 (BST) Received: from [9.124.31.156] (unknown [9.124.31.156]) by d06av24.portsmouth.uk.ibm.com (Postfix) with ESMTP; Wed, 4 Apr 2018 07:08:29 +0100 (BST) Subject: Re: [PATCH v2] tools include: define READ_ONCE/WRITE_ONCE for C++ To: linux-kernel@vger.kernel.org Cc: Li Zhijian , acme@redhat.com, philip.li@intel.com, mark.rutland@arm.com, paulmck@linux.vnet.ibm.com, mingo@kernel.org References: <1512005772-27112-1-git-send-email-lizhijian@cn.fujitsu.com> From: Sandipan Das Date: Wed, 4 Apr 2018 11:46:38 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: <1512005772-27112-1-git-send-email-lizhijian@cn.fujitsu.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 x-cbid: 18040406-0044-0000-0000-000005433751 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18040406-0045-0000-0000-000028834C3E Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-04-04_02:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1804040065 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 11/30/2017 07:06 AM, Li Zhijian wrote: > since 6aa7de0, we failed to build perf with C++(clang) > to fix the following compile errors > -------------- > lizhijian@haswell-OptiPlex-9020:~/lkp/linux/tools/perf$ make LLVM_CONFIG=/usr/bin/llvm-config-3.9 LIBCLANGLLVM=1 > ... > CC util/probe-finder.o > In file included from /home/lizj/linux/tools/perf/util/util.h:13:0, > from /home/lizj/linux/tools/perf/util/util-cxx.h:20, > from util/c++/clang-c.h:5, > from util/c++/clang-test.cpp:2: > /home/lizj/linux/tools/include/asm/../../arch/x86/include/asm/atomic.h: In function ‘int atomic_read(const atomic_t*)’: > /home/lizj/linux/tools/include/linux/compiler.h:157:45: error: use of deleted function ‘atomic_read(const atomic_t*)::::()’ > ({ union { typeof(x) __val; char __c[1]; } __u; __read_once_size(&(x), __u.__c, sizeof(x)); __u.__val; }) > ^ > /home/lizj/linux/tools/include/asm/../../arch/x86/include/asm/atomic.h:28:9: note: in expansion of macro ‘READ_ONCE’ > return READ_ONCE((v)->counter); > ^ > /home/lizj/linux/tools/include/linux/compiler.h:157:11: note: ‘atomic_read(const atomic_t*)::::()’ is implicitly deleted because the default definition would be ill-formed: > ({ union { typeof(x) __val; char __c[1]; } __u; __read_once_size(&(x), __u.__c, sizeof(x)); __u.__val; }) > ^ > /home/lizj/linux/tools/include/asm/../../arch/x86/include/asm/atomic.h:28:9: note: in expansion of macro ‘READ_ONCE’ > return READ_ONCE((v)->counter); > ^ > /home/lizj/linux/tools/include/linux/compiler.h:157:11: error: uninitialized const member in ‘union atomic_read(const atomic_t*)::’ > ({ union { typeof(x) __val; char __c[1]; } __u; __read_once_size(&(x), __u.__c, sizeof(x)); __u.__val; }) > ^ > /home/lizj/linux/tools/include/asm/../../arch/x86/include/asm/atomic.h:28:9: note: in expansion of macro ‘READ_ONCE’ > return READ_ONCE((v)->counter); > ^ > /home/lizj/linux/tools/include/linux/compiler.h:157:23: note: ‘const int atomic_read(const atomic_t*)::::__val’ should be initialized > ({ union { typeof(x) __val; char __c[1]; } __u; __read_once_size(&(x), __u.__c, sizeof(x)); __u.__val; }) > ^ > /home/lizj/linux/tools/include/asm/../../arch/x86/include/asm/atomic.h:28:9: note: in expansion of macro ‘READ_ONCE’ > return READ_ONCE((v)->counter); > ^ > LD tests/perf-in.o > ... > -------------- > I ran into the same problems while building perf with clang support. If the solution proposed here is acceptable, can someone please pick up this patch? -- With Regards, Sandipan