linux-kernel-mentees.lists.linuxfoundation.org archive mirror
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>,
	Nick Desaulniers <ndesaulniers@google.com>,
	lukas.bulwahn@gmail.com,
	 linux-kernel-mentees@lists.linuxfoundation.org,
	dwaipayanray1@gmail.com, Aditya <yashsri421@gmail.com>
Cc: Jakub Jelinek <jakub@redhat.com>, "H.J. Lu" <hjl.tools@gmail.com>,
	Florian Fainelli <f.fainelli@gmail.com>,
	kernel test robot <lkp@intel.com>,
	Peter Zijlstra <peterz@infradead.org>,
	"maintainer:X86 ARCHITECTURE \(32-BIT AND 64-BIT\)"
	<x86@kernel.org>, Rasmus Villemoes <linux@rasmusvillemoes.dk>,
	LKML <linux-kernel@vger.kernel.org>,
	Steven Rostedt <rostedt@goodmis.org>, LKP <lkp@lists.01.org>,
	linux-toolchains@vger.kernel.org,
	Kees Cook <keescook@chromium.org>
Subject: Re: [Linux-kernel-mentees] GCC section alignment, and GCC-4.9 being a weird one
Date: Wed, 21 Oct 2020 11:35:23 -0700	[thread overview]
Message-ID: <3ec15b41754b01666d94b76ce51b9832c2dd577a.camel@perches.com> (raw)
In-Reply-To: <CANiq72m+_QYtn_1gyrjXFs6yeDdiMoS4DVcWqYcTgyCFnSFXbw@mail.gmail.com>

(adding cc's of kernel-mentees and a few checkpatch contributors)

On Wed, 2020-10-21 at 19:54 +0200, Miguel Ojeda wrote:
> On Wed, Oct 21, 2020 at 7:42 PM Nick Desaulniers
> <ndesaulniers@google.com> wrote:
> > If you used some of the macros from
> > include/linux/compiler_attributes.h like __section and __aligned, I
> > would prefer it.  Please consider spelling out __attribute__(()) an
> > antipattern.
> 
> +1, the shorthands should be used unless there is a reason not to (and
> please write the reason in a comment in that case).

Perhaps something to add as a generic test in checkpatch.

Right now it checks separately for each __attribute__
use with any of aligned, section, printf and scanf.

Likely it should include more of the #defines from
include/linux/compiler_attributes.h.

include/linux/compiler_attributes.h:#define __alias(symbol)                 __attribute__((__alias__(#symbol)))
include/linux/compiler_attributes.h:#define __aligned(x)                    __attribute__((__aligned__(x)))
include/linux/compiler_attributes.h:#define __aligned_largest               __attribute__((__aligned__))
include/linux/compiler_attributes.h:#define __always_inline                 inline __attribute__((__always_inline__))
include/linux/compiler_attributes.h:# define __assume_aligned(a, ...)       __attribute__((__assume_aligned__(a, ## __VA_ARGS__)))
include/linux/compiler_attributes.h:#define __cold                          __attribute__((__cold__))
include/linux/compiler_attributes.h:#define __attribute_const__             __attribute__((__const__))
include/linux/compiler_attributes.h:# define __copy(symbol)                 __attribute__((__copy__(symbol)))
include/linux/compiler_attributes.h:# define __designated_init              __attribute__((__designated_init__))
include/linux/compiler_attributes.h:# define __visible                      __attribute__((__externally_visible__))
include/linux/compiler_attributes.h:#define __printf(a, b)                  __attribute__((__format__(printf, a, b)))
include/linux/compiler_attributes.h:#define __scanf(a, b)                   __attribute__((__format__(scanf, a, b)))
include/linux/compiler_attributes.h:#define __gnu_inline                    __attribute__((__gnu_inline__))
include/linux/compiler_attributes.h:#define __malloc                        __attribute__((__malloc__))
include/linux/compiler_attributes.h:#define __mode(x)                       __attribute__((__mode__(x)))
include/linux/compiler_attributes.h:# define __no_caller_saved_registers        __attribute__((__no_caller_saved_registers__))
include/linux/compiler_attributes.h:# define __noclone                      __attribute__((__noclone__))
include/linux/compiler_attributes.h:# define fallthrough                    __attribute__((__fallthrough__))
include/linux/compiler_attributes.h:#define   noinline                      __attribute__((__noinline__))
include/linux/compiler_attributes.h:# define __nonstring                    __attribute__((__nonstring__))
include/linux/compiler_attributes.h:#define __noreturn                      __attribute__((__noreturn__))
include/linux/compiler_attributes.h:#define __packed                        __attribute__((__packed__))
include/linux/compiler_attributes.h:#define __pure                          __attribute__((__pure__))
include/linux/compiler_attributes.h:#define __section(S)                    __attribute__((__section__(#S)))
include/linux/compiler_attributes.h:#define __always_unused                 __attribute__((__unused__))
include/linux/compiler_attributes.h:#define __maybe_unused                  __attribute__((__unused__))
include/linux/compiler_attributes.h:#define __used                          __attribute__((__used__))
include/linux/compiler_attributes.h:#define __weak                          __attribute__((__weak__))


_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

       reply	other threads:[~2020-10-21 18:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20200629003127.GB5535@shao2-debian>
     [not found] ` <20200630124628.GV4817@hirez.programming.kicks-ass.net>
     [not found]   ` <20200630144905.GX4817@hirez.programming.kicks-ass.net>
     [not found]     ` <58ff47cc-dc55-e383-7a5b-37008d145aba@gmail.com>
     [not found]       ` <20201021080031.GY2628@hirez.programming.kicks-ass.net>
     [not found]         ` <20201021131806.GA2176@tucnak>
     [not found]           ` <20201021134436.GJ2628@hirez.programming.kicks-ass.net>
     [not found]             ` <CAKwvOd=qi63We=6rLapb565giCVe-8a6d=-=3VZL6RWzhwAeZg@mail.gmail.com>
     [not found]               ` <CANiq72m+_QYtn_1gyrjXFs6yeDdiMoS4DVcWqYcTgyCFnSFXbw@mail.gmail.com>
2020-10-21 18:35                 ` Joe Perches [this message]
2020-10-21 19:27                   ` [Linux-kernel-mentees] GCC section alignment, and GCC-4.9 being a weird one Miguel Ojeda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3ec15b41754b01666d94b76ce51b9832c2dd577a.camel@perches.com \
    --to=joe@perches.com \
    --cc=dwaipayanray1@gmail.com \
    --cc=f.fainelli@gmail.com \
    --cc=hjl.tools@gmail.com \
    --cc=jakub@redhat.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel-mentees@lists.linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-toolchains@vger.kernel.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=lkp@intel.com \
    --cc=lkp@lists.01.org \
    --cc=lukas.bulwahn@gmail.com \
    --cc=miguel.ojeda.sandonis@gmail.com \
    --cc=ndesaulniers@google.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=x86@kernel.org \
    --cc=yashsri421@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).