Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1557094imm; Mon, 3 Sep 2018 03:42:23 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZRJ3dTq1zrEv9WLI8FE3iF5st0tg/4CtJeSiy2AwgbJFt0QcOD6JtHHcwkovY/ZrzoGuDc X-Received: by 2002:a17:902:4403:: with SMTP id k3-v6mr27317493pld.243.1535971343164; Mon, 03 Sep 2018 03:42:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535971343; cv=none; d=google.com; s=arc-20160816; b=aReEp39VSXO6kvpe//EVUl0TPZZ+/71mQuq1vfLFe+YTGm0hdXz3LfKJjW7HP76ypR cbWDQVTIrqAcjp51ufhwB7d4LgWkFm24i9UGWu4u3bkjdPLeDaL+i3N9EzA0FWYIHNpH VVzeQ1ida6RMBSNCPZ+GNItRQ+ycd7GSc1kAdG9x7r6jMupklJn9+8dsRN/VZeqywNSA Z6JjUCE7DHasWdyAvu1Gw8ks7LHGn0BfJsrtT5MMlb874q8ymHza1CRcIeWWcmNIMuTR ekTK4zvPx5Bhnr9oXlxUroTHD1W0Z3hjc2zp4xDfzOfcoefRq7FXsI0c4Xkh1nwyScdu 4ikg== 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:cc:to:subject :message-id:date:from:references:in-reply-to:mime-version :dkim-signature:arc-authentication-results; bh=5hlxYhxAKpVIJe37MJrIhjSi18t9kePPhIytra1F24s=; b=xMdDtO0/zqzLQI8Ly1gnUiKZmNJhnBfTBKp+zAlOecPh86N9JU/+s0ZU6O+0Espvt5 SfYPemAkxLpSj9Fv46av/En+PzPBfpLDoyPg9+lU6CHyb+iXiupnrNjtMtn4h1FYsZEX VkQXFxqGrT2TlOIU2TlVUo4kPd7BQSthQdl5qlWWP4M3+hjvf+iDnK/oImHot1lmRBr0 biVM7SNXgk6J3N0WDV4qLCQQEBJEKTzTqSUSs5az/2aoYFxF7QXr8b8ZXQMtA4cOQuV9 Oine1VIni4qi65/2YDVtG1Vyku6Bik8onNH7CT2Qt7xBeyw5zoqIxrAW66cxw0zb/guY mMRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=MpyZ3xAt; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y14-v6si17470899plp.371.2018.09.03.03.42.07; Mon, 03 Sep 2018 03:42:23 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=MpyZ3xAt; 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=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726062AbeICPAe (ORCPT + 99 others); Mon, 3 Sep 2018 11:00:34 -0400 Received: from mail-qt0-f195.google.com ([209.85.216.195]:38175 "EHLO mail-qt0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725943AbeICPAe (ORCPT ); Mon, 3 Sep 2018 11:00:34 -0400 Received: by mail-qt0-f195.google.com with SMTP id x7-v6so105022qtk.5 for ; Mon, 03 Sep 2018 03:40:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=5hlxYhxAKpVIJe37MJrIhjSi18t9kePPhIytra1F24s=; b=MpyZ3xAtpOq1mrquF99VpZLP/+dfXVBkYk2J6nD9DGe422qjtc3KSyCfMvYUNKvrdz /JvCKSCCQTLlLLMkCRykc0J4+CrKUJ2Dv+MKlBauzEgcSf0Nb3gYcgfOD01j5nk4uy/J xMVzBy/FpXzGt1GIRb3Fk7SE7SOnpn4aENea2S8Xj/0UiWYvHOhiHXaDtJuYFUk66NFz 0FwrPaNDfEdFPHl3EcDHdonAUterJFYDC0rFjk4NuIQrU+Ht9YFv0EQdsH3RsQJI4SoK VtSmh2RBLvVLrGQ49GbaaU/rUrXm9hUwL62HZHk8JgH5PnnuJtYh48mb3IGMVRhnh5i4 9itA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=5hlxYhxAKpVIJe37MJrIhjSi18t9kePPhIytra1F24s=; b=rreSl9VFVXmfApn+s9w8k07Fo/RnGP2IHCfuPWGTb2DVTQgFqHi304MFymZZ/bAkwN y3tH8ikim9V36Z7PxbLfL1P5Mz9uyZpUahXBu+2aO30K7PMHRkh3y17aYoK4ZXwDDFPo lul0E6EMZRNzojf9Lr5R/V7frIEiLFJcp/xGrjjqO2fYef9Gi8AHMLfm8KeaWemfAq7R G2S3Ad5eekZI3qtJ9VNKwwr1bDwCwgHVtKrWB6KRKVIk3NQsymK5Hppfy+MPq7BhhMS1 LELUexE5bgIEb+NuGQ0X73NW2nhfxh8+hWnDrq9T9lMuqrhLrwzjLhg71Z1ZZYTsyB4g 50Hg== X-Gm-Message-State: APzg51B/fYvjYRYt9S3YhORzpYxGfvnVMLPfHs0hw/gmzXrRZ++B+/Ks B+tCxDkyoju7+UIrB8X2B3lwha4gv7eqCcvluNo9JA== X-Received: by 2002:a0c:87b1:: with SMTP id 46-v6mr8729629qvj.202.1535971259426; Mon, 03 Sep 2018 03:40:59 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:ac8:34a7:0:0:0:0:0 with HTTP; Mon, 3 Sep 2018 03:40:38 -0700 (PDT) In-Reply-To: References: <20180831170514.24665-1-miguel.ojeda.sandonis@gmail.com> <20180831170514.24665-2-miguel.ojeda.sandonis@gmail.com> <0a8588f3-929a-608f-1fdc-e24b90e6b59b@rasmusvillemoes.dk> From: Miguel Ojeda Date: Mon, 3 Sep 2018 12:40:38 +0200 Message-ID: Subject: Re: [PATCH 2/7] Compiler Attributes: use the no-underscores syntax To: Geert Uytterhoeven Cc: Rasmus Villemoes , "torvalds@linux-foundation.org" , Linux Kernel Mailing List , Eli Friedman , Christopher Li , Kees Cook , Ingo Molnar , Arnd Bergmann , Greg KH , Masahiro Yamada , Joe Perches , Dominique Martinet , Nick Desaulniers Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Geert, On Mon, Sep 3, 2018 at 8:42 AM, Geert Uytterhoeven w= rote: > Hi Miguel, > > On Sat, Sep 1, 2018 at 12:41 AM Miguel Ojeda > wrote: >> On Sat, Sep 1, 2018 at 12:10 AM, Miguel Ojeda >> wrote: >> > arch/parisc/boot/compressed/misc.c:#define malloc malloc_gzip >> > include/linux/decompress/mm.h:#define malloc(a) kmalloc(a, GFP_KERNEL) >> > lib/inflate.c:#define malloc(a) kmalloc(a, GFP_KERNEL) >> > include/linux/compiler_types.h:#define noinline_for_stack noinline >> > include/linux/raid/pq.h:#define noinline __attribute__((noinline)) >> > tools/include/linux/compiler.h:#define noinline >> > arch/mips/sgi-ip27/ip27-reset.c:#define noreturn while(1); >> >> A better list, searching for all attributes used anywhere in the kernel: >> >> git grep -E '^\s*#define\s+(address_space|alias|aligned|always_inline|as= sume_aligned|bitwise|bnd_legacy|cold|common|const|constructor|context|depre= cated|designated_init|destructor|error|externally_visible|flatten|force|for= mat|format|gnu_inline|hot|hotpatch|indirect_branch|latent_entropy|long_call= |malloc|may_alias|mode|model|naked|nocast|noclone|noderef|noinline|no_instr= ument_function|nonnull|no_randomize_layout|noreturn|no_sanitize_address|opt= imize|packed|pure|randomize_layout|regparm|require_context|safe|section|sys= call_linkage|target|tls_model|unused|used|user|vector_size|visibility|warni= ng|warn_unused_result|weak)(\(|\s|$)' >> >> arch/mips/sgi-ip27/ip27-reset.c:#define noreturn while(1); >> /* Silence gcc. */ >> arch/parisc/boot/compressed/misc.c:#define malloc malloc_gzip >> arch/powerpc/xmon/ansidecl.h:#define const >> drivers/gpu/drm/nouveau/nvkm/subdev/bios/init.c:#define error(fmt, >> args...) bioslog(ERROR, fmt, ##args) >> include/linux/compiler_attributes.h:#define noinline >> __attribute__((noinline)) >> include/linux/decompress/mm.h:#define malloc(a) kmalloc(a, GFP_KERNEL) >> include/linux/raid/pq.h:#define noinline __attribute__((noinline)) >> lib/inflate.c:#define malloc(a) kmalloc(a, GFP_KERNEL) >> tools/include/linux/compiler-gcc.h:#define noinline >> __attribute__((noinline)) >> tools/include/linux/compiler.h:#define noinline >> tools/testing/selftests/futex/include/logging.h:#define error(message, >> err, args...) \ >> >> None of these should make a problem. And it would may avoid people >> using such common-name-macros in the future ;-) > > That's very fragile. > Who knows all (current and future) attribute names by heart, and that def= ining > them could have such side effects? Please see the email I sent after that one -- I clarified that this was more about the current state and that in v3 it will be changed, if only to avoid surprises in the future for ourselves. I agree with you and, as Rasmus pointed out, we will use the macros anyway. > > At least "alias", "force", "format", "mode", "model", "optimize", "target= " are > names I wouldn't hesitate to use as a macro name in a driver... A macro with a lowercase, short & common name is not the best idea in my opinion; if only because of clarity for future readers. Unless it really improved the code readability for some reason in a particular case, I would avoid it. But to each his own! :-) Thanks for reviewing! Cheers, Miguel