Skip to content
Permalink
Browse files

Remove -Wswitch-enum compiler option.

The -Wswitch option included in -Wall provides the same level of coverage and allows enum options to be grouped into default.
  • Loading branch information...
dwsteele committed May 15, 2019
1 parent 53f6232 commit 5bba72b87445f3edd2c7a2e636ffcb46cac5d9dd
Showing with 15 additions and 24 deletions.
  1. +4 −0 doc/xml/release.xml
  2. +8 −21 src/common/type/variant.c
  3. +1 −1 src/configure
  4. +1 −1 src/configure.ac
  5. +1 −1 test/lib/pgBackRestTest/Common/JobTest.pm
@@ -163,6 +163,10 @@
<p>Improve coverage in <file>perl/exec</file>, <file>config/config</file>, and <file>config/parse</file> modules.</p>
</release-item>

<release-item>
<p>Remove <id>-Wswitch-enum</id> compiler option.</p>
</release-item>

<release-item>
<p>Error on multiple option alternate names and simplify help command.</p>
</release-item>
@@ -256,8 +256,7 @@ varEq(const Variant *this1, const Variant *this2)
break;
}

case varTypeKeyValue:
case varTypeVariantList:
default:
THROW_FMT(AssertError, "unable to test equality for %s", variantTypeName[this1->type]);
}
}
@@ -382,9 +381,7 @@ varBoolForce(const Variant *this)
result = varUInt64(this) != 0;
break;

case varTypeDouble:
case varTypeKeyValue:
case varTypeVariantList:
default:
THROW_FMT(AssertError, "unable to force %s to %s", variantTypeName[this->type], variantTypeName[varTypeBool]);
}

@@ -484,8 +481,7 @@ varDblForce(const Variant *this)
break;
}

case varTypeKeyValue:
case varTypeVariantList:
default:
THROW_FMT(AssertError, "unable to force %s to %s", variantTypeName[this->type], variantTypeName[varTypeDouble]);
}

@@ -603,9 +599,7 @@ varIntForce(const Variant *this)
break;
}

case varTypeDouble:
case varTypeKeyValue:
case varTypeVariantList:
default:
THROW_FMT(AssertError, "unable to force %s to %s", variantTypeName[this->type], variantTypeName[varTypeInt]);
}

@@ -711,9 +705,7 @@ varInt64Force(const Variant *this)
break;
}

case varTypeDouble:
case varTypeKeyValue:
case varTypeVariantList:
default:
THROW_FMT(AssertError, "unable to force %s to %s", variantTypeName[this->type], variantTypeName[varTypeInt64]);
}

@@ -840,9 +832,7 @@ varUIntForce(const Variant *this)
break;
}

case varTypeDouble:
case varTypeKeyValue:
case varTypeVariantList:
default:
THROW_FMT(AssertError, "unable to force %s to %s", variantTypeName[this->type], variantTypeName[varTypeUInt]);
}

@@ -958,9 +948,7 @@ varUInt64Force(const Variant *this)
break;
}

case varTypeDouble:
case varTypeKeyValue:
case varTypeVariantList:
default:
THROW_FMT(AssertError, "unable to force %s to %s", variantTypeName[this->type], variantTypeName[varTypeUInt64]);
}

@@ -1137,8 +1125,7 @@ varStrForce(const Variant *this)
break;
}

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

@@ -2799,7 +2799,7 @@ fi
CWARNING=$warning

else
CWARNING="$warning -Wwrite-strings -Wswitch-enum -Wconversion -Wformat=2 -Wformat-nonliteral -Wstrict-prototypes -Wpointer-arith -Wvla"
CWARNING="$warning -Wwrite-strings -Wconversion -Wformat=2 -Wformat-nonliteral -Wstrict-prototypes -Wpointer-arith -Wvla"

fi

@@ -27,7 +27,7 @@ then

AC_SUBST(CWARNING, $warning)
else
AC_SUBST(CWARNING, "$warning -Wwrite-strings -Wswitch-enum -Wconversion -Wformat=2 -Wformat-nonliteral -Wstrict-prototypes -Wpointer-arith -Wvla")
AC_SUBST(CWARNING, "$warning -Wwrite-strings -Wconversion -Wformat=2 -Wformat-nonliteral -Wstrict-prototypes -Wpointer-arith -Wvla")
fi

# Set includes
@@ -393,7 +393,7 @@ sub run

# Determine which warnings are available
my $strWarningFlags =
'-Werror -Wfatal-errors -Wall -Wextra -Wwrite-strings -Wswitch-enum -Wconversion -Wformat=2' .
'-Werror -Wfatal-errors -Wall -Wextra -Wwrite-strings -Wconversion -Wformat=2' .
' -Wformat-nonliteral -Wstrict-prototypes -Wpointer-arith -Wvla' .
($self->{oTest}->{&TEST_VM} eq VM_U16 || $self->{oTest}->{&TEST_VM} eq VM_U18 ?
' -Wformat-signedness' : '') .

0 comments on commit 5bba72b

Please sign in to comment.
You can’t perform that action at this time.