Author: hpoussin
Date: Fri Feb 29 15:10:07 2008
New Revision: 32529
URL: 
http://svn.reactos.org/svn/reactos?rev=32529&view=rev
Log:
GetObjectFilename() shouldn't be able to modify the list of generated files
Modified:
    trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp
    trunk/reactos/tools/rbuild/backend/mingw/modulehandler.h
Modified: trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/backend/mingw…
==============================================================================
--- trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp (original)
+++ trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp Fri Feb 29 15:10:07 2008
@@ -280,7 +280,7 @@
        string extension = GetExtension ( *file );
        if ( extension == ".spec" || extension == ".SPEC" )
        {
-               const FileLocation *objectFile = GetObjectFilename ( file, module, NULL );
+               const FileLocation *objectFile = GetObjectFilename ( file, module );
                FileLocation *sourceFile = new FileLocation (
                        objectFile->directory,
                        objectFile->relative_path,
@@ -291,7 +291,7 @@
        else if ( ( extension == ".idl" || extension == ".IDL" )
&&
                  ( module.type == RpcServer || module.type == RpcClient || module.type ==
RpcProxy ) )
        {
-               const FileLocation *objectFile = GetObjectFilename ( file, module, NULL );
+               const FileLocation *objectFile = GetObjectFilename ( file, module );
                FileLocation *sourceFile = new FileLocation (
                        objectFile->directory,
                        objectFile->relative_path,
@@ -301,7 +301,7 @@
        }
        else if ( extension == ".mc" || extension == ".MC" )
        {
-               const FileLocation *objectFile = GetObjectFilename ( file, module, NULL );
+               const FileLocation *objectFile = GetObjectFilename ( file, module );
                FileLocation *sourceFile = new FileLocation (
                        objectFile->directory,
                        objectFile->relative_path,
@@ -417,7 +417,7 @@
                {
                        CompilationUnit& compilationUnit = *compilationUnits[i];
                        const FileLocation& compilationName =
compilationUnit.GetFilename ();
-                       const FileLocation *objectFilename = GetObjectFilename (
&compilationName, importedModule, NULL );
+                       const FileLocation *objectFilename = GetObjectFilename (
&compilationName, importedModule );
                        if ( GetExtension ( *objectFilename ) == ".h" )
                                dep += ssprintf ( " $(%s_HEADERS)",
importedModule.name.c_str () );
                        else if ( GetExtension ( *objectFilename ) == ".rc" )
@@ -529,8 +529,7 @@
 const FileLocation*
 MingwModuleHandler::GetObjectFilename (
        const FileLocation* sourceFile,
-       const Module& module,
-       string_list* pclean_files ) const
+       const Module& module ) const
 {
        DirectoryLocation destination_directory;
        string newExtension;
@@ -567,12 +566,8 @@
                destination_directory,
                sourceFile->relative_path,
                ReplaceExtension ( sourceFile->name, newExtension ) );
-
-       if ( pclean_files )
-       {
-               string_list& clean_files = *pclean_files;
-               CLEAN_FILE ( *obj_file );
-       }
+       PassThruCacheDirectory ( obj_file );
+
        return obj_file;
 }
@@ -676,7 +671,7 @@
                if ( objectFilenames.size () > 0 )
                        objectFilenames += " ";
                const FileLocation& compilationName =
compilationUnits[i]->GetFilename ();
-               const FileLocation *object_file = GetObjectFilename (
&compilationName, module, NULL );
+               const FileLocation *object_file = GetObjectFilename (
&compilationName, module );
                objectFilenames += backend->GetFullName ( *object_file );
                delete object_file;
        }
@@ -1097,7 +1092,7 @@
                        if ( compilationUnit.IsFirstFile () )
                        {
                                const FileLocation& compilationName =
compilationUnit.GetFilename ();
-                               const FileLocation *object_file = GetObjectFilename (
&compilationName, module, NULL );
+                               const FileLocation *object_file = GetObjectFilename (
&compilationName, module );
                                fprintf ( fMakefile,
                                        "%s := %s $(%s)\n",
                                        objectsMacro.c_str(),
@@ -1117,7 +1112,7 @@
                        if ( !compilationUnit.IsFirstFile () )
                        {
                                const FileLocation& compilationName =
compilationUnit.GetFilename ();
-                               const FileLocation *objectFilename = GetObjectFilename (
&compilationName, module, NULL );
+                               const FileLocation *objectFilename = GetObjectFilename (
&compilationName, module );
                                if ( GetExtension ( *objectFilename ) == ".h" )
                                        headers.push_back ( objectFilename );
                                else if ( GetExtension ( *objectFilename ) ==
".rc" )
@@ -1227,7 +1222,7 @@
        for ( i = 0; i < sourceCompilationUnits.size (); i++ )
        {
                const FileLocation& compilationName =
sourceCompilationUnits[i]->GetFilename ();
-               const FileLocation *object_file = GetObjectFilename (
&compilationName, module, NULL );
+               const FileLocation *object_file = GetObjectFilename (
&compilationName, module );
                fprintf (
                        fMakefile,
                        "%s += %s\n",
@@ -1290,6 +1285,7 @@
                      "\t$(Q)$(WINEBUILD_TARGET) $(WINEBUILD_FLAGS) -o
$(INTERMEDIATE)$(SEP)$(source_path)$(SEP)$(source_name_noext).stubs.c --pedll
$(source_path)$(SEP)$(source_name_noext).spec\n",
"$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).spec.def",
"$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).stubs.c",
+
"$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).stubs.o",
                      "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)", NULL );
 Rule widlHeaderRule (
"$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).h: $(source)
$(module_rbuild) $(WIDL_TARGET) | $(INTERMEDIATE)$(SEP)$(source_dir)\n"
                       "\t$(ECHO_WIDL)\n"
@@ -1301,18 +1297,21 @@
                       "\t$(Q)$(WIDL_TARGET) $($(module_name)_WIDLFLAGS) -h -H
$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_s.h -s -S
$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_s.c $(source)\n",
"$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_s.h",
"$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_s.c",
+
"$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_s.o",
                       "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)", NULL );
 Rule widlClientRule (
"$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_c.c
$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_c.h: $(source)
$(module_rbuild) $(WIDL_TARGET) | $(INTERMEDIATE)$(SEP)$(source_dir)\n"
                       "\t$(ECHO_WIDL)\n"
                       "\t$(Q)$(WIDL_TARGET) $($(module_name)_WIDLFLAGS) -h -H
$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_c.h -c -C
$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_c.c $(source)\n",
"$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_c.h",
"$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_c.c",
+
"$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_c.o",
                       "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)", NULL );
 Rule widlProxyRule (
"$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_p.c
$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_p.h: $(source)
$(module_rbuild) $(WIDL_TARGET) | $(INTERMEDIATE)$(SEP)$(source_dir)\n"
                      "\t$(ECHO_WIDL)\n"
                      "\t$(Q)$(WIDL_TARGET)  $($(module_name)_WIDLFLAGS) -h -H
$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_p.h -p -P
$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_p.c $(source)\n",
"$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_p.h",
"$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_p.c",
+
"$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_p.o",
                      "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)", NULL );
 Rule widlTlbRule ( "$(OUTPUT)$(SEP)$(source_dir)$(SEP)$(module_name).tlb: $(source)
$(module_rbuild) $(WIDL_TARGET) | $(INTERMEDIATE)$(SEP)$(source_dir)\n"
                    "\t$(ECHO_WIDL)\n"
@@ -1363,13 +1362,12 @@
        dependencies += " " + NormalizeFilename ( module.xmlbuildFile );
        const FileLocation *objectFilename = GetObjectFilename (
-               sourceFile, module, NULL );
+               sourceFile, module );
        fprintf ( fMakefile,
                  "%s: %s | %s\n",
                  backend->GetFullName ( *objectFilename ).c_str (),
                  dependencies.c_str (),
                  backend->GetFullPath ( *objectFilename ).c_str () );
-       CLEAN_FILE(*objectFilename);
        delete objectFilename;
        fprintf ( fMakefile, "\t$(ECHO_CC)\n" );
@@ -1479,6 +1477,11 @@
        if ( extension == ".c" || extension == ".cc" || extension ==
".cpp" || extension == ".cxx" )
        {
+               const FileLocation *objectFilename = GetObjectFilename (
+                       &sourceFile, module );
+               CLEAN_FILE ( *objectFilename );
+               delete objectFilename;
+
                GenerateGccCommand ( &sourceFile,
                                     GetCompilationUnitDependencies ( compilationUnit ) +
extraDependencies );
        }
@@ -1589,7 +1592,7 @@
        {
                CompilationUnit& compilationUnit = *data.compilationUnits[i];
                const FileLocation& compilationName = compilationUnit.GetFilename ();
-               const FileLocation *object_file = GetObjectFilename (
&compilationName, module, NULL );
+               const FileLocation *object_file = GetObjectFilename (
&compilationName, module );
                objectFiles.push_back ( *object_file );
                delete object_file;
        }
@@ -1771,7 +1774,7 @@
        {
                CompilationUnit& compilationUnit = *compilationUnits[i];
                const FileLocation& compilationName = compilationUnit.GetFilename ();
-               const FileLocation *objectFilename = GetObjectFilename (
&compilationName, module, NULL );
+               const FileLocation *objectFilename = GetObjectFilename (
&compilationName, module );
                if ( GetExtension ( *objectFilename ) == ".h" )
                        moduleDependencies += ssprintf ( " $(%s_HEADERS)",
module.name.c_str () );
                else if ( GetExtension ( *objectFilename ) == ".rc" )
Modified: trunk/reactos/tools/rbuild/backend/mingw/modulehandler.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/backend/mingw…
==============================================================================
--- trunk/reactos/tools/rbuild/backend/mingw/modulehandler.h (original)
+++ trunk/reactos/tools/rbuild/backend/mingw/modulehandler.h Fri Feb 29 15:10:07 2008
@@ -97,8 +97,7 @@
                                  bool includeGeneratedFiles ) const;
        void GetSourceFilenamesWithoutGeneratedFiles (
std::vector<FileLocation>& list ) const;
        const FileLocation* GetObjectFilename ( const FileLocation* sourceFile,
-                                               const Module& module,
-                                               string_list* pclean_files ) const;
+                                               const Module& module ) const;
        std::string GetObjectFilenames ();