build: update for gcc-8.1 warnings

This commit is contained in:
Danny Robson 2018-05-03 18:32:08 +10:00
parent c0af2df2c8
commit 497d3ca970
26 changed files with 189 additions and 119 deletions

View File

@ -338,7 +338,7 @@ list (
polynomial.hpp polynomial.hpp
pool.cpp pool.cpp
pool.hpp pool.hpp
preprocessor.hpp "${CMAKE_CURRENT_SOURCE_DIR}/preprocessor.hpp"
quaternion.cpp quaternion.cpp
quaternion.hpp quaternion.hpp
raii.hpp raii.hpp

View File

@ -19,6 +19,7 @@
#define CRUFT_UTIL_ALGO_SORT_HPP #define CRUFT_UTIL_ALGO_SORT_HPP
#include "../debug.hpp" #include "../debug.hpp"
#include "../cast.hpp"
#include <iterator> #include <iterator>
#include <algorithm> #include <algorithm>
@ -88,7 +89,7 @@ namespace cruft::util::sort {
CHECK_LT (*std::max_element (idx_first, idx_last), size); CHECK_LT (*std::max_element (idx_first, idx_last), size);
for (decltype(size) i = 0; i < size - 1; ++i) { for (decltype(size) i = 0; i < size - 1; ++i) {
while (i != (decltype(size))idx_first[i]) { while (i != decltype(size){idx_first[i]}) {
auto j = idx_first[i]; auto j = idx_first[i];
detail::index_swap (i, j, value, tail..., idx_first); detail::index_swap (i, j, value, tail..., idx_first);
@ -125,7 +126,8 @@ namespace cruft::util::sort {
std::vector<decltype(size)> indices (size); std::vector<decltype(size)> indices (size);
std::iota (std::begin (indices), std::end (indices), 0); std::iota (std::begin (indices), std::end (indices), 0);
std::sort (std::begin (indices), std::sort (
std::begin (indices),
std::end (indices), std::end (indices),
[&] (const auto &cruft_util_sort_soa_a, const auto &cruft_util_sort_soa_b) [&] (const auto &cruft_util_sort_soa_a, const auto &cruft_util_sort_soa_b)
{ {
@ -138,14 +140,15 @@ namespace cruft::util::sort {
key_first[cruft_util_sort_soa_a], key_first[cruft_util_sort_soa_a],
key_first[cruft_util_sort_soa_b] key_first[cruft_util_sort_soa_b]
); );
}); }
);
// convert from a sorted list of pointers to a mapping of pointers to // convert from a sorted list of pointers to a mapping of pointers to
// desired final offsets. this is done so we can palm it off to the // desired final offsets. this is done so we can palm it off to the
// reorder function. // reorder function.
// TODO: avoid the need for this inverse array. // TODO: avoid the need for this inverse array.
decltype (indices) dest (indices.size ()); decltype (indices) dest (indices.size ());
for (decltype(size) i = 0; i < (decltype(size))dest.size (); ++i) { for (decltype(size) i = 0; i < ::util::cast::sign<ssize_t> (dest.size ()); ++i) {
dest[indices[i]] = i; dest[indices[i]] = i;
} }

View File

@ -61,8 +61,8 @@ null::deallocate (void *ptr, size_t bytes, size_t align)
(void)bytes; (void)bytes;
(void)align; (void)align;
// cast to void* to assist some of the printing machinary in the assertion // cast to void* to assist some of the printing machinery in the assertion
CHECK_EQ (ptr, (void*)nullptr); CHECK_EQ (ptr, static_cast<const void*> (nullptr));
} }

View File

@ -1332,6 +1332,33 @@ namespace util {
} }
template <
size_t S,
typename T,
typename K,
typename = std::enable_if_t<
is_coord_v<K> && !is_coord_v<T>
>
>
constexpr auto
select (vector<S,bool> s, K a, T b)
{
return select (s, a, K {b});
}
template <
size_t S,
typename T,
typename = std::enable_if_t<!is_coord_v<T>>
>
constexpr auto
select (vector<S,bool> s, T a, T b)
{
return select (s, vector<S,T> {a}, vector<S,T> {b});
}
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// return the componentwise floor of the coordinate type // return the componentwise floor of the coordinate type
// //

View File

@ -19,6 +19,7 @@
#include "types/bits.hpp" #include "types/bits.hpp"
#include <cstring>
#include <cstdint> #include <cstdint>
#include <type_traits> #include <type_traits>
@ -90,6 +91,41 @@ namespace util {
} }
template <
typename T,
typename = std::enable_if_t<
std::is_integral_v<T>
>
>
T readle (const void *_data)
{
auto data = reinterpret_cast<const uint8_t*> (_data);
T value = 0;
for (size_t i = 0; i < sizeof (value); ++i)
value |= T{data[i]} << (i * 8);
return value;
}
/// read bytes from a supplied data pointer and return an integer using
/// host endian layout.
template <
typename T,
typename = std::enable_if_t<
std::is_integral_v<T>
>
>
T readhe (const std::uint8_t *data)
{
std::aligned_union_t <sizeof (T), T> buffer;
memcpy (reinterpret_cast<char *> (&buffer), data, sizeof (T));
return *reinterpret_cast<const T*> (&buffer);
}
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
#if defined(WORDS_BIGENDIAN) #if defined(WORDS_BIGENDIAN)
template <typename T> constexpr T hton (T v) { return v; } template <typename T> constexpr T hton (T v) { return v; }

View File

@ -18,6 +18,10 @@
#include <iostream> #include <iostream>
// We generate some really old style C code via ragel here, so we have to
// disable some noisy warnings (doubly so given -Werror)
#pragma GCC diagnostic ignored "-Wold-style-cast"
namespace util::format { namespace util::format {
std::ostream& std::ostream&
operator<< (std::ostream &os, type_t val) operator<< (std::ostream &os, type_t val)

View File

@ -16,6 +16,9 @@
#include "fasthash.hpp" #include "fasthash.hpp"
#include "../endian.hpp"
#include "../debug.hpp"
using util::hash::fasthash; using util::hash::fasthash;
@ -28,20 +31,17 @@ fasthash<uint64_t>::operator() (uint64_t seed, const util::view<const uint8_t*>
uint64_t result = seed ^ (data.size () * m); uint64_t result = seed ^ (data.size () * m);
auto cursor = reinterpret_cast<const uint64_t*> (data.begin ()); auto cursor = data.begin ();
auto last = cursor + data.size () / sizeof (*cursor); for (auto last = data.end () - data.size () % 8; cursor < last; cursor += 8) {
for (; cursor < last; ++cursor) { result ^= mix (readle<uint64_t> (cursor));
result ^= mix (*cursor);
result *= m; result *= m;
} }
size_t remain = data.size () % sizeof (*cursor); size_t remain = data.size () % 8;
if (remain) { if (remain) {
auto tail = reinterpret_cast<const uint8_t*> (cursor);
uint64_t accum = 0; uint64_t accum = 0;
for (size_t i = 0; i < remain; ++i) for (size_t i = 0; i < remain; ++i)
accum ^= uint64_t {tail[i]} << i * 8; accum ^= uint64_t {cursor[i]} << i * 8;
result ^= mix (accum); result ^= mix (accum);
result *= m; result *= m;

View File

@ -114,22 +114,22 @@ namespace util::hash::murmur {
switch(len & 15) switch(len & 15)
{ {
case 15: result[1] |= ((uint64_t)bytes[14]) << 48; case 15: result[1] |= uint64_t{bytes[14]} << 48;
case 14: result[1] |= ((uint64_t)bytes[13]) << 40; case 14: result[1] |= uint64_t{bytes[13]} << 40;
case 13: result[1] |= ((uint64_t)bytes[12]) << 32; case 13: result[1] |= uint64_t{bytes[12]} << 32;
case 12: result[1] |= ((uint64_t)bytes[11]) << 24; case 12: result[1] |= uint64_t{bytes[11]} << 24;
case 11: result[1] |= ((uint64_t)bytes[10]) << 16; case 11: result[1] |= uint64_t{bytes[10]} << 16;
case 10: result[1] |= ((uint64_t)bytes[ 9]) << 8; case 10: result[1] |= uint64_t{bytes[ 9]} << 8;
case 9: result[1] |= ((uint64_t)bytes[ 8]) << 0; case 9: result[1] |= uint64_t{bytes[ 8]} << 0;
case 8: result[0] |= ((uint64_t)bytes[ 7]) << 56; case 8: result[0] |= uint64_t{bytes[ 7]} << 56;
case 7: result[0] |= ((uint64_t)bytes[ 6]) << 48; case 7: result[0] |= uint64_t{bytes[ 6]} << 48;
case 6: result[0] |= ((uint64_t)bytes[ 5]) << 40; case 6: result[0] |= uint64_t{bytes[ 5]} << 40;
case 5: result[0] |= ((uint64_t)bytes[ 4]) << 32; case 5: result[0] |= uint64_t{bytes[ 4]} << 32;
case 4: result[0] |= ((uint64_t)bytes[ 3]) << 24; case 4: result[0] |= uint64_t{bytes[ 3]} << 24;
case 3: result[0] |= ((uint64_t)bytes[ 2]) << 16; case 3: result[0] |= uint64_t{bytes[ 2]} << 16;
case 2: result[0] |= ((uint64_t)bytes[ 1]) << 8; case 2: result[0] |= uint64_t{bytes[ 1]} << 8;
case 1: result[0] |= ((uint64_t)bytes[ 0]) << 0; case 1: result[0] |= uint64_t{bytes[ 0]} << 0;
break; break;
default: default:

View File

@ -18,6 +18,7 @@
#include "common.hpp" #include "common.hpp"
#include "../../debug.hpp" #include "../../debug.hpp"
#include "../../endian.hpp"
using util::hash::murmur1; using util::hash::murmur1;
@ -30,14 +31,13 @@ murmur1::operator() (util::view<const uint8_t*> data) const noexcept
uint32_t h = m_seed ^ ((data.size () & 0xffffffff) * m); uint32_t h = m_seed ^ ((data.size () & 0xffffffff) * m);
// mix the body // mix the body
auto cursor = reinterpret_cast<const uint32_t*> (data.data ()); auto cursor = data.begin ();
auto last = cursor + data.size () / sizeof (uint32_t); for (auto last = data.end () - data.size () % sizeof (uint32_t); cursor < last; cursor += 4)
for (; cursor < last; ++cursor) h = mix (h, util::readhe<uint32_t> (cursor));
h = mix (h, *cursor);
// mix the tail // mix the tail
if (data.size () % sizeof (uint32_t)) if (data.size () % sizeof (uint32_t))
h = mix (h, murmur::tail<uint32_t> (reinterpret_cast<const uint8_t*> (cursor), data.size ())); h = mix (h, murmur::tail<uint32_t> (cursor, data.size ()));
// finalise // finalise
h *= m; h ^= h >> 10; h *= m; h ^= h >> 10;

View File

@ -51,15 +51,6 @@ round (uint64_t v[4])
} }
///////////////////////////////////////////////////////////////////////////////
template <typename ValueT>
ValueT
readle (const void *ptr)
{
return util::htol (*reinterpret_cast<const ValueT*> (ptr));
}
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
template <int C, int D> template <int C, int D>
siphash<C,D>::siphash (std::array<uint64_t,2> _key) noexcept: siphash<C,D>::siphash (std::array<uint64_t,2> _key) noexcept:

6
io.cpp
View File

@ -53,7 +53,7 @@ util::slurp (const std::experimental::filesystem::path &path)
std::vector<T> buffer (size); std::vector<T> buffer (size);
CHECK_GE (size, 0); CHECK_GE (size, 0);
size_t remaining = (size_t)size; size_t remaining = util::cast::sign<size_t> (size);
T *cursor = buffer.data (); T *cursor = buffer.data ();
while (remaining) { while (remaining) {
@ -62,9 +62,9 @@ util::slurp (const std::experimental::filesystem::path &path)
); );
CHECK_GT (consumed, 0); CHECK_GT (consumed, 0);
CHECK_LE ((size_t)consumed, remaining); CHECK_LE (util::cast::sign<size_t> (consumed), remaining);
remaining -= (size_t)consumed; remaining -= util::cast::sign<size_t> (consumed);
cursor += consumed; cursor += consumed;
} }

View File

@ -41,7 +41,7 @@ mapped_file::mapped_file (const ::util::posix::fd &src, int mflags)
::util::posix::error::try_value (fstat (src, &meta)); ::util::posix::error::try_value (fstat (src, &meta));
m_size = util::cast::sign<size_t> (meta.st_size); m_size = util::cast::sign<size_t> (meta.st_size);
m_data = (uint8_t *)mmap (NULL, m_size, mflags, MAP_SHARED, src, 0); m_data = static_cast<uint8_t*> (mmap (nullptr, m_size, mflags, MAP_SHARED, src, 0));
if (m_data == MAP_FAILED) if (m_data == MAP_FAILED)
::util::posix::error::throw_code (); ::util::posix::error::throw_code ();
} }

View File

@ -179,7 +179,7 @@ namespace util::job {
// GCC: switch to hardware_destructive_interference_size when it // GCC: switch to hardware_destructive_interference_size when it
// becomes available in libstdc++. Until then we use a sensible // becomes available in libstdc++. Until then we use a sensible
// guess. // guess.
std::array<char,64> data; std::aligned_storage_t<64,alignof(std::max_align_t)> data;
std::function<void(task&)> function; std::function<void(task&)> function;
thread::semaphore references = 0; thread::semaphore references = 0;

View File

@ -26,7 +26,12 @@
#include <deque> #include <deque>
#include <iostream> #include <iostream>
//----------------------------------------------------------------------------- // We generate some really old style C code via ragel here, so we have to
// disable some noisy warnings (doubly so given -Werror)
#pragma GCC diagnostic ignored "-Wold-style-cast"
///////////////////////////////////////////////////////////////////////////////
%%{ %%{
# JSON (rfc7159) # JSON (rfc7159)
machine json; machine json;

View File

@ -535,6 +535,6 @@ json::schema::validate (json::tree::node &data,
const std::experimental::filesystem::path &schema_path) const std::experimental::filesystem::path &schema_path)
{ {
const util::mapped_file schema_data (schema_path); const util::mapped_file schema_data (schema_path);
auto schema_object = json::tree::parse (util::view{schema_data}.cast<const char> ()); auto schema_object = json::tree::parse (util::view(schema_data).cast<const char> ());
validate (data, schema_object->as_object ()); validate (data, schema_object->as_object ());
} }

View File

@ -294,15 +294,14 @@ namespace util {
///---------------------------------------------------------------------------- ///----------------------------------------------------------------------------
/// round T up to the nearest power-of-2 /// round T up to the nearest power-of-2
template <typename T> template <
constexpr typename T,
std::enable_if_t< typename = std::enable_if_t<std::is_integral_v<T>>
std::is_integral<T>::value, T
> >
constexpr
auto
round_pow2 (T value) round_pow2 (T value)
{ {
using return_type = std::enable_if_t<std::is_integral<T>::value, T>;
--value; --value;
for (unsigned i = 1; i < sizeof (T) * 8; i <<= 1) { for (unsigned i = 1; i < sizeof (T) * 8; i <<= 1) {
@ -310,7 +309,7 @@ namespace util {
} }
++value; ++value;
return (return_type)value; return value;
} }

View File

@ -20,6 +20,7 @@
#include "debug.hpp" #include "debug.hpp"
#include "json/tree.hpp" #include "json/tree.hpp"
#include "maths.hpp" #include "maths.hpp"
#include "random.hpp"
#include <cmath> #include <cmath>
#include <cstdint> #include <cstdint>
@ -123,31 +124,15 @@ util::range<T>::operator- (T val) const
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
namespace util {
template <>
double
range<double>::random (void) const
{
double pos = ::rand () / (double)(RAND_MAX);
return (hi - lo) * pos + lo;
}
template <>
float
range<float>::random (void) const
{
float pos = ::rand () / (float)(RAND_MAX);
return (hi - lo) * pos + lo;
}
}
//-----------------------------------------------------------------------------
template <typename T> template <typename T>
T T
util::range<T>::random (void) const util::range<T>::random (void) const
{ {
return lo + (T)::rand () % (hi - lo); if constexpr (std::is_floating_point_v<T>) {
return std::uniform_real_distribution<T> (lo, hi) (util::random::generator ());
} else {
return std::uniform_int_distribution<T> (lo, hi) (util::random::generator ());
}
} }

View File

@ -6,7 +6,7 @@
void void
reorder (std::vector<int> &values, std::vector<int> &indices) reorder (std::vector<size_t> &values, std::vector<size_t> &indices)
{ {
CHECK_EQ (values.size (), indices.size ()); CHECK_EQ (values.size (), indices.size ());
if (indices.size () <= 1) if (indices.size () <= 1)
@ -14,7 +14,7 @@ reorder (std::vector<int> &values, std::vector<int> &indices)
for (size_t i = 0; i < indices.size () - 1; ++i) { for (size_t i = 0; i < indices.size () - 1; ++i) {
// check if this item is in the correct slot // check if this item is in the correct slot
while ((int)i != indices[i]) { while (i != indices[i]) {
auto alt = indices[i]; auto alt = indices[i];
// swap this item with the one that's occupying its intended slot // swap this item with the one that's occupying its intended slot

View File

@ -29,10 +29,10 @@ main (int, char**)
// alignment to produce a likely system alignment. eg, 3 + 5 == 8 which is // alignment to produce a likely system alignment. eg, 3 + 5 == 8 which is
// a power-of-2. // a power-of-2.
uintptr_t result[4] = { uintptr_t result[4] = {
(uintptr_t)alloc.allocate (9), // just over a power of two reinterpret_cast<uintptr_t>(alloc.allocate (9)), // just over a power of two
(uintptr_t)alloc.allocate (1), // a single byte reinterpret_cast<uintptr_t>(alloc.allocate (1)), // a single byte
(uintptr_t)alloc.allocate (64), // a cache line reinterpret_cast<uintptr_t>(alloc.allocate (64)), // a cache line
(uintptr_t)alloc.allocate (250) // multiple cache lines, but not a power of two reinterpret_cast<uintptr_t>(alloc.allocate (250)) // multiple cache lines, but not a power of two
}; };
tap.expect ( tap.expect (

View File

@ -45,8 +45,8 @@ main ()
}; };
for (const auto &t: TESTS) { for (const auto &t: TESTS) {
auto ptr = (uintptr_t)alloc.allocate (t.size); auto ptr = reinterpret_cast<uintptr_t> (alloc.allocate (t.size));
auto offset = ptr - (uintptr_t)base; auto offset = ptr - reinterpret_cast<uintptr_t> (base);
tap.expect_mod (offset, alignment, "%s", t.message); tap.expect_mod (offset, alignment, "%s", t.message);
} }

View File

@ -2,6 +2,8 @@
#include "endian.hpp" #include "endian.hpp"
#include <cstdint>
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
int int
@ -14,6 +16,12 @@ main (void)
tap.expect_eq (a, util::bswap (b), "u32 byteswap"); tap.expect_eq (a, util::bswap (b), "u32 byteswap");
} }
{
static std::uint8_t const bytes[] = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef };
tap.expect_eq (util::readle<std::uint64_t> (bytes), 0xefcdab8967452301, "readle<u64>");
}
{ {
// try to byte swap the pattern for 1.0f // try to byte swap the pattern for 1.0f
// //

View File

@ -32,10 +32,10 @@ main (void)
CHECK_RENDER ("%.i", "", 0); CHECK_RENDER ("%.i", "", 0);
CHECK_RENDER ("% .i", " ", 0); // zero precision still requires a space CHECK_RENDER ("% .i", " ", 0); // zero precision still requires a space
CHECK_RENDER ("%hhi", "1", (signed char)1); CHECK_RENDER ("%hhi", "1", (signed char){1});
CHECK_RENDER ("%hi", "1", (signed short)1); CHECK_RENDER ("%hi", "1", (signed short){1});
CHECK_RENDER ("%li", "1", (signed long)1); CHECK_RENDER ("%li", "1", (signed long){1});
CHECK_RENDER ("%lli", "1", (signed long long)1); CHECK_RENDER ("%lli", "1", (signed long long){1});
CHECK_RENDER ("%ji", "1", intmax_t{1}); CHECK_RENDER ("%ji", "1", intmax_t{1});
CHECK_RENDER ("%zi", "1", ssize_t{1}); CHECK_RENDER ("%zi", "1", ssize_t{1});
CHECK_RENDER ("%ti", "1", ptrdiff_t{1}); CHECK_RENDER ("%ti", "1", ptrdiff_t{1});
@ -48,10 +48,10 @@ main (void)
CHECK_RENDER ("%-3u", "1 ", 1u); CHECK_RENDER ("%-3u", "1 ", 1u);
CHECK_RENDER ("%64u", " 1", 1u); CHECK_RENDER ("%64u", " 1", 1u);
CHECK_RENDER ("%hhu", "1", (unsigned char)1); CHECK_RENDER ("%hhu", "1", (unsigned char){1});
CHECK_RENDER ("%hu", "1", (unsigned short)1); CHECK_RENDER ("%hu", "1", (unsigned short){1});
CHECK_RENDER ("%lu", "1", (unsigned long)1); CHECK_RENDER ("%lu", "1", (unsigned long){1});
CHECK_RENDER ("%llu", "1", (unsigned long long)1); CHECK_RENDER ("%llu", "1", (unsigned long long){1});
CHECK_RENDER ("%ju", "1", uintmax_t{1}); CHECK_RENDER ("%ju", "1", uintmax_t{1});
CHECK_RENDER ("%zu", "0", size_t{0}); CHECK_RENDER ("%zu", "0", size_t{0});
CHECK_RENDER ("%zu", "1", size_t{1}); CHECK_RENDER ("%zu", "1", size_t{1});
@ -142,12 +142,12 @@ main (void)
CHECK_RENDER ("%!", "userobj", userobj {}); CHECK_RENDER ("%!", "userobj", userobj {});
CHECK_RENDER ("%p", "0x1234567", (void*)0x01234567); CHECK_RENDER ("%p", "0x1234567", reinterpret_cast<void*>(0x01234567));
CHECK_RENDER ("%p", "0x1234567", (int*)0x01234567); CHECK_RENDER ("%p", "0x1234567", reinterpret_cast<int*> (0x01234567));
CHECK_RENDER ("%p", "0x1234567", (char*)0x01234567); CHECK_RENDER ("%p", "0x1234567", reinterpret_cast<char*>(0x01234567));
CHECK_RENDER ("%p", "(nil)", nullptr); CHECK_RENDER ("%p", "(nil)", nullptr);
CHECK_RENDER ("%p", "(nil)", NULL); CHECK_RENDER ("%p", "(nil)", NULL);
CHECK_RENDER ("%!", "0x1234567", (void*)0x01234567); CHECK_RENDER ("%!", "0x1234567", reinterpret_cast<void*>(0x01234567));
CHECK_RENDER ("%%", "%"); CHECK_RENDER ("%%", "%");
CHECK_RENDER ("%10%", "%"); CHECK_RENDER ("%10%", "%");
@ -189,17 +189,17 @@ main (void)
CHECK_THROW("%i", conversion_error, 1u); CHECK_THROW("%i", conversion_error, 1u);
CHECK_THROW("%i", conversion_error, nullptr); CHECK_THROW("%i", conversion_error, nullptr);
CHECK_THROW("%hhi", length_error, (long long)1); CHECK_THROW("%hhi", length_error, (long long){1});
CHECK_THROW("%lli", length_error, (signed char)1); CHECK_THROW("%lli", length_error, (signed char){1});
CHECK_THROW("%u", conversion_error, 1.); CHECK_THROW("%u", conversion_error, 1.);
CHECK_THROW("%u", conversion_error, "foo"); CHECK_THROW("%u", conversion_error, "foo");
CHECK_THROW("%u", conversion_error, (void*)0); CHECK_THROW("%u", conversion_error, (void*){0});
CHECK_THROW("%u", conversion_error, 1); CHECK_THROW("%u", conversion_error, 1);
CHECK_THROW("%u", conversion_error, nullptr); CHECK_THROW("%u", conversion_error, nullptr);
CHECK_THROW("%hhu", length_error, (unsigned long long)1); CHECK_THROW("%hhu", length_error, (unsigned long long){1});
CHECK_THROW("%llu", length_error, (unsigned char)1); CHECK_THROW("%llu", length_error, (unsigned char){1});
CHECK_THROW("%f", conversion_error, 1u); CHECK_THROW("%f", conversion_error, 1u);
CHECK_THROW("%f", conversion_error, "foo"); CHECK_THROW("%f", conversion_error, "foo");

View File

@ -54,7 +54,7 @@ main (void)
tap.expect (!ref["integer"].is_string (), "integer not is_string"); tap.expect (!ref["integer"].is_string (), "integer not is_string");
tap.expect ( tap.expect (
util::equal ( util::equal (
(unsigned)ref["integer"].as_number ().as_uint (), ref["integer"].as_number ().as_uint (),
1u 1u
), ),
"integer value equality" "integer value equality"

View File

@ -22,6 +22,10 @@
#include <stdexcept> #include <stdexcept>
#include <iostream> #include <iostream>
// We generate some really old style C code via ragel here, so we have to
// disable some noisy warnings (doubly so given -Werror)
#pragma GCC diagnostic ignored "-Wold-style-cast"
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
%%{ %%{

View File

@ -25,6 +25,10 @@
#include <algorithm> #include <algorithm>
#include <iostream> #include <iostream>
// We generate some really old style C code via ragel here, so we have to
// disable some noisy warnings (doubly so given -Werror)
#pragma GCC diagnostic ignored "-Wold-style-cast"
using util::uri; using util::uri;

View File

@ -25,6 +25,10 @@
#include "debug.hpp" #include "debug.hpp"
// We generate some really old style C code via ragel here, so we have to
// disable some noisy warnings (doubly so given -Werror)
#pragma GCC diagnostic ignored "-Wold-style-cast"
using util::version; using util::version;