Skip to content

Commit

Permalink
Enable -Wswitch-enum and silence new warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
dwsteele committed Feb 26, 2018
1 parent c8df690 commit f9c1a3b
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 4 deletions.
4 changes: 4 additions & 0 deletions doc/xml/release.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@

<p>Fix incorrect enum types in <file>config.c</file> that throw warnings under clang.</p>
</release-item>

<release-item>
<p>Enable <id>-Wswitch-enum</id> and silence new warnings.</p>
</release-item>
</release-development-list>
</release-core-list>
</release>
Expand Down
2 changes: 1 addition & 1 deletion src/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ COPT = -O2
CINCLUDE = -I.

# Compile warnings
CWARN = -Wfatal-errors -Wall -Wextra -Wwrite-strings -Wno-clobbered
CWARN = -Wfatal-errors -Wall -Wextra -Wwrite-strings -Wno-clobbered -Wswitch-enum

# Automatically generate Perl compile options for the local system
CPERL = `perl -MExtUtils::Embed -e ccopts`
Expand Down
6 changes: 4 additions & 2 deletions src/common/type/variant.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,8 @@ varEq(const Variant *this1, const Variant *this2)
break;
}

default:
case varTypeKeyValue:
case varTypeVariantList:
THROW(AssertError, "unable to test equality for %s", variantTypeName[this1->type]);
}
}
Expand Down Expand Up @@ -634,7 +635,8 @@ varStrForce(const Variant *this)
break;
}

default:
case varTypeKeyValue:
case varTypeVariantList:
THROW(FormatError, "unable to force %s to %s", variantTypeName[this->type], variantTypeName[varTypeString]);
}

Expand Down
5 changes: 4 additions & 1 deletion src/config/parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,10 @@ configParse(int argListSize, const char *argList[])
}

// Other types are output plain
default:
case cfgDefOptTypeFloat:
case cfgDefOptTypeHash:
case cfgDefOptTypeInteger:
case cfgDefOptTypeList:
{
strLstAddZ(dependValueList, dependValue); // {uncovered - no depends of other types}
break; // {+uncovered}
Expand Down

0 comments on commit f9c1a3b

Please sign in to comment.