GithubHelp home page GithubHelp logo

Comments (9)

terrelln avatar terrelln commented on April 28, 2024 1

Based on this discussion VS2012 does emit this warning.

from zstd.

terrelln avatar terrelln commented on April 28, 2024 1

And in the same discussion, looks like it was fixed in VS2015.

from zstd.

terrelln avatar terrelln commented on April 28, 2024 1

I suspect V2013 does have the bug, since it was mentioned it was fixed in 2015.

from zstd.

terrelln avatar terrelln commented on April 28, 2024 1

It turns out we already have a few macros that use do { } while (0) in our error_private.h header. And we've made a release and had no complaints. So we should be able to add it no problem.

from zstd.

Cyan4973 avatar Cyan4973 commented on April 28, 2024

Yes, Visual Studio has been the main reason to not employ while (0).

Which minimal version of Visual Studio is required to avoid triggering a "constant branch" warning ?

from zstd.

terrelln avatar terrelln commented on April 28, 2024

Which minimal version of Visual Studio is required to avoid triggering a "constant branch" warning ?

I'm not really sure. I tried to trigger it in godbolt, but I don't think they have a old enough version.

from zstd.

Cyan4973 avatar Cyan4973 commented on April 28, 2024

While CI seems safe, by virtue of supporting only fairly recent versions of Visual Studio,
this decision may have consequences on https://github.com/facebook/zstd/tree/dev/build,
since we are supporting Visual Studio since 2008 here.

Depending on how we want to handle that, we might have to drop a few versions.
Your investigation suggests that versions <= 2012 would trigger a warning.
So I think that leaves only one version, VS2013, as a question mark.

from zstd.

Cyan4973 avatar Cyan4973 commented on April 28, 2024

I wonder if there would be a way to disable this warning from within the project file,
or possibly even better, from within the cmake script that will generate the project file.

from zstd.

terrelln avatar terrelln commented on April 28, 2024

I don't really know what our policy should be here. We will still compile with older Visual Studios, it will just emit warnings. So our users would have to turn off warnings-as-errors for older Visual Studios.

We should be able to disable the warning using __pragma(warning(suppress:4127)). So we could probably push that pragma in our portability header, and then use do { } while (0) without generating those warnings.

from zstd.

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.