0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-11-15 22:41:12 +01:00

ircd: Replace iostream include with iosfwd to elide inits in every unit.

This commit is contained in:
Jason Volk 2018-07-01 14:10:20 -07:00
parent c4c155e003
commit a3db6f2a95
2 changed files with 16 additions and 1 deletions

View file

@ -78,7 +78,7 @@ extern "C"
#include <RB_INC_QUEUE #include <RB_INC_QUEUE
#include <RB_INC_SSTREAM #include <RB_INC_SSTREAM
#include <RB_INC_FSTREAM #include <RB_INC_FSTREAM
#include <RB_INC_IOSTREAM #include <RB_INC_IOSFWD
#include <RB_INC_IOMANIP #include <RB_INC_IOMANIP
#include <RB_INC_CSTDIO #include <RB_INC_CSTDIO
#include <RB_INC_CHRONO #include <RB_INC_CHRONO
@ -128,6 +128,17 @@ namespace std
} }
#endif #endif
// Forward declare the existence of these in std:: to allow their immediate
// use throughout the project as a developer convenience. <iostream> is not
// included here because it generates naive initialization code in every unit,
// whereas we conduct it once for libircd in the right place.
namespace std
{
extern istream cin;
extern ostream cout;
extern ostream cerr;
}
// OpenSSL // OpenSSL
// Additional forward declarations in the extern namespace are introduced // Additional forward declarations in the extern namespace are introduced
// by ircd/openssl.h // by ircd/openssl.h

View file

@ -8,6 +8,10 @@
// copyright notice and this permission notice is present in all copies. The // copyright notice and this permission notice is present in all copies. The
// full license for this software is available in the LICENSE file. // full license for this software is available in the LICENSE file.
#include <RB_INC_IOSTREAM
// <iostream> inclusion here runs std::ios_base::Init() statically as this unit
// is initialized (GNU initialization order given in Makefile).
namespace ircd::log namespace ircd::log
{ {
// Option toggles // Option toggles