Skip to content

Commit

Permalink
Remove unused headers
Browse files Browse the repository at this point in the history
Reduce build time by:
- using iosfwd instead of iostream, where possible
- where iostream is necessary but only used for debugging,
  making its inclusion conditional
- removing old C-style headers

I used IWYU to guide this work
  • Loading branch information
jefftrull committed May 19, 2020
1 parent 2970a40 commit 895ea83
Show file tree
Hide file tree
Showing 27 changed files with 37 additions and 37 deletions.
2 changes: 1 addition & 1 deletion include/boost/wave/cpplexer/re2clex/cpp_re.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
} \
/**/

#include <iostream>
#include <iosfwd>

///////////////////////////////////////////////////////////////////////////////
#define BOOST_WAVE_UPDATE_CURSOR() \
Expand Down
2 changes: 2 additions & 0 deletions samples/cpp_tokens/cpp_tokens.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
#include "slex/cpp_slex_lexer.hpp"
#endif // !defined(BOOST_WAVE_SEPARATE_LEXER_INSTANTIATION)

#include <iostream>

///////////////////////////////////////////////////////////////////////////////
// import required names
using namespace boost::spirit::classic;
Expand Down
2 changes: 1 addition & 1 deletion samples/cpp_tokens/cpp_tokens.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

///////////////////////////////////////////////////////////////////////////////
// include often used files from the stdlib
#include <iostream>
#include <iosfwd>
#include <fstream>
#include <string>

Expand Down
2 changes: 2 additions & 0 deletions samples/cpp_tokens/slex/lexer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@
#include <vector>
#include <stack>
#include <utility> // for pair
#if defined(BOOST_SPIRIT_DEBUG)
#include <iostream>
#endif
#include <fstream>
#include <boost/assert.hpp>
#include <boost/limits.hpp>
Expand Down
2 changes: 1 addition & 1 deletion samples/cpp_tokens/slex_iterator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#define SLEX_ITERATOR_HPP_AF0C37E3_CBD8_4F33_A225_51CF576FA61F_INCLUDED

#include <string>
#include <iostream>
#include <iosfwd>

#include <boost/assert.hpp>
#include <boost/shared_ptr.hpp>
Expand Down
3 changes: 3 additions & 0 deletions samples/hannibal/translation_unit_parser.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
#define HANNIBAL_TRANSLATION_UNIT_GRAMMAR_H_INCLUDED

#include <map>
#if defined(HANNIBAL_TRACE_DECLARATIONS)
#include <iostream>
#endif

#include <boost/assert.hpp>
#include <boost/spirit/include/classic_core.hpp>
Expand Down
1 change: 0 additions & 1 deletion samples/lexed_tokens/lexed_tokens.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#include <iomanip>
#include <fstream>
#include <string>
#include <vector>

///////////////////////////////////////////////////////////////////////////////
// Include Wave itself
Expand Down
2 changes: 2 additions & 0 deletions samples/list_includes/list_includes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
// Include the default context trace policies
#include <boost/wave/preprocessing_hooks.hpp>

#include <iostream>

///////////////////////////////////////////////////////////////////////////////
// include lexer specifics, import lexer names
#if BOOST_WAVE_SEPARATE_LEXER_INSTANTIATION == 0
Expand Down
2 changes: 1 addition & 1 deletion samples/list_includes/list_includes.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

///////////////////////////////////////////////////////////////////////////////
// include often used files from the stdlib
#include <iostream>
#include <iosfwd>
#include <fstream>
#include <string>
#include <vector>
Expand Down
1 change: 1 addition & 0 deletions samples/token_statistics/collect_token_statistics.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

#include <algorithm>
#include <map>
#include <iostream>

#include <boost/assert.hpp>
#include <boost/wave/token_ids.hpp>
Expand Down
2 changes: 2 additions & 0 deletions samples/token_statistics/token_statistics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@

#include "collect_token_statistics.hpp"

#include <iostream>

///////////////////////////////////////////////////////////////////////////////
// import required names
using namespace boost::spirit::classic;
Expand Down
2 changes: 1 addition & 1 deletion samples/token_statistics/token_statistics.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

///////////////////////////////////////////////////////////////////////////////
// include often used files from the stdlib
#include <iostream>
#include <iosfwd>
#include <fstream>
#include <string>
#include <vector>
Expand Down
2 changes: 1 addition & 1 deletion samples/token_statistics/xlex_iterator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
#define XLEX_ITERATOR_HPP

#include <string>
#include <iostream>
#include <iosfwd>

#include <boost/assert.hpp>
#include <boost/shared_ptr.hpp>
Expand Down
2 changes: 2 additions & 0 deletions samples/waveidl/idl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
#include "idllexer/idl_re2c_lexer.hpp"
#endif

#include <iostream>

