[ros-dev] [ros-diffs] [cwittich] 32018: compilerflags can be set for compiler {ALL|CC|CPP} now (ALL is default)
Marc Piulachs
marc.piulachs at codexchange.net
Sat Jan 26 20:34:17 CET 2008
Hi,
I'm not very sure about r32018-r32022.
Some compiler warnings are stupid and useless, some others not. I think we
should solve the underlying problem when possible. Yes, I know it's easier
to say than to do but silent them in an indiscriminate way just because
clean builds are cooler is not the solution. Warnings are there for
something...
Also, we should work to actually remove <compilerflags> and <linkerflags>
elements and express that information in a compiler/linker agnostic language
now that we want to support at least an additional compiler and linker(MSVC)
Regards,
/Marc
> -----Original Message-----
> From: ros-diffs-bounces at reactos.org [mailto:ros-diffs-bounces at reactos.org]
> On Behalf Of cwittich at svn.reactos.org
> Sent: Saturday, January 26, 2008 7:28 PM
> To: ros-diffs at reactos.org
> Subject: [ros-diffs] [cwittich] 32018: compilerflags can be set for
> compiler {ALL|CC|CPP} now (ALL is default)
>
> Author: cwittich
> Date: Sat Jan 26 21:27:37 2008
> New Revision: 32018
>
> URL: http://svn.reactos.org/svn/reactos?rev=32018&view=rev
> Log:
> compilerflags can be set for compiler {ALL|CC|CPP} now (ALL is default)
>
> Modified:
> trunk/reactos/tools/rbuild/backend/mingw/mingw.cpp
> trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp
> trunk/reactos/tools/rbuild/backend/mingw/modulehandler.h
> trunk/reactos/tools/rbuild/compilerflag.cpp
> trunk/reactos/tools/rbuild/rbuild.h
>
> Modified: trunk/reactos/tools/rbuild/backend/mingw/mingw.cpp
> URL:
> http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/backend/ming
> w/mingw.cpp?rev=32018&r1=32017&r2=32018&view=diff
> ==========================================================================
> ====
> --- trunk/reactos/tools/rbuild/backend/mingw/mingw.cpp (original)
> +++ trunk/reactos/tools/rbuild/backend/mingw/mingw.cpp Sat Jan 26 21:27:37
> 2008
> @@ -448,10 +448,13 @@
>
> for ( i = 0; i < data.compilerFlags.size(); i++ )
> {
> - fprintf (
> - fMakefile,
> - " %s",
> - data.compilerFlags[i]->flag.c_str() );
> + if ( data.compilerFlags[i]->compiler == CompilerTypeDontCare
)
> + {
> + fprintf (
> + fMakefile,
> + " %s",
> + data.compilerFlags[i]->flag.c_str() );
> + }
> }
>
> fprintf ( fMakefile, "\n" );
>
> Modified: trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp
> URL:
> http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/backend/ming
> w/modulehandler.cpp?rev=32018&r1=32017&r2=32018&view=diff
> ==========================================================================
> ====
> --- trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp (original)
> +++ trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp Sat Jan 26
> 21:27:37 2008
> @@ -764,15 +764,18 @@
> }
>
> string
> -MingwModuleHandler::GenerateCompilerParametersFromVector ( const
> vector<CompilerFlag*>& compilerFlags ) const
> +MingwModuleHandler::GenerateCompilerParametersFromVector ( const
> vector<CompilerFlag*>& compilerFlags, const CompilerType type ) const
> {
> string parameters;
> for ( size_t i = 0; i < compilerFlags.size (); i++ )
> {
> CompilerFlag& compilerFlag = *compilerFlags[i];
> - if ( parameters.length () > 0 )
> - parameters += " ";
> - parameters += compilerFlag.flag;
> + if ( compilerFlag.compiler == type )
> + {
> + if ( parameters.length () > 0 )
> + parameters += " ";
> + parameters += compilerFlag.flag;
> + }
> }
> return parameters;
> }
> @@ -848,7 +851,7 @@
>
> if ( generatingCompilerMacro )
> {
> - string compilerParameters =
> GenerateCompilerParametersFromVector ( data.compilerFlags );
> + string compilerParameters =
> GenerateCompilerParametersFromVector ( data.compilerFlags ,
> CompilerTypeDontCare );
> if ( compilerParameters.size () > 0 )
> {
> fprintf (
> @@ -1719,21 +1722,25 @@
> {
> const FileLocation& sourceFile = compilationUnit.GetFilename ();
> string extension = GetExtension ( sourceFile );
> + string flags = cflagsMacro;
> + flags += " ";
> if ( extension == ".c" || extension == ".C" )
> {
> + flags += GenerateCompilerParametersFromVector (
> module.non_if_data.compilerFlags , CompilerTypeCC );
> GenerateGccCommand ( &sourceFile,
> GetCompilationUnitDependencies (
> compilationUnit ) + extraDependencies,
> cc,
> - cflagsMacro );
> + flags );
> }
> else if ( extension == ".cc" || extension == ".CC" ||
> extension == ".cpp" || extension == ".CPP" ||
> extension == ".cxx" || extension == ".CXX" )
> {
> + flags += GenerateCompilerParametersFromVector (
> module.non_if_data.compilerFlags , CompilerTypeCPP );
> GenerateGccCommand ( &sourceFile,
> GetCompilationUnitDependencies (
> compilationUnit ) + extraDependencies,
> cppc,
> - cflagsMacro );
> + flags );
> }
> else if ( extension == ".s" || extension == ".S" )
> {
>
> Modified: trunk/reactos/tools/rbuild/backend/mingw/modulehandler.h
> URL:
> http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/backend/ming
> w/modulehandler.h?rev=32018&r1=32017&r2=32018&view=diff
> ==========================================================================
> ====
> --- trunk/reactos/tools/rbuild/backend/mingw/modulehandler.h (original)
> +++ trunk/reactos/tools/rbuild/backend/mingw/modulehandler.h Sat Jan 26
> 21:27:37 2008
> @@ -130,7 +130,7 @@
> std::string ConcatenatePaths ( const std::string& path1,
> const std::string& path2 ) const;
> std::string GenerateGccDefineParameters () const;
> - std::string GenerateCompilerParametersFromVector ( const
> std::vector<CompilerFlag*>& compilerFlags ) const;
> + std::string GenerateCompilerParametersFromVector ( const
> std::vector<CompilerFlag*>& compilerFlags, const CompilerType type )
> const;
> std::string GenerateLinkerParametersFromVector ( const
> std::vector<LinkerFlag*>& linkerFlags ) const;
> std::string GenerateImportLibraryDependenciesFromVector ( const
> std::vector<Library*>& libraries );
> std::string GenerateLinkerParameters () const;
>
> Modified: trunk/reactos/tools/rbuild/compilerflag.cpp
> URL:
> http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/compilerflag
> .cpp?rev=32018&r1=32017&r2=32018&view=diff
> ==========================================================================
> ====
> --- trunk/reactos/tools/rbuild/compilerflag.cpp (original)
> +++ trunk/reactos/tools/rbuild/compilerflag.cpp Sat Jan 26 21:27:37 2008
> @@ -55,7 +55,25 @@
> node.location,
> "<compilerflag> is empty." );
> }
> +
> flag = node.value;
> + compiler = CompilerTypeDontCare;
> +
> + const XMLAttribute* att = node.GetAttribute ( "compiler", false );
> + if ( att != NULL)
> + {
> + if ( att->value == "cpp" )
> + compiler = CompilerTypeCPP;
> + else if ( att->value == "cc" )
> + compiler = CompilerTypeCC;
> + else
> + {
> + throw InvalidAttributeValueException (
> + node.location,
> + "compiler",
> + att->value );
> + }
> + }
> }
>
> void
>
> Modified: trunk/reactos/tools/rbuild/rbuild.h
> URL:
> http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/rbuild.h?rev
> =32018&r1=32017&r2=32018&view=diff
> ==========================================================================
> ====
> --- trunk/reactos/tools/rbuild/rbuild.h (original)
> +++ trunk/reactos/tools/rbuild/rbuild.h Sat Jan 26 21:27:37 2008
> @@ -309,6 +309,13 @@
> HostDefault,
> HostTrue,
> HostDontCare,
> +};
> +
> +enum CompilerType
> +{
> + CompilerTypeDontCare,
> + CompilerTypeCC,
> + CompilerTypeCPP,
> };
>
> class FileLocation
> @@ -592,6 +599,7 @@
> const Module* module;
> const XMLElement& node;
> std::string flag;
> + CompilerType compiler;
>
> CompilerFlag ( const Project& project,
> const XMLElement& compilerFlagNode );
>
More information about the Ros-dev
mailing list