Coder Social home page Coder Social logo

Comments (6)

mbeutel avatar mbeutel commented on June 20, 2024 1

@martinmoene, thanks for the suggestion, I think that might indeed be better than suppressing all these warnings in all of our test suite.

from gsl-lite.

mbeutel avatar mbeutel commented on June 20, 2024

Thank you for the report. The problem might be related to this change to the PCH setup. Previously, we had simply set gsl-lite.t.hpp as the precompiled header; but apparently this didn't interact well with the warning suppressions in that header file; at least I had to address several previously unseen warnings after making these changes.

As a general rule, I would like to avoid unconditional warning suppressions for current compiler versions. "-Wno-long-long", being relevant only for C++98, is an exception; "-Wuseless-cast" unconditionally enables the warning which is fine.

(Edit: pardon me, I had only looked at MakeTestTarget.cmake. We indeed have a lot of unconditional warning suppressions in gsl-lite.t.hpp, "-Wuseless-cast" being among them. As a comment there points out, this is required to pacify the compiler with regard to lest. I aim to eventually replace our outdated and somewhat customized copy of lest with Catch2.)

If the warning appears only once, I'd prefer to work around locally, either by suppressing it:

inline bool unprintable( char c )
{
#if defined (__GNUC__)
# pragma GCC diagnostic suppress "-Wtype-limits"  // comparison is always true due to limited range of data type
#endif // defined (__GNUC__)
    return 0 <= c && c < ' ';
}

or by casting c to signed char:

inline bool unprintable( char c ) { return 0 <= static_cast<signed char>(c) && c < ' '; }

Would you mind verifying if either of these fixes the issue, and possibly issuing a PR?

Edit: you can also add "-Wtype-limits" to the ignored diagnostics in gsl-lite.t.hpp if you like. I'll find it there if I ever get around to replacing lest.

from gsl-lite.

martinmoene avatar martinmoene commented on June 20, 2024

An intermediate step could perhaps be to suppress lest's warnings by handling it as a system header. See e.g. this commit of string_view lite.

from gsl-lite.

musicinmybrain avatar musicinmybrain commented on June 20, 2024

Thank you for the report. The problem might be related to this change to the PCH setup. Previously, we had simply set gsl-lite.t.hpp as the precompiled header; but apparently this didn't interact well with the warning suppressions in that header file; at least I had to address several previously unseen warnings after making these changes.

Thanks for explaining that; it seems like a plausible root cause.

As a general rule, I would like to avoid unconditional warning suppressions for current compiler versions. […]

If the warning appears only once, I'd prefer to work around locally, either by suppressing it:

[…]

or by casting c to signed char:

[…]

Would you mind verifying if either of these fixes the issue, and possibly issuing a PR?

Thanks for the suggestions. Both of these look reasonable; if you have no particular preference, I think I prefer the cast. I’ve tested it as a patch and opened a PR.

from gsl-lite.

mbeutel avatar mbeutel commented on June 20, 2024

Thanks for the contribution. Do you need a patch release (v0.41.1) as soon as possible? If not, I'd let it sit for a few days before issuing a release in case there is more fallout.

from gsl-lite.

musicinmybrain avatar musicinmybrain commented on June 20, 2024

Thanks for the contribution. Do you need a patch release (v0.41.1) as soon as possible? If not, I'd let it sit for a few days before issuing a release in case there is more fallout.

There is no hurry at all. Thanks for working on this.

from gsl-lite.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.