From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 12232 invoked by alias); 8 Nov 2012 16:49:30 -0000 Received: (qmail 12221 invoked by uid 22791); 8 Nov 2012 16:49:29 -0000 X-SWARE-Spam-Status: No, hits=-7.7 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_SPAMHAUS_DROP,KHOP_THREADED,RCVD_IN_DNSWL_HI,RCVD_IN_HOSTKARMA_W,RP_MATCHES_RCVD,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 08 Nov 2012 16:49:23 +0000 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id qA8GnMcS029073 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 8 Nov 2012 11:49:22 -0500 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id qA8GnLZb028430; Thu, 8 Nov 2012 11:49:21 -0500 Message-ID: <509BE290.4000104@redhat.com> Date: Thu, 08 Nov 2012 16:49:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20121016 Thunderbird/16.0.1 MIME-Version: 1.0 To: Doug Evans CC: gdb-patches@sourceware.org Subject: Re: [PATCH] Always include defs.h first. References: <20121107201107.25258.47267.stgit@brno.lan> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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/msg00195.txt.bz2 On 11/08/2012 01:34 AM, Doug Evans wrote: > On Wed, Nov 7, 2012 at 12:11 PM, Pedro Alves wrote: >> defs.h should always be the first included header in a .c file. In >> 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. > > fwiw, I like the idea of header files including what they themselves > need, and not assuming the includer will do it for them, even for > defs.h. > It's something I'd like to see gdb move towards, but I'm not in a hurry. :-) Sorry, I hadn't imagined the change could be disagreeable. Otherwise, I'd have waited. I'm also of the camp that advocates that header files should include what they themselves need. OTOH, IMO, defs.h is special. - It's defs.h that includes config.h. Including config.h in headers is bad practice. Comparing to gcc, I'd say defs.h is currently a kind of a mix of system.h and coretypes.h, and whatnot. - It's needed practically _everywhere_. Also: $ ls gdb/*.h | wc -l 232 since not including defs.h in headers is the de facto standard on the code base, where only 4 of those 232 had "#include defs.h" in them, and another include was being introduced exactly because the corresponding .c file was in error, I thought it best to just get rid of those 4 instances making the codebase a little bit less inconsistent. -- Pedro Alves