|
From: | Paul Eggert |
Subject: | bug#21707: include-file cleanup for src directory |
Date: | Tue, 20 Oct 2015 13:52:42 -0700 |
User-agent: | Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 |
On 10/20/2015 12:15 PM, Eli Zaretskii wrote:
Even standard C headers sometimes require order, for example, sys/types.h should be included before sys/stat.h.
Oh my goodness your memory goes a long way back! But the C Standard never required a particular header order (it never standardized sys/types.h or sys/stat.h). POSIX did originally require that one must include both <sys/types.h> and <sys/stat.h> before using functions like 'stat', but that requirement was removed a while ago; e.g., nowadays only <sys/stat.h> must be included before using 'stat'. And it's not hard to see why the old POSIX requirement was removed: a .h file should describe an API standalone, to avoid unnecessarily constraining the API's users.
I thought we could perhaps come up with a method that would allow anyone easily see which headers are needed on every supported platform
I started something along those lines, but it's harder than it looks. The current patch came from my woefully-inadequate approximation to the tools I wanted.
I think the real problem is to keep this state once we get there.
Yes. Part of the job would be to write better checking tools. And part, I expect, would be to simplify Emacs's complicated uses of headers. For example, although we sometimes have headers A and B that use each others' symbols, it wouldn't be cool to have both A #include B and B #include A. Some of this simplification will likely be needed anyway, as we change more macros to inline functions.
[Prev in Thread] | Current Thread | [Next in Thread] |