gcc/libstdc++ 7.x fixes
parent
c6a854fac3
commit
67525af4e5
|
@ -25,8 +25,8 @@ auto second_half = iter(input_array).slice(input_array.size() / 2);
|
|||
*/
|
||||
static void test_channel() {
|
||||
auto c = make_channel<int>();
|
||||
auto f = [](auto c, auto half) {
|
||||
c.put(foldl(half, 0));
|
||||
auto f = [](auto ch, auto half) {
|
||||
ch.put(foldl(half, 0));
|
||||
};
|
||||
spawn(f, c, first_half);
|
||||
spawn(f, c, second_half);
|
||||
|
|
|
@ -21,7 +21,7 @@ struct Foo {
|
|||
|
||||
/* implementing formatting for custom objects */
|
||||
template<>
|
||||
struct format_traits<Foo> {
|
||||
struct ostd::format_traits<Foo> {
|
||||
template<typename R>
|
||||
static void to_format(Foo const &, R &writer, format_spec const &fs) {
|
||||
switch (fs.spec()) {
|
||||
|
|
|
@ -488,7 +488,7 @@ protected:
|
|||
}
|
||||
|
||||
private:
|
||||
void validate_req(arg_value req) const noexcept {
|
||||
void validate_req(arg_value req) const {
|
||||
switch (req) {
|
||||
case arg_value::EXACTLY:
|
||||
case arg_value::OPTIONAL:
|
||||
|
@ -1595,8 +1595,8 @@ struct default_help_formatter {
|
|||
}, false, false);
|
||||
std::size_t maxpad = std::max({opt_namel, pos_namel, grp_namel});
|
||||
|
||||
auto write_help = [maxpad, this](
|
||||
auto &out, std::vector<arg_argument const *> const &args
|
||||
auto write_help = [&out, maxpad, this](
|
||||
std::vector<arg_argument const *> const &args
|
||||
) {
|
||||
for (auto p: args) {
|
||||
format(out, " ");
|
||||
|
@ -1619,12 +1619,12 @@ struct default_help_formatter {
|
|||
|
||||
if (!allpos.empty()) {
|
||||
format(out, "\nPositional arguments:\n");
|
||||
write_help(out, allpos);
|
||||
write_help(allpos);
|
||||
}
|
||||
|
||||
if (!allopt.empty()) {
|
||||
format(out, "\nOptional arguments:\n");
|
||||
write_help(out, allopt);
|
||||
write_help(allopt);
|
||||
}
|
||||
|
||||
allopt.clear();
|
||||
|
@ -1658,8 +1658,8 @@ struct default_help_formatter {
|
|||
}
|
||||
return true;
|
||||
}, true, false);
|
||||
write_help(out, allpos);
|
||||
write_help(out, allopt);
|
||||
write_help(allpos);
|
||||
write_help(allopt);
|
||||
return true;
|
||||
}, false, false);
|
||||
}
|
||||
|
|
|
@ -89,7 +89,7 @@ namespace detail {
|
|||
}
|
||||
}
|
||||
|
||||
void wait() const {
|
||||
void wait() {
|
||||
std::unique_lock<std::mutex> l{p_lock};
|
||||
while (!p_stor) {
|
||||
p_cond.wait(l);
|
||||
|
@ -188,7 +188,7 @@ struct tid {
|
|||
*
|
||||
* The behavior is undefined when valid() is not true.
|
||||
*/
|
||||
void wait() const {
|
||||
void wait() {
|
||||
p_state->wait();
|
||||
}
|
||||
|
||||
|
@ -909,8 +909,8 @@ public:
|
|||
R ret;
|
||||
spawn_add(
|
||||
std::forward<TSA>(sa),
|
||||
[&ret, func = std::move(func)](auto &&...args) {
|
||||
ret = func(std::forward<A>(args)...);
|
||||
[&ret, func = std::move(func)](auto &&...fargs) {
|
||||
ret = func(std::forward<A>(fargs)...);
|
||||
},
|
||||
std::forward<A>(args)...
|
||||
);
|
||||
|
|
|
@ -380,6 +380,8 @@ public:
|
|||
stack_node *nd = request();
|
||||
std::size_t ss = p_stacksize - sizeof(stack_node);
|
||||
auto *p = reinterpret_cast<unsigned char *>(nd) - ss;
|
||||
/* avoid false-positive warning with GCC */
|
||||
static_cast<void>(p);
|
||||
if constexpr(Protected) {
|
||||
detail::stack_protect(p, Traits::page_size());
|
||||
}
|
||||
|
|
|
@ -36,6 +36,8 @@
|
|||
#include <tuple>
|
||||
#include <type_traits>
|
||||
#include <optional>
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
|
||||
#include <ostd/platform.hh>
|
||||
#include <ostd/range.hh>
|
||||
|
@ -390,8 +392,8 @@ namespace detail {
|
|||
using yield_type = std::tuple<A...>;
|
||||
|
||||
static yield_type get(std::tuple<coro_arg<A>...> &args) {
|
||||
return std::apply([](auto ...args) {
|
||||
return std::make_tuple(std::forward<A>(*args)...);
|
||||
return std::apply([](auto ...targs) {
|
||||
return std::make_tuple(std::forward<A>(*targs)...);
|
||||
}, args);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -19,8 +19,10 @@
|
|||
#ifndef OSTD_FORMAT_HH
|
||||
#define OSTD_FORMAT_HH
|
||||
|
||||
#include <cstring>
|
||||
#include <cstddef>
|
||||
#include <climits>
|
||||
#include <cmath>
|
||||
#include <utility>
|
||||
#include <stdexcept>
|
||||
#include <locale>
|
||||
|
@ -990,8 +992,8 @@ private:
|
|||
if (esc) {
|
||||
char buf[6];
|
||||
buf[0] = '\'';
|
||||
std::size_t elen = strlen(esc);
|
||||
memcpy(buf + 1, esc, elen);
|
||||
std::size_t elen = std::strlen(esc);
|
||||
std::memcpy(buf + 1, esc, elen);
|
||||
buf[elen + 1] = '\'';
|
||||
write_val(writer, false, ostd::string_range{
|
||||
buf, buf + elen + 2
|
||||
|
@ -1115,7 +1117,7 @@ private:
|
|||
st.width(width());
|
||||
st.precision(has_precision() ? precision() : 6);
|
||||
|
||||
typename std::ios_base::fmtflags fl = 0;
|
||||
typename std::ios_base::fmtflags fl{};
|
||||
if (!(isp & 32)) {
|
||||
fl |= std::ios_base::uppercase;
|
||||
}
|
||||
|
@ -1132,7 +1134,7 @@ private:
|
|||
}
|
||||
if (p_flags & FMT_FLAG_PLUS) {
|
||||
fl |= std::ios_base::showpos;
|
||||
} else if ((p_flags & FMT_FLAG_SPACE) && !signbit(val)) {
|
||||
} else if ((p_flags & FMT_FLAG_SPACE) && !std::signbit(val)) {
|
||||
/* only if no sign is shown... num_put does not
|
||||
* support this so we have to do it on our own
|
||||
*/
|
||||
|
@ -1151,6 +1153,8 @@ private:
|
|||
|
||||
template<typename R, typename T>
|
||||
void write_val(R &writer, bool escape, T const &val) const {
|
||||
/* avoid false-positive warning with GCC */
|
||||
static_cast<void>(escape);
|
||||
/* stuff fhat can be custom-formatted goes first */
|
||||
if constexpr(detail::fmt_tofmt_test<T, decltype(noop_sink<char>())>) {
|
||||
format_traits<T>::to_format(val, writer, *this);
|
||||
|
@ -1214,7 +1218,7 @@ private:
|
|||
return;
|
||||
}
|
||||
/* integers */
|
||||
if constexpr(std::is_integral_v<T>) {
|
||||
if constexpr(std::is_integral_v<T> && !std::is_same_v<T, bool>) {
|
||||
if constexpr(std::is_signed_v<T>) {
|
||||
/* signed integers */
|
||||
using UT = std::make_unsigned_t<T>;
|
||||
|
@ -1257,6 +1261,8 @@ private:
|
|||
inline void write_range_item(
|
||||
R &writer, bool escape, bool expandval, string_range fmt, T const &item
|
||||
) const {
|
||||
/* avoid false-positive warning with GCC */
|
||||
static_cast<void>(expandval);
|
||||
if constexpr(detail::is_tuple_like<T>) {
|
||||
if (expandval) {
|
||||
std::apply([&writer, escape, &fmt, this](
|
||||
|
@ -1282,6 +1288,8 @@ private:
|
|||
void write_range_val(
|
||||
R &writer, F &&func, string_range sep, T const &val
|
||||
) const {
|
||||
/* avoid false-positive warning with GCC */
|
||||
static_cast<void>(sep);
|
||||
if constexpr(detail::iterable_test<T>) {
|
||||
auto range = ostd::iter(val);
|
||||
if (range.empty()) {
|
||||
|
@ -1328,6 +1336,8 @@ private:
|
|||
void write_tuple_val(
|
||||
R &writer, bool escape, string_range sep, T const &tup
|
||||
) const {
|
||||
/* avoid false-positive warning with GCC */
|
||||
static_cast<void>(sep);
|
||||
format_spec sp{'s', p_loc, escape ? FMT_FLAG_AT : 0};
|
||||
sp.write_arg(writer, 0, std::get<I>(tup));
|
||||
if constexpr(I < (N - 1)) {
|
||||
|
|
|
@ -47,7 +47,6 @@ namespace test {
|
|||
|
||||
namespace detail {
|
||||
static std::vector<void (*)()> test_cases;
|
||||
static void (*test_dummy)() = nullptr;
|
||||
|
||||
static bool add_test(std::string testn, void (*func)()) {
|
||||
if (testn == OSTD_TEST_MODULE_CURRENT) {
|
||||
|
|
Loading…
Reference in New Issue