Error building Spirit parser in VS2017

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Error building Spirit parser in VS2017

Boost - Users mailing list
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 mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: Error building Spirit parser in VS2017

Boost - Users mailing list
On 31/10/2018 12:20, Michael Powell wrote:
> I am receiving the following error building against the latest VS2017 ...

Did you read the error?  It's pretty explicit what the problem is and
what you need to do to work around it until a newer version of Boost is
released.
_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: Error building Spirit parser in VS2017

Boost - Users mailing list
On Tue, Oct 30, 2018 at 11:22 PM Gavin Lambert via Boost-users
<[hidden email]> wrote:
>
> On 31/10/2018 12:20, Michael Powell wrote:
> > I am receiving the following error building against the latest VS2017 ...
>
> Did you read the error?  It's pretty explicit what the problem is and
> what you need to do to work around it until a newer version of Boost is
> released.

Well, I added _REMOVE_FPOS_SEEKPOS to my preprocessor defs, and now I
am receiving this, I suppose, predictably:

Severity Code Description Project File Line Suppression State
Error C2039 'seekpos': is not a member of 'std::fpos<_Mbstatet>'
Kingdom.OrTools.Sat.Params.Generator
d:\dev\boost.org\boost_1_68_0\boost\iostreams\positioning.hpp 96

I can defined _SILENCE_FPOS_SEEKPOS_DEPRECATION_WARNING instead, but
clearly if seekpos() is always returning 0, there's going to be some
regressions.

So... What's the recourse beyond that? Depending on the deprecated
(always returning zero) seekpos() is the wrong thing to do.

> _______________________________________________
> Boost-users mailing list
> [hidden email]
> https://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: Error building Spirit parser in VS2017

Boost - Users mailing list
On 31/10/2018 16:28, Michael Powell wrote:
> I can defined _SILENCE_FPOS_SEEKPOS_DEPRECATION_WARNING instead, but
> clearly if seekpos() is always returning 0, there's going to be some
> regressions.
>
> So... What's the recourse beyond that? Depending on the deprecated
> (always returning zero) seekpos() is the wrong thing to do.

When it follows that codepath, it doesn't use _only_ the zero, it
combines it with another non-zero value so that it should still produce
the correct answer.

But if you want to avoid it entirely, then you need to do one of:

  1. Use the 14.0 toolset.
  2. Wait for the release of Boost 1.69.
  3. Apply this patch to your local Boost:
       https://github.com/boostorg/iostreams/pull/57/files
_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: Error building Spirit parser in VS2017

Boost - Users mailing list
On Wed, Oct 31, 2018 at 12:28 AM Gavin Lambert via Boost-users
<[hidden email]> wrote:

>
> On 31/10/2018 16:28, Michael Powell wrote:
> > I can defined _SILENCE_FPOS_SEEKPOS_DEPRECATION_WARNING instead, but
> > clearly if seekpos() is always returning 0, there's going to be some
> > regressions.
> >
> > So... What's the recourse beyond that? Depending on the deprecated
> > (always returning zero) seekpos() is the wrong thing to do.
>
> When it follows that codepath, it doesn't use _only_ the zero, it
> combines it with another non-zero value so that it should still produce
> the correct answer.
>
> But if you want to avoid it entirely, then you need to do one of:
>
>   1. Use the 14.0 toolset.
>   2. Wait for the release of Boost 1.69.
>   3. Apply this patch to your local Boost:
>        https://github.com/boostorg/iostreams/pull/57/files

I'm encountering the error in iostreams/positioning.hpp, not fpos.hpp
(although obviously that one needs remediation as well).

> _______________________________________________
> Boost-users mailing list
> [hidden email]
> https://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: Error building Spirit parser in VS2017

Boost - Users mailing list
On 31/10/2018 17:31, Michael Powell wrote:
>> But if you want to avoid it entirely, then you need to do one of:
>>
>>    1. Use the 14.0 toolset.
>>    2. Wait for the release of Boost 1.69.
>>    3. Apply this patch to your local Boost:
>>         https://github.com/boostorg/iostreams/pull/57/files
>
> I'm encountering the error in iostreams/positioning.hpp, not fpos.hpp
> (although obviously that one needs remediation as well).

fpos.hpp is a configuration header used by positioning.hpp.


As I said before, defining _SILENCE_FPOS_SEEKPOS_DEPRECATION_WARNING is
sufficient for Boost 1.68; it will still just work.  Doing the above is
optional but will let you resolve the issue without defining that.
_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: Error building Spirit parser in VS2017

Boost - Users mailing list
On Wed, Oct 31, 2018 at 12:42 AM Gavin Lambert via Boost-users
<[hidden email]> wrote:

>
> On 31/10/2018 17:31, Michael Powell wrote:
> >> But if you want to avoid it entirely, then you need to do one of:
> >>
> >>    1. Use the 14.0 toolset.
> >>    2. Wait for the release of Boost 1.69.
> >>    3. Apply this patch to your local Boost:
> >>         https://github.com/boostorg/iostreams/pull/57/files
> >
> > I'm encountering the error in iostreams/positioning.hpp, not fpos.hpp
> > (although obviously that one needs remediation as well).
>
> fpos.hpp is a configuration header used by positioning.hpp.

Well, color me confused. seekpos() is called from positioning.hpp,
which seekpos() is the thing going away, correct?

Clearly you've done the root cause analysis; I'm just reporting them
as I see them.

> As I said before, defining _SILENCE_FPOS_SEEKPOS_DEPRECATION_WARNING is
> sufficient for Boost 1.68; it will still just work.  Doing the above is
> optional but will let you resolve the issue without defining that.
> _______________________________________________
> Boost-users mailing list
> [hidden email]
> https://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: Error building Spirit parser in VS2017

Boost - Users mailing list
On 31/10/2018 18:03, Michael Powell wrote:
>> fpos.hpp is a configuration header used by positioning.hpp.
>
> Well, color me confused. seekpos() is called from positioning.hpp,
> which seekpos() is the thing going away, correct?

The change to fpos.hpp makes positioning.hpp use a different code path
that no longer calls (or compiles any calls to) seekpos().

> Clearly you've done the root cause analysis; I'm just reporting them
> as I see them.

I knew absolutely nothing about this issue until I replied to your
message; I just spent five minutes reading the code.
_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: Error building Spirit parser in VS2017

Boost - Users mailing list
On Wed, Oct 31, 2018 at 1:48 AM Gavin Lambert via Boost-users
<[hidden email]> wrote:

>
> On 31/10/2018 18:03, Michael Powell wrote:
> >> fpos.hpp is a configuration header used by positioning.hpp.
> >
> > Well, color me confused. seekpos() is called from positioning.hpp,
> > which seekpos() is the thing going away, correct?
>
> The change to fpos.hpp makes positioning.hpp use a different code path
> that no longer calls (or compiles any calls to) seekpos().
>
> > Clearly you've done the root cause analysis; I'm just reporting them
> > as I see them.
>
> I knew absolutely nothing about this issue until I replied to your
> message; I just spent five minutes reading the code.

Oh, I see. I had no idea.

So, I applied the patch, still need to define the acknowledgment apparently.

Thanks...

> _______________________________________________
> Boost-users mailing list
> [hidden email]
> https://lists.boost.org/mailman/listinfo.cgi/boost-users
_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users