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