From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#21707: include-file cleanup for src directory Date: Tue, 20 Oct 2015 22:15:54 +0300 Message-ID: <83vba1e4gl.fsf@gnu.org> References: <56249650.5050804@cs.ucla.edu> <83vba3gw4p.fsf@gnu.org> <5625D71F.402@cs.ucla.edu> <83oaftfulj.fsf@gnu.org> <56268CFA.6040708@cs.ucla.edu> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1445368588 5856 80.91.229.3 (20 Oct 2015 19:16:28 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 20 Oct 2015 19:16:28 +0000 (UTC) Cc: 21707@debbugs.gnu.org To: Paul Eggert Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Oct 20 21:16:18 2015 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZocOL-0003re-B4 for geb-bug-gnu-emacs@m.gmane.org; Tue, 20 Oct 2015 21:16:13 +0200 Original-Received: from localhost ([::1]:47653 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZocOK-0003pb-NW for geb-bug-gnu-emacs@m.gmane.org; Tue, 20 Oct 2015 15:16:12 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54304) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZocOE-0003pV-2n for bug-gnu-emacs@gnu.org; Tue, 20 Oct 2015 15:16:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZocOA-000489-LY for bug-gnu-emacs@gnu.org; Tue, 20 Oct 2015 15:16:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:39478) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZocOA-000485-Hy for bug-gnu-emacs@gnu.org; Tue, 20 Oct 2015 15:16:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1ZocOA-0004Mj-5U for bug-gnu-emacs@gnu.org; Tue, 20 Oct 2015 15:16:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 20 Oct 2015 19:16:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 21707 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 21707-submit@debbugs.gnu.org id=B21707.144536855416765 (code B ref 21707); Tue, 20 Oct 2015 19:16:02 +0000 Original-Received: (at 21707) by debbugs.gnu.org; 20 Oct 2015 19:15:54 +0000 Original-Received: from localhost ([127.0.0.1]:58419 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZocO2-0004ML-1j for submit@debbugs.gnu.org; Tue, 20 Oct 2015 15:15:54 -0400 Original-Received: from mtaout27.012.net.il ([80.179.55.183]:37594) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZocNz-0004MB-AJ for 21707@debbugs.gnu.org; Tue, 20 Oct 2015 15:15:52 -0400 Original-Received: from conversion-daemon.mtaout27.012.net.il by mtaout27.012.net.il (HyperSendmail v2007.08) id <0NWJ001009AI2900@mtaout27.012.net.il> for 21707@debbugs.gnu.org; Tue, 20 Oct 2015 22:11:38 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([84.94.185.246]) by mtaout27.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NWJ00O9N9BDUS10@mtaout27.012.net.il>; Tue, 20 Oct 2015 22:11:38 +0300 (IDT) In-reply-to: <56268CFA.6040708@cs.ucla.edu> X-012-Sender: halo1@inter.net.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:107787 Archived-At: > Cc: 21707@debbugs.gnu.org > From: Paul Eggert > Date: Tue, 20 Oct 2015 11:50:34 -0700 > > Eli Zaretskii wrote: > > Would it help if we avoid including any of our headers in any > > other of our headers, so that the headers included by a particular C > > file are visible by just looking at that single C file? > > That would run afoul of a more important design goal, which is that we should be > able to include headers in any order. Is that really more important? Even standard C headers sometimes require order, for example, sys/types.h should be included before sys/stat.h. > And anyway, compiling a typical C file ordinarily brings in oodles > of system headers that the C file doesn't explicitly ask for That is true, but C headers change much slower than our headers. So keeping track of the changes in our headers requires more attention and work. > so regardless of our style the only practical way to see what headers a > C file includes is to compile it and see what gcc -E outputs. The problem with "gcc -E" is that it's system dependent. I thought we could perhaps come up with a method that would allow anyone easily see which headers are needed on every supported platform, and thus lower the probability of unintended breakage. Of course, it isn't a catastrophe to continue the way we have been doing this till now. > Ideally a C source file should include all headers that define symbols the > source file directly uses, and no headers other than that. This should be true > for both .h and .c files. We're not there by a long shot, but that should be the > goal. I think the real problem is to keep this state once we get there. One-time efforts to rectify things are relatively easy; making that stick is harder, especially since (AFAIU) there's no automated way for producing a report about unnecessary headers.