Disable pre-compiled headers when using compilation units Modified: trunk/reactos/tools/rbuild/backend/mingw/mingw.cpp Modified: trunk/reactos/tools/rbuild/backend/mingw/mingw.h Modified: trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp Modified: trunk/reactos/tools/rbuild/backend/mingw/modulehandler.h Modified: trunk/reactos/tools/rbuild/compilationunitsupportcode.cpp _____
Modified: trunk/reactos/tools/rbuild/backend/mingw/mingw.cpp --- trunk/reactos/tools/rbuild/backend/mingw/mingw.cpp 2005-11-23 13:45:34 UTC (rev 19485) +++ trunk/reactos/tools/rbuild/backend/mingw/mingw.cpp 2005-11-23 15:05:53 UTC (rev 19486) @@ -89,6 +89,42 @@
return directoryTree->name; }
+bool +MingwBackend::CanEnablePreCompiledHeaderSupportForModule ( const Module& module ) +{ + if ( !configuration.CompilationUnitsEnabled ) + return true; + + const vector<CompilationUnit*>& compilationUnits = module.non_if_data.compilationUnits; + size_t i; + for ( i = 0; i < compilationUnits.size (); i++ ) + { + CompilationUnit& compilationUnit = *compilationUnits[i]; + if ( compilationUnit.files.size () != 1 ) + return false; + } + // intentionally make a copy so that we can append more work in + // the middle of processing without having to go recursive + vector<If*> v = module.non_if_data.ifs; + for ( i = 0; i < v.size (); i++ ) + { + size_t j; + If& rIf = *v[i]; + // check for sub-ifs to add to list + const vector<If*>& ifs = rIf.data.ifs; + for ( j = 0; j < ifs.size (); j++ ) + v.push_back ( ifs[j] ); + const vector<CompilationUnit*>& compilationUnits = rIf.data.compilationUnits; + for ( j = 0; j < compilationUnits.size (); j++ ) + { + CompilationUnit& compilationUnit = *compilationUnits[j]; + if ( compilationUnit.files.size () != 1 ) + return false; + } + } + return true; +} + void MingwBackend::ProcessModules () { @@ -104,6 +140,8 @@ MingwModuleHandler* h = MingwModuleHandler::InstanciateHandler ( module, this ); + if ( use_pch && CanEnablePreCompiledHeaderSupportForModule ( module ) ) + h->EnablePreCompiledHeaderSupport (); if ( module.host == HostDefault ) { module.host = h->DefaultHost(); @@ -207,7 +245,6 @@ throw AccessDeniedException ( ProjectNode.makefile ); MingwModuleHandler::SetBackend ( this ); MingwModuleHandler::SetMakefile ( fMakefile ); - MingwModuleHandler::SetUsePch ( use_pch ); }
void _____
Modified: trunk/reactos/tools/rbuild/backend/mingw/mingw.h --- trunk/reactos/tools/rbuild/backend/mingw/mingw.h 2005-11-23 13:45:34 UTC (rev 19485) +++ trunk/reactos/tools/rbuild/backend/mingw/mingw.h 2005-11-23 15:05:53 UTC (rev 19486) @@ -92,6 +92,7 @@
void DetectNetwideAssembler (); void DetectPipeSupport (); void DetectPCHSupport (); + bool CanEnablePreCompiledHeaderSupportForModule ( const Module& module ); void ProcessModules (); void CheckAutomaticDependenciesForModuleOnly (); void ProcessNormal (); _____
Modified: trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp --- trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp 2005-11-23 13:45:34 UTC (rev 19485) +++ trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp 2005-11-23 15:05:53 UTC (rev 19486) @@ -32,8 +32,6 @@
MingwModuleHandler::backend = NULL; FILE* MingwModuleHandler::fMakefile = NULL; -bool -MingwModuleHandler::use_pch = false;
string PrefixFilename ( @@ -73,6 +71,7 @@
: module(module_) { + use_pch = false; }
MingwModuleHandler::~MingwModuleHandler() @@ -91,10 +90,10 @@ fMakefile = f; }
-/*static*/ void -MingwModuleHandler::SetUsePch ( bool b ) +void +MingwModuleHandler::EnablePreCompiledHeaderSupport () { - use_pch = b; + use_pch = true; }
/* static*/ string _____
Modified: trunk/reactos/tools/rbuild/backend/mingw/modulehandler.h --- trunk/reactos/tools/rbuild/backend/mingw/modulehandler.h 2005-11-23 13:45:34 UTC (rev 19485) +++ trunk/reactos/tools/rbuild/backend/mingw/modulehandler.h 2005-11-23 15:05:53 UTC (rev 19486) @@ -39,7 +39,7 @@
static void SetBackend ( MingwBackend* backend_ ); static void SetMakefile ( FILE* f ); - static void SetUsePch ( bool use_pch ); + void EnablePreCompiledHeaderSupport ();
static std::string PassThruCacheDirectory ( const std::string &f, @@ -125,7 +125,7 @@ std::string GetLinkingDependencies () const; static MingwBackend* backend; static FILE* fMakefile; - static bool use_pch; + bool use_pch; private: std::string ConcatenatePaths ( const std::string& path1, const std::string& path2 ) const; _____
Modified: trunk/reactos/tools/rbuild/compilationunitsupportcode.cpp --- trunk/reactos/tools/rbuild/compilationunitsupportcode.cpp 2005-11-23 13:45:34 UTC (rev 19485) +++ trunk/reactos/tools/rbuild/compilationunitsupportcode.cpp 2005-11-23 15:05:53 UTC (rev 19486) @@ -82,8 +82,6 @@
s = buf; s = s + sprintf ( s, "/* This file is automatically generated. */\n" ); s = s + sprintf ( s, "#define ONE_COMPILATION_UNIT\n" ); - if ( module.pch ) - s = s + sprintf ( s, "#include <%s>\n", ChangeSeparator ( module.pch->file.name, '\', '/' ).c_str () );
for ( size_t i = 0; i < compilationUnit.files.size () ; i++ ) {