Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933361AbcDYSgn (ORCPT ); Mon, 25 Apr 2016 14:36:43 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:53777 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933201AbcDYSgm (ORCPT ); Mon, 25 Apr 2016 14:36:42 -0400 Date: Mon, 25 Apr 2016 11:36:41 -0700 From: Andrew Morton To: Eric Engestrom Cc: , Joe Perches , Hannes Frederic Sowa , Rasmus Villemoes , "David S. Miller" , Daniel Borkmann , Andrey Ryabinin Subject: Re: [RFC] Add missing #include Message-Id: <20160425113641.b4c880fada716f8a31ada6b9@linux-foundation.org> In-Reply-To: <1461607856-27790-1-git-send-email-eric.engestrom@imgtec.com> References: <1461607856-27790-1-git-send-email-eric.engestrom@imgtec.com> X-Mailer: Sylpheed 3.4.1 (GTK+ 2.24.23; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1417 Lines: 36 On Mon, 25 Apr 2016 19:10:55 +0100 Eric Engestrom wrote: > ARRAY_SIZE uses BUILD_BUG_ON_ZERO, which is undefined is you don't > include linux/bug.h first, which just happened to me. > > Is there any reason this include isn't here? A quick grep found 595 > other files using a define from bug.h without ever including it. yeah. A lot of the kernel compiles by accident ;) We just fix stuff when it blows up - it ain't pretty but this process works acceptably well. > --- a/include/linux/compiler-gcc.h > +++ b/include/linux/compiler-gcc.h > @@ -2,6 +2,8 @@ > #error "Please don't include directly, include instead." > #endif > > +#include > + > /* > * Common definitions for all gcc versions go here. > */ hm, it Seems Wrong to include bug.h into compiler.h - the latter is such a low-level infrastructury thing. As evidenced by the fact that bug.h explicitly includes compiler.h! The bottom line is that our headers are just too large and complex and try to do too much stuff. Going finer-grained is always a good fix, but I don't think you want to be adding a new array_size.h! I guess we could move __must_be_array() into kernel.h and use #ifdef __GNUC__ (or whatever). But that adds to kernel.h (another) dependency on bug.h, which kernel.h doesn't (and probably shouldn't and possibly can't) include. Sucks.