aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Hensing <robert@roberthensing.nl>2023-04-03 18:03:20 +0200
committerRobert Hensing <robert@roberthensing.nl>2023-04-03 18:17:32 +0200
commit3dac4c7874b876dc28d522aa4eddd8b4deb64378 (patch)
tree6d12fc14e4e6cf245d55920f712c1a19a031d878
parented7885017c25940f571dc58e94ca47fa84780f9d (diff)
Add explicit case statements where -Wswitch-enum would report them
-rw-r--r--src/libcmd/repl.cc2
-rw-r--r--src/libexpr/eval.cc1
-rw-r--r--src/libstore/nar-accessor.cc1
-rw-r--r--src/libutil/logging.cc3
-rw-r--r--src/nix-store/nix-store.cc2
5 files changed, 7 insertions, 2 deletions
diff --git a/src/libcmd/repl.cc b/src/libcmd/repl.cc
index e3afb1531..e75ac2cf4 100644
--- a/src/libcmd/repl.cc
+++ b/src/libcmd/repl.cc
@@ -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;
diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc
index 22337a3ff..a5e9636ae 100644
--- a/src/libexpr/eval.cc
+++ b/src/libexpr/eval.cc
@@ -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>();
}
diff --git a/src/libstore/nar-accessor.cc b/src/libstore/nar-accessor.cc
index 9a0003588..f0dfcb19b 100644
--- a/src/libstore/nar-accessor.cc
+++ b/src/libstore/nar-accessor.cc
@@ -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);
}
diff --git a/src/libutil/logging.cc b/src/libutil/logging.cc
index 28b385461..741e1d1f5 100644
--- a/src/libutil/logging.cc
+++ b/src/libutil/logging.cc
@@ -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 + ">";
}
diff --git a/src/nix-store/nix-store.cc b/src/nix-store/nix-store.cc
index a62cb874f..2d784376d 100644
--- a/src/nix-store/nix-store.cc
+++ b/src/nix-store/nix-store.cc
@@ -443,7 +443,7 @@ static void opQuery(Strings opFlags, Strings opArgs)
break;
}
- default:
+ default: case qDefault:
abort();
}
}