From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932947AbbIUWfS (ORCPT ); Mon, 21 Sep 2015 18:35:18 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:33262 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932105AbbIUWfK (ORCPT ); Mon, 21 Sep 2015 18:35:10 -0400 Date: Mon, 21 Sep 2015 15:35:09 -0700 From: Andrew Morton To: Sudip Mukherjee Cc: Haavard Skinnemoen , Hans-Christian Egtvedt , Felipe Balbi , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, "Kirill A. Shutemov" Subject: Re: [PATCH 3/3] page-flags: rectify forward declaration Message-Id: <20150921153509.fef7ecdf313ef74307c43b65@linux-foundation.org> In-Reply-To: <1442682779-20077-4-git-send-email-sudipm.mukherjee@gmail.com> References: <1442682779-20077-1-git-send-email-sudipm.mukherjee@gmail.com> <1442682779-20077-4-git-send-email-sudipm.mukherjee@gmail.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 On Sat, 19 Sep 2015 22:42:59 +0530 Sudip Mukherjee wrote: > compound_head is defined as inline in page-flags.h but in the forward > declaration of compound_head in the same file missed "inline". As a result > we got plenty of build warnings while building for some architecture > like avr32. The warning showed as: > warning: 'compound_head' declared inline after being called. > warning: previous declaration of 'compound_head' was here > > ... > > --- a/include/linux/page-flags.h > +++ b/include/linux/page-flags.h > @@ -227,7 +227,7 @@ static inline int __TestClearPage##uname(struct page *page) { return 0; } > struct page; > static inline int PageCompound(struct page *page); > static inline int PageTail(struct page *page); > -static struct page *compound_head(struct page *page); > +static inline struct page *compound_head(struct page *page); > > __PAGEFLAG(Locked, locked, PF_NO_TAIL) > PAGEFLAG(Error, error, PF_NO_COMPOUND) TESTCLEARFLAG(Error, error, PF_NO_COMPOUND) Yes, that's an error, in -mm due to Kirill's page-flags patches. The code is effectively doing static inline XXX foo(...); static inline YYY bar(...) { foo(...); } inline XXX foo(...) { ... } ie: asking gcc to inline a forward-defined function. That does work, but it's unusual and unexpected, and it's a bit unwise to expect the compiler to do unusual and more difficult things. Is it fixable? Can we use the traditional define-before-using structure? Also, I'm finding that the patch series introduces a pretty large bisection hole: include/linux/page-flags.h: In function 'PageYoung': include/linux/page-flags.h:327: error: implicit declaration of function 'PF_ANY' include/linux/page-flags.h:327: error: invalid type argument of '->' (have 'int') include/linux/page-flags.h:327: error: invalid type argument of '->' (have 'int') which later gets fixed up by page-flags-rectify-forward-declaration.patch. Maybe it's time to do a wholesale refactoring of the patchset?