Commit 1cb71b92 authored by Kenton Varda's avatar Kenton Varda

Enable more warnings and -Werror in test script, fix problems.

parent 59e840bd
......@@ -269,13 +269,14 @@ constexpr WordCount WORDS = kj::unit<WordCount>();
constexpr ElementCount ELEMENTS = kj::unit<ElementCount>();
constexpr WirePointerCount POINTERS = kj::unit<WirePointerCount>();
constexpr auto BITS_PER_BYTE = 8 * BITS / BYTES;
constexpr auto BITS_PER_WORD = 64 * BITS / WORDS;
constexpr auto BYTES_PER_WORD = 8 * BYTES / WORDS;
constexpr auto BITS_PER_POINTER = 64 * BITS / POINTERS;
constexpr auto BYTES_PER_POINTER = 8 * BYTES / POINTERS;
constexpr auto WORDS_PER_POINTER = 1 * WORDS / POINTERS;
// GCC 4.7 actually gives unused warnings on these constants in opt mode...
constexpr auto BITS_PER_BYTE KJ_UNUSED = 8 * BITS / BYTES;
constexpr auto BITS_PER_WORD KJ_UNUSED = 64 * BITS / WORDS;
constexpr auto BYTES_PER_WORD KJ_UNUSED = 8 * BYTES / WORDS;
constexpr auto BITS_PER_POINTER KJ_UNUSED = 64 * BITS / POINTERS;
constexpr auto BYTES_PER_POINTER KJ_UNUSED = 8 * BYTES / POINTERS;
constexpr auto WORDS_PER_POINTER KJ_UNUSED = 1 * WORDS / POINTERS;
constexpr WordCount POINTER_SIZE_IN_WORDS = 1 * POINTERS * WORDS_PER_POINTER;
......
......@@ -599,7 +599,7 @@ private:
auto nonGroup = proto.getNonGroup();
FieldKind kind;
FieldKind kind = FieldKind::PRIMITIVE;
kj::String ownedType;
kj::String type = typeName(nonGroup.getType()).flatten();
kj::StringPtr setterDefault; // only for void
......
......@@ -312,8 +312,8 @@ private:
case schema::Field::NON_GROUP: {
auto nonGroup = field.getNonGroup();
uint fieldBits;
bool fieldIsPointer;
uint fieldBits = 0;
bool fieldIsPointer = false;
validate(nonGroup.getType(), nonGroup.getDefaultValue(),
&fieldBits, &fieldIsPointer);
VALIDATE_SCHEMA(fieldBits * (nonGroup.getOffset() + 1) <= dataSizeInBits &&
......
......@@ -39,8 +39,8 @@ TEST(StringTree, StrTree) {
EXPECT_EQ("foobarbaz", tree.flatten());
uint pieceCount = 0;
tree.visit([&](ArrayPtr<const char> part) { ++pieceCount; EXPECT_EQ(3, part.size()); });
EXPECT_EQ(3, pieceCount);
tree.visit([&](ArrayPtr<const char> part) { ++pieceCount; EXPECT_EQ(3u, part.size()); });
EXPECT_EQ(3u, pieceCount);
}
EXPECT_EQ("<foobarbaz>", str('<', strTree(str("foo"), "bar", str("baz")), '>'));
......
......@@ -152,8 +152,9 @@ __EOF__
done
# Build optimized builds because they catch more problems, but also enable debugging macros.
# Enable lots of warnings and make sure the build breaks if they fire.
export CXXFLAGS="-O2 -DDEBUG -Wall -Werror"
# Enable lots of warnings and make sure the build breaks if they fire. Disable strict-aliasing
# because GCC warns about code that I know is OK.
export CXXFLAGS="-O2 -DDEBUG -Wall -Werror -Wno-strict-aliasing"
STAGING=$PWD/tmp-staging
......@@ -185,6 +186,13 @@ else
SAMPLE_CXXFLAGS=
fi
case ${CXX:-g++} in
*clang* )
# There's an unused private field in gtest.
export CXXFLAGS="$CXXFLAGS -Wno-unused-private-field"
;;
esac
cd c++
doit ./setup-autotools.sh | tr = -
doit autoreconf -i
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment