From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30913 invoked by alias); 8 Nov 2012 03:49:56 -0000 Received: (qmail 30903 invoked by uid 22791); 8 Nov 2012 03:49:55 -0000 X-SWARE-Spam-Status: No, hits=-4.5 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_HOSTKARMA_W,RCVD_IN_HOSTKARMA_WL X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 08 Nov 2012 03:49:48 +0000 Received: from svr-orw-exc-10.mgc.mentorg.com ([147.34.98.58]) by relay1.mentorg.com with esmtp id 1TWJ7i-0002hV-8b from Yao_Qi@mentor.com ; Wed, 07 Nov 2012 19:49:46 -0800 Received: from SVR-ORW-FEM-05.mgc.mentorg.com ([147.34.97.43]) by SVR-ORW-EXC-10.mgc.mentorg.com with Microsoft SMTPSVC(6.0.3790.4675); Wed, 7 Nov 2012 19:49:45 -0800 Received: from qiyao.dyndns.org (147.34.91.1) by svr-orw-fem-05.mgc.mentorg.com (147.34.97.43) with Microsoft SMTP Server id 14.1.289.1; Wed, 7 Nov 2012 19:49:45 -0800 Message-ID: <509B2BCA.2050703@codesourcery.com> Date: Thu, 08 Nov 2012 03:49:00 -0000 From: Yao Qi User-Agent: Mozilla/5.0 (X11; Linux i686; rv:15.0) Gecko/20120911 Thunderbird/15.0.1 MIME-Version: 1.0 To: Pedro Alves CC: Subject: Re: [PATCH] Always include defs.h first. References: <20121107201107.25258.47267.stgit@brno.lan> In-Reply-To: <20121107201107.25258.47267.stgit@brno.lan> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-11/txt/msg00170.txt.bz2 On 11/08/2012 04:11 AM, Pedro Alves wrote: > defs.h should always be the first included header in a .c file. In I agree on this point. > turn, this means that a foo.h header should not need to include > defs.h, as the .c file always includes defs.h before including foo.h. > I am afraid I can't agree. If foo.h needs defs.h, it should include defs.h, rather than replying on foo.h's includer to include defs.h. > diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c > index 05a030a..fbc2479 100644 > --- a/gdb/arm-tdep.c > +++ b/gdb/arm-tdep.c > @@ -18,9 +18,10 @@ > You should have received a copy of the GNU General Public License > along with this program. If not, see. */ > > +#include "defs.h" > + > #include /* XXX for isupper (). */ > > -#include "defs.h" > #include "frame.h" > #include "inferior.h" > #include "gdbcmd.h" What is the include order of "defs.h" and system headers, such as and ? When I learnt C programming some years ago, it was said system headers are included first, and then your own headers. This rule doesn't apply here? -- Yao