Viatorus / emio

A safe and fast high-level and low-level character input/output library for bare-metal and RTOS based embedded systems with a very small binary footprint.
https://viatorus.github.io/emio/
MIT License
133 stars 4 forks source link

Note Parameter passing for argument changed in GCC 7.1 #93

Closed ra-kal closed 5 months ago

ra-kal commented 7 months ago

Hi,

I added custom formater and now I'm getting warnings during build. It happens with the emio main branch version.

[build] emio/include/emio/detail/args.hpp: In constructor 'emio::detail::args_span_with_str<Arg>::args_span_with_str(const emio::detail::validated_string_storage&, std::span<const Arg>) [with Arg = emio::detail::arg<emio::writer, emio::detail::format::format_arg_trait>]':
[build] emio/include/emio/detail/args.hpp:179:3: note: parameter passing for argument of type 'std::span<const emio::detail::arg<emio::writer, emio::detail::format::format_arg_trait>, 4294967295>' changed in GCC 7.1
[build]   179 |   args_span_with_str(const validated_string_storage& str, std::span<const Arg> args)
[build]       |   ^~~~~~~~~~~~~~~~~~

My formatter is simple:

#ifndef EMIO_FORMAT_H
#define EMIO_FORMAT_H

#include "Address.h"
#include <emio/format.hpp>

template<>
class emio::formatter<Address> {
public:
  static constexpr result<void> validate(reader& format_rdr)
  {
    return format_rdr.read_if_match_char('}');
  }

  constexpr result<void> parse(reader& format_rdr)
  {
    return format_rdr.read_if_match_char('}');
  }

  constexpr result<void> format(writer& out, const Address& arg) const
  {
    auto result = out.write_int(arg.address());
    if (!result)
    {
      return result;
    }
    if (arg.isAb())
    {
      result = out.write_char(arg.isA() ? 'A' : 'B');
    }
    return result;
  }
};

#endif /* EMIO_FORMAT_H */
Viatorus commented 7 months ago

Which compiler do you use? Could you please provide an example here: https://godbolt.org/z/YajcWjzsf

For know, I don't see an issue with emio. This warning is more an "info". Take a look here: https://stackoverflow.com/a/48149400/1611317

Since emio doesn't work with older GCCs (< 10?) this should be unrelated.

ra-kal commented 7 months ago

Oh, I didn't noticed it happens only with ARM GCC compiler (arm-gcc-none-eabi). I understand there was some change in EABI, and this is more an info. I assume I can safely diable it with the "-Wno-psabi".

Your example shows the warning with ARM GCC 13.2.0 https://godbolt.org/z/8oesazhh5