[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAPWQB7E1d4NZyMfr36eUmpRbgd3kc6JKznd76tfb7OR-NZCf6Q@mail.gmail.com>
Date: Fri, 25 Aug 2017 13:53:39 -0700
From: Joe Stringer <joe@....org>
To: Arnd Bergmann <arnd@...db.de>
Cc: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Ian Abbott <abbotti@....co.uk>,
Michal Nazarewicz <mina86@...a86.com>,
Kees Cook <keescook@...omium.org>
Subject: Re: [PATCH net-next] compiler: Document behavior compiling with -O0
On 24 August 2017 at 14:20, Arnd Bergmann <arnd@...db.de> wrote:
> On Thu, Aug 24, 2017 at 6:45 PM, Joe Stringer <joe@....org> wrote:
>> Recent changes[0] to make use of __compiletime_assert() from container_of()
>> increased the scope of this macro, resulting in a wider set of
>> situations where developers cannot compile their code using "-O0". I
>> noticed this when making use of the macro in my own development, and
>> spent more time than I'd like to admit tracking the problem down. This
>> patch documents the behavior in lieu of a compile-time assertion
>> implementation that does not rely on optimizations.
>>
>> Example compilation failure:
>
> Maybe the macro should be enclosed in "#ifdef __OPTIMIZE__"?
>
> Generally speaking we at least rely on function inlining to create a
> working kernel, but sometimes there may be a reason to compile a
> single file without optimizations.
Right. The above approach seems okay to me, if the developer really
doesn't notice issues when they've been debugging -O0, it should be
picked up fairly quickly during review.
Powered by blists - more mailing lists