From patchwork Sun Apr 30 14:01:11 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 9706107 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6E2BE601D2 for ; Sun, 30 Apr 2017 14:01:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 601DE26E46 for ; Sun, 30 Apr 2017 14:01:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 547E826E4E; Sun, 30 Apr 2017 14:01:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D46D626E46 for ; Sun, 30 Apr 2017 14:01:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S938926AbdD3OBT (ORCPT ); Sun, 30 Apr 2017 10:01:19 -0400 Received: from conssluserg-05.nifty.com ([210.131.2.90]:49386 "EHLO conssluserg-05.nifty.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S938521AbdD3OBT (ORCPT ); Sun, 30 Apr 2017 10:01:19 -0400 Received: from mail-yw0-f169.google.com (mail-yw0-f169.google.com [209.85.161.169]) (authenticated) by conssluserg-05.nifty.com with ESMTP id v3UE1CLl024532; Sun, 30 Apr 2017 23:01:13 +0900 DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-05.nifty.com v3UE1CLl024532 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.com; s=dec2015msa; t=1493560873; bh=8xmSDI2ICaLRz5YnCRtL5v+FSPAGX+cmQe8jfFekIoU=; h=In-Reply-To:References:From:Date:Subject:To:Cc:From; b=2BhmPi7DuwYg9MPwlsdnD6CA1zQaTIs2FROSmFlbrxM1MjxEHzsSuyyCzmD47mOJD 5JzgOdicVPZMF6yT/m5gYonJCr5eFaxosD9FBxDJcB1WNeKA5uQDPFNGE1J3134Qsr 7TqCJTwp29SDSy7GhoWMJUjhyPWMTECr8SChkvofQNybK8xIjcJK4sxqhH1YQgUW+X P6cb+0fRDtxM1yxoRqaiFE3Ktv/W3tUvCZmarZ7KISx3Ffv54AKdsQOmD/ed+K+LaG 7flIcdem4hkxRSVJyE+zCTfxAV4CiyQ2xeS9xgiCkka50Haui2Dve+p/9smSkmJte2 Aw5AM7+BgQC3A== X-Nifty-SrcIP: [209.85.161.169] Received: by mail-yw0-f169.google.com with SMTP id l18so47920106ywh.3; Sun, 30 Apr 2017 07:01:13 -0700 (PDT) X-Gm-Message-State: AN3rC/4Ld3whNYx59sqyFqL3hsXzTlKClsbi561V9mPEvC3foUwTcmv2 0NduMV2H/lNnLcwl7qktbvVhnfZ51A== X-Received: by 10.13.207.3 with SMTP id r3mr18488376ywd.63.1493560872046; Sun, 30 Apr 2017 07:01:12 -0700 (PDT) MIME-Version: 1.0 Received: by 10.37.88.68 with HTTP; Sun, 30 Apr 2017 07:01:11 -0700 (PDT) In-Reply-To: <20170421213931.155210-3-mka@chromium.org> References: <20170421213931.155210-1-mka@chromium.org> <20170421213931.155210-3-mka@chromium.org> From: Masahiro Yamada Date: Sun, 30 Apr 2017 23:01:11 +0900 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 2/2] kbuild: clang: Disable the 'duplicate-decl-specifier' warning To: Matthias Kaehlcke Cc: Michal Marek , Linux Kbuild mailing list , Linux Kernel Mailing List , Grant Grundler , Greg Hackmann , Michael Davidson , masahiroy@kernel.org Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi Matthias, 2017-04-22 6:39 GMT+09:00 Matthias Kaehlcke : > clang generates plenty of these warnings in different parts of the code. > They are mostly caused by container_of() and other macros which declare > a "const *" variable for their internal use which triggers a > "duplicate 'const' specifier" warning if the is already const > qualified. > > Wording-mostly-from: Michael Davidson > Signed-off-by: Matthias Kaehlcke I think container_of() can be more simple, dropping the 'const'. The following patch worked for me. #ifdef CONFIG_FTRACE_MCOUNT_RECORD For also this one, I'd like to try to fix the code rather than hiding warnings. (We may end up with applying your patch after all, but I'd like to think about it for now.) diff --git a/include/linux/kernel.h b/include/linux/kernel.h index 4c26dc3..d53672b 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h @@ -846,11 +846,9 @@ static inline void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { } * @ptr: the pointer to the member. * @type: the type of the container struct this is embedded in. * @member: the name of the member within the struct. - * */ #define container_of(ptr, type, member) ({ \ - const typeof( ((type *)0)->member ) *__mptr = (ptr); \ - (type *)( (char *)__mptr - offsetof(type,member) );}) + (type *)((void *)(ptr) - offsetof(type, member));}) /* Rebuild everything on CONFIG_FTRACE_MCOUNT_RECORD */