trafficserver-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From James Peach <>
Subject Re: RFC: self-contained headers
Date Sun, 03 Jul 2016 04:40:26 GMT

> On Jul 2, 2016, at 5:11 PM, Alan Carroll <>
> Yes, it's unclear to me what "self contained" means. Obviously we can't have exactly
one header file for Traffic Server, so include must be allowed. What property of the current
header file structure doesn't include sufficiently to make clang-tidy happy? 

By self-contained I mean that each header #includes all the others that it depends on. For
example, if you have to #include a bunch of other headers in your .cc before you include foo.h,
then foo.h is not self-contained. It would be self-contained if it #included everything that
it needed.

One specific example. I_Lock.h is not self contained because it doesn’t #include the headers
needed for RefCountObj, Ptr and a bunch of other stuff. To make clang-tidy changes to a header
file, you would do this:

/opt/clang/bin/clang-tidy -fix -fix-errors I_Lock.h -- c++ -DHAVE_CONFIG_H -I. -I../../lib
 -I../../lib -I../../lib/records -Ddarwin -DDEBUG -D_DEBUG -D_LARGEFILE64_SOURCE=1 -D_COMPILE64BIT_SOURCE=1
-D_GNU_SOURCE -D_REENTRANT -D__STDC_LIMIT_MACROS=1 -D__STDC_FORMAT_MACROS=1 -I/usr/local/Cellar/openssl/1.0.2h_1/include
-DOPENSSL_NO_SSL_INTERN -I/System/Library/Frameworks/Tcl.framework/Versions/8.5/Headers -I/usr/local/include
-I/usr/local/Cellar/pcre/8.39/include  -O0 -std=c++11 -g -pipe -Wall -Wno-deprecated-declarations
-Qunused-arguments -Werror -Wno-invalid-offsetof -mcx16 -x c++

Note that the header itself is passes to clang-tidy, so for the code in the header to be valid
in this context, clang-tidy needs to see all the prerequisites.

View raw message