mirror of
https://github.com/reactos/reactos.git
synced 2025-01-12 01:00:06 +00:00
Better error reporting in case of define override
Support empty defines svn path=/trunk/; revision=30149
This commit is contained in:
parent
cdc0ef2243
commit
69251b5abf
2 changed files with 34 additions and 27 deletions
|
@ -644,11 +644,8 @@ MingwModuleHandler::GenerateGccDefineParametersFromVector (
|
|||
parameters += "$(QT)";
|
||||
parameters += "-D";
|
||||
parameters += define.name;
|
||||
if (define.value.length () > 0)
|
||||
{
|
||||
parameters += "=";
|
||||
parameters += define.value;
|
||||
}
|
||||
parameters += "=";
|
||||
parameters += define.value;
|
||||
if (define.name.find('(') != string::npos)
|
||||
parameters += "$(QT)";
|
||||
used_defs.insert(used_defs.begin(),define.name);
|
||||
|
@ -766,7 +763,7 @@ MingwModuleHandler::GenerateMacro (
|
|||
const char* assignmentOperation,
|
||||
const string& macro,
|
||||
const IfableData& data,
|
||||
set<string> *used_defs,
|
||||
set<const Define *> *used_defs,
|
||||
bool generatingCompilerMacro )
|
||||
{
|
||||
size_t i;
|
||||
|
@ -814,32 +811,42 @@ MingwModuleHandler::GenerateMacro (
|
|||
for ( i = 0; i < data.defines.size(); i++ )
|
||||
{
|
||||
const Define& define = *data.defines[i];
|
||||
if ( used_defs && used_defs->find ( define.name ) != used_defs->end () )
|
||||
if ( used_defs )
|
||||
{
|
||||
if ( !define.overridable )
|
||||
set<const Define *>::const_iterator last_define;
|
||||
for (last_define = used_defs->begin ();
|
||||
last_define != used_defs->end ();
|
||||
last_define++)
|
||||
{
|
||||
throw InvalidOperationException ( __FILE__,
|
||||
__LINE__,
|
||||
"Invalid override of define '%s' in module '%s'",
|
||||
define.name.c_str (),
|
||||
module.name.c_str () );
|
||||
if ( (*last_define)->name != define.name )
|
||||
continue;
|
||||
if ( !define.overridable )
|
||||
{
|
||||
throw InvalidOperationException ( define.node->location.c_str (),
|
||||
0,
|
||||
"Invalid override of define '%s', already defined at %s",
|
||||
define.name.c_str (),
|
||||
(*last_define)->node->location.c_str () );
|
||||
}
|
||||
if ( backend->configuration.Verbose )
|
||||
printf("%s: Overriding '%s' already defined at %s\n",
|
||||
(*last_define)->node->location.c_str (), define.name.c_str (),
|
||||
define.node->location.c_str () );
|
||||
break;
|
||||
}
|
||||
if ( backend->configuration.Verbose )
|
||||
printf("Define '%s' overridden in module '%s'\n",
|
||||
define.name.c_str (), module.name.c_str () );
|
||||
continue;
|
||||
if ( last_define != used_defs->end () )
|
||||
continue;
|
||||
}
|
||||
fprintf (
|
||||
fMakefile,
|
||||
" -D%s",
|
||||
define.name.c_str() );
|
||||
if ( define.value.size() )
|
||||
fprintf (
|
||||
fMakefile,
|
||||
"=%s",
|
||||
define.value.c_str() );
|
||||
fprintf (
|
||||
fMakefile,
|
||||
"=%s",
|
||||
define.value.c_str() );
|
||||
if ( used_defs )
|
||||
used_defs->insert(used_defs->begin(), define.name);
|
||||
used_defs->insert( used_defs->begin (), &define );
|
||||
}
|
||||
if ( generateAssignment )
|
||||
{
|
||||
|
@ -852,7 +859,7 @@ MingwModuleHandler::GenerateMacros (
|
|||
const char* assignmentOperation,
|
||||
const IfableData& data,
|
||||
const vector<LinkerFlag*>* linkerFlags,
|
||||
set<string>& used_defs )
|
||||
set<const Define *>& used_defs )
|
||||
{
|
||||
size_t i;
|
||||
|
||||
|
@ -2050,7 +2057,7 @@ MingwModuleHandler::GetRpcHeaderDependencies (
|
|||
void
|
||||
MingwModuleHandler::GenerateOtherMacros ()
|
||||
{
|
||||
set<string> used_defs;
|
||||
set<const Define *> used_defs;
|
||||
|
||||
cflagsMacro = ssprintf ("%s_CFLAGS", module.name.c_str ());
|
||||
nasmflagsMacro = ssprintf ("%s_NASMFLAGS", module.name.c_str ());
|
||||
|
|
|
@ -137,12 +137,12 @@ private:
|
|||
void GenerateMacro ( const char* assignmentOperation,
|
||||
const std::string& macro,
|
||||
const IfableData& data,
|
||||
std::set<std::string>* used_defs,
|
||||
std::set<const Define *>* used_defs,
|
||||
bool generatingCompilerMacro );
|
||||
void GenerateMacros ( const char* op,
|
||||
const IfableData& data,
|
||||
const std::vector<LinkerFlag*>* linkerFlags,
|
||||
std::set<std::string>& used_defs );
|
||||
std::set<const Define *>& used_defs );
|
||||
void GenerateSourceMacros ( const char* assignmentOperation,
|
||||
const IfableData& data );
|
||||
void GenerateObjectMacros ( const char* assignmentOperation,
|
||||
|
|
Loading…
Reference in a new issue