Thanks for clarifying. That said, I think we should still follow the LLVM convention of putting system headers last. (i.e. everything in <> comes after everything in "", but within <> you can still arrange according to the system rules). This encourages "include what you use" as header files will be required to include any system headers they depend on, rather than relying on every TU that includes that header to do it.
On Tue, Sep 6, 2016 at 3:17 PM Kamil Rytarowski <n...@gmx.com> wrote: > On NetBSD /usr/share/misc/style says: > > /* > * Kernel include files come first. > */ > #include <sys/param.h> /* <sys/param.h> first, */ > #include <sys/types.h> /* <sys/types.h> next, */ > #include <sys/ioctl.h> /* and then the rest, */ > #include <sys/socket.h> /* sorted lexicographically. */ > #include <sys/stat.h> > #include <sys/wait.h> /* Non-local includes in brackets. */ > /* > * If it's a network program, put the network include files next. > * Group the includes files by subdirectory. > */ > #include <net/if.h> > #include <net/if_dl.h> > #include <net/route.h> > #include <netinet/in.h> > #include <protocols/rwhod.h> > /* > * Then there's a blank line, followed by the /usr include files. > * The /usr include files should be sorted lexicographically! > */ > #include <assert.h> > #include <errno.h> > #include <inttypes.h> > #include <stdio.h> > #include <stdlib.h> > /* > * Global pathnames are defined in /usr/include/paths.h. Pathnames local > * to the program go in pathnames.h in the local directory. > */ > #include <paths.h> > /* Then, there's a blank line, and the user include files. */ > #include "pathnames.h" /* Local includes in double quotes. */ > > While the order of standard C headers can be pretty arbitrary, the system > ones shall be included in the above order. > It's crucial for <sys/param.h> and <sys/types.h> to be on a top as other > headers may assume that they were > already included. > > *Sent:* Wednesday, September 07, 2016 at 12:05 AM > *From:* "Dimitry Andric via lldb-commits" <lldb-commits@lists.llvm.org> > *To:* "Zachary Turner" <ztur...@google.com> > *Cc:* lldb-commits@lists.llvm.org > *Subject:* Re: [Lldb-commits] [lldb] r280755 - Reorder FreeBSD Host.cpp > #includes to fix build > In general, <sys/*> and <machine/*> headers should be at the top, followed > by standard headers such as <stdio.h>, then followed by > application-specific headers. IIRC this is also the case for Linux. > > -Dimitry > > > On 07 Sep 2016, at 00:02, Zachary Turner via lldb-commits < > lldb-commits@lists.llvm.org> wrote: > > Why was this causing a problem? The only headers that were re-ordered are > system headers. Does FreeBSD's libraries have requirements about certain > headers being included before other headers? > > On Tue, Sep 6, 2016 at 2:33 PM Ed Maste via lldb-commits < > lldb-commits@lists.llvm.org> wrote: > > Author: emaste > Date: Tue Sep 6 16:25:31 2016 > New Revision: 280755 > > URL: http://llvm.org/viewvc/llvm-project?rev=280755&view=rev > Log: > Reorder FreeBSD Host.cpp #includes to fix build > > Modified: > lldb/trunk/source/Host/freebsd/Host.cpp > > Modified: lldb/trunk/source/Host/freebsd/Host.cpp > URL: > http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Host/freebsd/Host.cpp?rev=280755&r1=280754&r2=280755&view=diff > > ============================================================================== > --- lldb/trunk/source/Host/freebsd/Host.cpp (original) > +++ lldb/trunk/source/Host/freebsd/Host.cpp Tue Sep 6 16:25:31 2016 > @@ -9,17 +9,19 @@ > > > //===----------------------------------------------------------------------===// > > // C Includes > -#include <dlfcn.h> > -#include <execinfo.h> > -#include <stdio.h> > +#include <sys/types.h> > + > +#include <sys/exec.h> > #include <sys/proc.h> > +#include <sys/ptrace.h> > #include <sys/sysctl.h> > -#include <sys/types.h> > #include <sys/user.h> > > #include <machine/elf.h> > -#include <sys/exec.h> > -#include <sys/ptrace.h> > + > +#include <dlfcn.h> > +#include <execinfo.h> > +#include <stdio.h> > > // C++ Includes > // Other libraries and framework includes > > > _______________________________________________ > lldb-commits mailing list > lldb-commits@lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits > > _______________________________________________ > lldb-commits mailing list > lldb-commits@lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits > > > _______________________________________________ lldb-commits mailing list > lldb-commits@lists.llvm.org > http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits >
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits