Boost logo

Boost Users :

Subject: [Boost-users] Error building Spirit parser in VS2017
From: Michael Powell (mwpowellhtx_at_[hidden])
Date: 2018-10-30 23:20:11


Hello,

I am receiving the following error building against the latest VS2017 ...

1>Version_Parser.cpp
1>d:\dev\boost.org\boost_1_68_0\boost\iostreams\positioning.hpp(96):
error C4996: 'std::fpos<_Mbstatet>::seekpos': warning STL4019: The
member std::fpos::seekpos() is non-Standard, and is preserved only for
compatibility with workarounds for old versions of Visual C++. It will
be removed in a future release, and in this release always returns 0.
Please use standards-conforming mechanisms to manipulate fpos, such as
conversions to and from streamoff, or an integral type, instead. If
you are receiving this message while compiling Boost.IOStreams, a fix
has been submitted upstream to make Boost use standards-conforming
mechanisms, as it does for other compilers. You can define
_SILENCE_FPOS_SEEKPOS_DEPRECATION_WARNING to acknowledge that you have
received this warning, or define _REMOVE_FPOS_SEEKPOS to remove
std::fpos::seekpos entirely.
1>c:\program files (x86)\microsoft visual
studio\2017\enterprise\vc\tools\msvc\14.15.26726\include\iosfwd(59):
note: see declaration of 'std::fpos<_Mbstatet>::seekpos'

With my grammar:

BOOST_FUSION_ADAPT_STRUCT(NS_VERSION_H::version, _major, _minor,
_patch, _build);

template <typename It>
struct version_parser : qi::grammar<It, NS_VERSION_H::version()> {

    version_parser() : dot_('.'), version_parser::base_type(_start) {
        using qi::lit;
        using qi::hold;
        using qi::short_;
        _major_part = short_;
        _minor_part = lit(dot_) >> short_;
        _patch_part = lit(dot_) >> short_;
        _build_part = lit(dot_) >> short_;
        _start = hold[_major_part >> _minor_part >> -(_patch_part >>
-_build_part)];
    }

private:

    qi::rule<It, NS_VERSION_H::version()> _start;
    const char dot_;
    qi::rule<It, short()> _major_part;
    qi::rule<It, short()> _minor_part;
    qi::rule<It, short()> _patch_part;
    qi::rule<It, short()> _build_part;
};

bool try_parse_version(const std::string& s, NS_VERSION_H::version& v) {
    using It = std::string::const_iterator;
    using qi::parse;

    It first = s.begin(), last = s.end();

    if (!parse(first, last, version_parser<It>{}, v)) {
        std::cout << "Failed to parse: '" << s << "'" << std::endl;
        return false;
    }

    const auto dot_ = ".";

    std::cout << "version: "
        << v._major
        << dot_ << v._minor
        << dot_ << v._patch
        << dot_ << v._build << std::endl;

    return true;
}

At present I have not furnished any Spirit flags or anything of that
sort; pretty much taking the includes, grammar, building as-is.

Secondary to the error, I want the parser to reject spaces, should
just be numeric (short) and the dot delimiter.

Best regards,

Michael Powell


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net