pgbackrest.git / summary / log / commit / refs

commit    5bba72b87445f3edd2c7a2e636ffcb46cac5d9dd
Author:   David Steele <david@crunchydata.com>
Date:     Wed May 15 16:55:08 2019 +0000

    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.


doc/xml/release.xml | 4 ++++ src/common/type/variant.c | 29 ++++++++--------------------- src/configure | 2 +- src/configure.ac | 2 +- test/lib/pgBackRestTest/Common/JobTest.pm | 2 +- 5 files changed, 15 insertions(+), 24 deletions(-) diff --git a/doc/xml/release.xml b/doc/xml/release.xml index 05cdc0ad5..971d1f2e7 100644 --- a/doc/xml/release.xml +++ b/doc/xml/release.xml @@ -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> diff --git a/src/common/type/variant.c b/src/common/type/variant.c index 02745bd3a..c3e0b6b27 100644 --- a/src/common/type/variant.c +++ b/src/common/type/variant.c @@ -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]); } diff --git a/src/configure b/src/configure index 484dfa7ba..bb79d4c9a 100755 --- a/src/configure +++ b/src/configure @@ -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 diff --git a/src/configure.ac b/src/configure.ac index 9f1181196..c9f096134 100644 --- a/src/configure.ac +++ b/src/configure.ac @@ -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 diff --git a/test/lib/pgBackRestTest/Common/JobTest.pm b/test/lib/pgBackRestTest/Common/JobTest.pm index 66ecace09..95793facb 100644 --- a/test/lib/pgBackRestTest/Common/JobTest.pm +++ b/test/lib/pgBackRestTest/Common/JobTest.pm @@ -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' : '') . [parent: 53f6232264f2]