Skip to content

Commit

Permalink
Silence switch-default error in docopt_value.h
Browse files Browse the repository at this point in the history
When a project using docopt.cpp is built with `-Werror=switch-default`
option, there's an error
```
error: switch missing default case [-Werror=switch-default]
```
which this fixes.

Signed-off-by: Eero Aaltonen <[email protected]>
  • Loading branch information
eaaltonen committed Apr 9, 2024
1 parent 400e6dd commit af11f9a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion docopt_value.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ namespace docopt {
std::string strValue;
std::vector<std::string> strList;
};


#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wswitch-default"
static const char* kindAsString(Kind kind) {
switch (kind) {
case Kind::Empty: return "empty";
Expand All @@ -88,6 +90,7 @@ namespace docopt {
}
return "unknown";
}
#pragma GCC diagnostic pop

void throwIfNotKind(Kind expected) const {
if (kind_ == expected)
Expand Down

0 comments on commit af11f9a

Please sign in to comment.