Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753985AbdHXVUV (ORCPT ); Thu, 24 Aug 2017 17:20:21 -0400 Received: from mail-oi0-f66.google.com ([209.85.218.66]:34714 "EHLO mail-oi0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753948AbdHXVUU (ORCPT ); Thu, 24 Aug 2017 17:20:20 -0400 MIME-Version: 1.0 In-Reply-To: <20170824164506.9108-1-joe@ovn.org> References: <20170824164506.9108-1-joe@ovn.org> From: Arnd Bergmann Date: Thu, 24 Aug 2017 23:20:18 +0200 X-Google-Sender-Auth: m00L1_pKfg-xTesVD0-MvobZkGw Message-ID: Subject: Re: [PATCH net-next] compiler: Document behavior compiling with -O0 To: Joe Stringer Cc: Linux Kernel Mailing List , Ian Abbott , Michal Nazarewicz , Kees Cook Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 825 Lines: 18 On Thu, Aug 24, 2017 at 6:45 PM, Joe Stringer 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. Arnd