Coder Social home page Coder Social logo

Comments (5)

edgar-bonet avatar edgar-bonet commented on June 11, 2024 1

I suggest defining _XOPEN_SOURCE=500 in stresstest.c, as suggested by the glibc documentation. The Musl libc provides M_PI when this macro is defined, irrespective of its value.

from ttyplot.

hartwork avatar hartwork commented on June 11, 2024

I suggest defining _XOPEN_SOURCE=500 in stresstest.c, as suggested by the glibc documentation. The Musl libc provides M_PI when this macro is defined, irrespective of its value.

@edgar-bonet that's an interesting find and idea. I would want to test out this precise addition to the very top of stresstest.c then:

#if !defined(_XOPEN_SOURCE) || (_XOPEN_SOURCE < 500)
# define _XOPEN_SOURCE 500
#endif

Besides a fix, we could add CI using Docker with an image of Alpine Linux to cover compilation with Musl, if that sounds acceptable. It would help protect against regressions once this is fixed.

@edgar-bonet @tenox7 how do you feel about this direction in general?

from ttyplot.

edgar-bonet avatar edgar-bonet commented on June 11, 2024

In order to avoid a “redefined” warning, I would undefine _XOPEN_SOURCE if it has an unsuitable value:

#if _XOPEN_SOURCE < 500
# undef _XOPEN_SOURCE
#endif
#ifndef _XOPEN_SOURCE
# define _XOPEN_SOURCE 500
#endif

Note that this is safe even if _XOPEN_SOURCE is initially undefined:

  • an undefined macro evaluates as zero within a #if
  • undefining an undefined macro is a no-op.

how do you feel about [a CI with Musl/Alpine/Docker] in general?

Great! I am not that comfortable with Docker, but I appreciate the great job you are doing on the CI front.

from ttyplot.

hartwork avatar hartwork commented on June 11, 2024

In order to avoid a “redefined” warning, I would undefine _XOPEN_SOURCE if it has an unsuitable value:

#if _XOPEN_SOURCE < 500
# undef _XOPEN_SOURCE
#endif
#ifndef _XOPEN_SOURCE
# define _XOPEN_SOURCE 500
#endif

Note that this is safe even if _XOPEN_SOURCE is initially undefined:

  • an undefined macro evaluates as zero within a #if
  • undefining an undefined macro is a no-op.

@edgar-bonet would you be okay with this alternative?:

#if !defined(_XOPEN_SOURCE) || (_XOPEN_SOURCE < 500)
# undef _XOPEN_SOURCE  // to address warnings about re-definition
# define _XOPEN_SOURCE 500
#endif

It seems to play by the rules you described and I would find it more "contained" and self-explaining, a bit easier to look at, but that's potentially all subjective. What do you think?

how do you feel about [a CI with Musl/Alpine/Docker] in general?

Great! I am not that comfortable with Docker, but I appreciate the great job you are doing on the CI front.

Thanks!

from ttyplot.

edgar-bonet avatar edgar-bonet commented on June 11, 2024

Yes, that way of (re)defining _XOPEN_SOURCE looks good to me. I would even be happy with the “magic number” version:

#ifndef M_PI
# define M_PI 3.1415926535897932
#endif

from ttyplot.

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.