[calamares] Reduce compile warnings in tests

- Switch debug-level to unsigned
 - Don't shadow usings; the first TR type is enough
 - The (bogus) return values were commented as // NOTREACHED,
   but still yield unreachable code warnings. Drop them
   instead, and rely on the compiler understanding [[noreturn]]
   on parser.usage().
This commit is contained in:
Adriaan de Groot 2019-04-11 12:14:04 +02:00
parent b10c7ad9c6
commit b416842c20

View File

@ -80,9 +80,9 @@ handle_args( QCoreApplication& a )
if ( parser.isSet( debugLevelOption ) )
{
bool ok = true;
int l = parser.value( debugLevelOption ).toInt( &ok );
unsigned int l = parser.value( debugLevelOption ).toUInt( &ok );
unsigned int dlevel = 0;
if ( !ok || ( l < 0 ) )
if ( !ok )
dlevel = Logger::LOGVERBOSE;
else
dlevel = l;
@ -94,20 +94,20 @@ handle_args( QCoreApplication& a )
{
cError() << "Missing <module> path.\n";
parser.showHelp();
return ModuleConfig(); // NOTREACHED
}
if ( args.size() > 2 )
else if ( args.size() > 2 )
{
cError() << "More than one <module> path.\n";
parser.showHelp();
return ModuleConfig(); // NOTREACHED
}
else
{
QString jobSettings( parser.value( jobOption ) );
if ( jobSettings.isEmpty() && ( args.size() == 2 ) )
jobSettings = args.at(1);
QString jobSettings( parser.value( jobOption ) );
if ( jobSettings.isEmpty() && ( args.size() == 2 ) )
jobSettings = args.at(1);
return ModuleConfig{ args.first(), jobSettings, parser.value( globalOption ), parser.value( langOption ) };
return ModuleConfig{ args.first(), jobSettings, parser.value( globalOption ), parser.value( langOption ) };
}
}
@ -207,7 +207,7 @@ main( int argc, char* argv[] )
return 1;
}
using TR = Logger::DebugRow<const char*, const QString&>;
using TR = Logger::DebugRow<const char*, const QString>;
cDebug() << "Module metadata"
<< TR( "name", m->name() )
@ -223,7 +223,6 @@ main( int argc, char* argv[] )
Calamares::JobResult r = p->exec();
if ( !r )
{
using TR = Logger::DebugRow<QString, QString>;
cDebug() << count << ".. failed"
<< TR( "summary", r.message() )
<< TR( "details", r.details() );