[libcalamares] Warnings-- on switch()

- some switch statements handle a bunch of items explicitly,
  then default the rest. Clang complains about that. Turn off
  the warning for these specific switches, since there's dozens
  of values that simply do not need to be handled.
This commit is contained in:
Adriaan de Groot 2021-12-07 15:42:14 +01:00
parent 6e715205d7
commit 4611545f93
2 changed files with 24 additions and 0 deletions

View File

@ -26,6 +26,11 @@ namespace CalamaresPython
boost::python::object
variantToPyObject( const QVariant& variant )
{
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wswitch-enum"
#endif
// 49 enumeration values not handled
switch ( variant.type() )
{
case QVariant::Map:
@ -62,6 +67,9 @@ variantToPyObject( const QVariant& variant )
default:
return bp::object();
}
#ifdef __clang__
#pragma clang diagnostic pop
#endif
}

View File

@ -22,6 +22,11 @@ namespace Partition
QString
prettyNameForFileSystemType( FileSystem::Type t )
{
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wswitch-enum"
#endif
// 13 enumeration values not handled
switch ( t )
{
case FileSystem::Unknown:
@ -60,11 +65,19 @@ prettyNameForFileSystemType( FileSystem::Type t )
default:
return FileSystem::nameForType( t );
}
#ifdef __clang__
#pragma clang diagnostic pop
#endif
}
QString
untranslatedFS( FileSystem::Type t )
{
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wswitch-enum"
#endif
// 34 enumeration values not handled
switch ( t )
{
case FileSystem::Type::ReiserFS:
@ -72,6 +85,9 @@ untranslatedFS( FileSystem::Type t )
default:
return FileSystem::nameForType( t, { QStringLiteral( "C" ) } );
}
#ifdef __clang__
#pragma clang diagnostic pop
#endif
}
} // namespace Partition