Add explicit case statements where -Wswitch-enum would report them

This commit is contained in:
Robert Hensing 2023-04-03 18:03:20 +02:00
parent ed7885017c
commit 3dac4c7874
5 changed files with 7 additions and 2 deletions

View file

@ -1024,6 +1024,8 @@ std::ostream & NixRepl::printValue(std::ostream & str, Value & v, unsigned int m
str << v.fpoint;
break;
case nThunk:
case nExternal:
default:
str << ANSI_RED "«unknown»" ANSI_NORMAL;
break;

View file

@ -2337,6 +2337,7 @@ bool EvalState::eqValues(Value & v1, Value & v2, const PosIdx pos, std::string_v
case nFloat:
return v1.fpoint == v2.fpoint;
case nThunk: // Must not be left by forceValue
default:
error("cannot compare %1% with %2%", showType(v1), showType(v2)).withTrace(pos, errorCtx).debugThrow<EvalError>();
}

View file

@ -275,6 +275,7 @@ json listNar(ref<FSAccessor> accessor, const Path & path, bool recurse)
obj["type"] = "symlink";
obj["target"] = accessor->readLink(path);
break;
case FSAccessor::Type::tMissing:
default:
throw Error("path '%s' does not exist in NAR", path);
}

View file

@ -67,7 +67,8 @@ public:
case lvlWarn: c = '4'; break;
case lvlNotice: case lvlInfo: c = '5'; break;
case lvlTalkative: case lvlChatty: c = '6'; break;
default: c = '7';
case lvlDebug: case lvlVomit: c = '7';
default: c = '7'; break;
}
prefix = std::string("<") + c + ">";
}

View file

@ -443,7 +443,7 @@ static void opQuery(Strings opFlags, Strings opArgs)
break;
}
default:
default: case qDefault:
abort();
}
}