///////////////////////////////////////////////////////////////////////////////
// include the grammar definitions, if these shouldn't be compiled separately
// (ATTENTION: _very_ large compilation times!)
Expand Down
2 changes: 1 addition & 1 deletion samples/waveidl/idl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

///////////////////////////////////////////////////////////////////////////////
// include often used files from the stdlib
#include <iostream>
#include <iosfwd>
#include <fstream>
#include <string>
#include <vector>
Expand Down
2 changes: 1 addition & 1 deletion samples/waveidl/idllexer/idl_lex_iterator.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#define IDL_LEX_ITERATOR_HPP_7926F865_E02F_4950_9EB5_5F453C9FF953_INCLUDED

#include <string>
#include <iostream>
#include <iosfwd>

#include <boost/assert.hpp>
#include <boost/shared_ptr.hpp>
Expand Down
8 changes: 0 additions & 8 deletions samples/waveidl/idllexer/idl_re.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,6 @@
LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
=============================================================================*/

#include <ctime>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

#include <boost/config.hpp>

#if defined(BOOST_HAS_UNISTD_H)
Expand Down
7 changes: 0 additions & 7 deletions samples/waveidl/idllexer/idl_re.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,9 @@
#if !defined(IDL_RE_HPP_BD62775D_1659_4684_872C_03C02543C9A5_INCLUDED)
#define IDL_RE_HPP_BD62775D_1659_4684_872C_03C02543C9A5_INCLUDED

#include <ctime>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

#include <string>

#include <boost/config.hpp>

#if defined(BOOST_HAS_UNISTD_H)
Expand Down
9 changes: 1 addition & 8 deletions src/cpplexer/re2clex/cpp_re.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,7 @@
// disable stupid compiler warnings
#include <boost/config/warning_disable.hpp>

#include <ctime>
#include <cstdlib>
#include <cstdio>
#include <cstring>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <cstddef>

#include <boost/wave/wave_config.hpp> // configuration data

Expand All @@ -36,7 +30,6 @@
#include <boost/detail/workaround.hpp>

#include <boost/wave/token_ids.hpp>
#include <boost/wave/cpplexer/re2clex/aq.hpp>
#include <boost/wave/cpplexer/re2clex/scanner.hpp>
#include <boost/wave/cpplexer/re2clex/cpp_re.hpp>

Expand Down
1 change: 0 additions & 1 deletion src/wave_config_constant.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
// disable stupid compiler warnings
#include <boost/config/warning_disable.hpp>

#include <cstring>
#include <boost/preprocessor/stringize.hpp>

#include <boost/wave/wave_config.hpp>
Expand Down
4 changes: 3 additions & 1 deletion test/testlexers/test_lexertl_lexer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@

// system headers
#include <string>
#include <iostream>
#include <limits>
#if defined(TESTLEXERS_TIMING)
#include <iostream>
#endif

#include <boost/wave/wave_config.hpp>
#undef BOOST_WAVE_SEPARATE_LEXER_INSTANTIATION
Expand Down
4 changes: 3 additions & 1 deletion test/testlexers/test_re2c_lexer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@
#include <boost/config/warning_disable.hpp>

// system headers
#include <string>
#if defined(TESTLEXERS_TIMING)
#include <iostream>
#endif

#include <limits>

#include <boost/wave/wave_config.hpp>
Expand Down
2 changes: 2 additions & 0 deletions test/testlexers/test_slex_lexer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@

// system headers
#include <string>
#if defined(TESTLEXERS_TIMING)
#include <iostream>
#endif
#include <limits>

#include <boost/wave/wave_config.hpp>
Expand Down
2 changes: 2 additions & 0 deletions test/testlexers/test_xlex_lexer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@

// system headers
#include <string>
#if defined(TESTLEXERS_TIMING)
#include <iostream>
#endif
#include <limits>

#include <boost/wave/wave_config.hpp>
Expand Down
2 changes: 1 addition & 1 deletion test/testwave/testwave_app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

// system headers
#include <string>
#include <iostream>
#include <iosfwd>
#include <vector>
#include <ctime>

Expand Down
2 changes: 2 additions & 0 deletions tool/cpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@
#include <boost/wave/cpplexer/cpp_lex_token.hpp> // token type
#include <boost/wave/cpplexer/cpp_lex_iterator.hpp> // lexer type

#include <iostream>

///////////////////////////////////////////////////////////////////////////////
// Include serialization support, if requested
#if BOOST_WAVE_SERIALIZATION != 0
Expand Down
2 changes: 1 addition & 1 deletion tool/cpp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

///////////////////////////////////////////////////////////////////////////////
// include often used files from the stdlib
#include <iostream>
#include <iosfwd>
#include <string>
#include <vector>
#include <algorithm>
Expand Down

0 comments on commit 895ea83

Please sign in to comment.