-
Couldn't load subscription status.
- Fork 560
scala-native 0.5.9 #4510
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: series/3.x
Are you sure you want to change the base?
scala-native 0.5.9 #4510
Changes from all commits
e145629
4cdbd66
6eaad96
58f77f5
e40493b
fc18357
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,10 @@ | ||
| #ifdef CATS_EFFECT_SIGNAL_HELPER | ||
|
|
||
| // we'll need POSIX for `sigaction`: | ||
| #ifndef _POSIX_C_SOURCE | ||
| #define _POSIX_C_SOURCE 1 | ||
This comment was marked as resolved.
Sorry, something went wrong.
This comment was marked as resolved.
Sorry, something went wrong. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It fails (on 0.5.9) with the same "incomplete type" and "implicit declaration" errors. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, conversation in #scala-native I realized that. Technically this should be defined before the inclusion of any other standard headers (so before It would be an issue if i.e. sigaction depended on something in stddef.h that stddef.h only defines with _POSIX_C_SOURCE active. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe it should be defined before the inclusion of practically anything anywhere (but we can't do that, it's not up to us). So it's not bulletproof, but I don't have a better idea. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This being a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
That is standards speak for "You will regret it if you do it any other way" ;-) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The macro with which I am familiar is "_POSIX_SOURCE". Is "_POSIX_C_SOURCE" here an alias for the former? If not, that may explain some lack of effect. I just made a change in SN where I added guard code There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, we'll need the Apprently There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @LeeTibbert you shouldn't need to guard it: https://godbolt.org/z/3WssGsE1r and my argument is that you shouldn't want to guard it. Getting an error when it's defined twice is good because it tells you someone is using it wrong (i.e. the only place it should be defined is at the very beginning of a source file ["translation unit"]) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good discussion & good points. People, especially in large projects with build files, specify compiler options Guarding it or not is, I believe, one of those points where it depends upon what one Over time I have become much more defensive when writing code which gets compiled I have become both reluctant to break user code and to give up a week of my time to an That is, if the code requires a methods introduced in an Open Group version 6, what happens if they In this case, by my possibly mistaken reading, I believe that there is no current conflicting value, I believe this is more important when the code specifies a value such as 1 and a user For me, I am much more concerned with the case where a user can specify a conflicting definition. Say they compile their entire project with "-std=gnu17". One would then have "_GNU_SOURCE" (and/or possibly a newer macro" defined at the same time as this file defining "_POSIX_C_SOURCE". I believe, on hasty reading, that the I'm off to a another lesson in humility by chasing a Scala 2 `NullPointerException` in `ConcurrentHashMap`. I fear Cats Effects is probably affected by this bug. This discussion is much more interesting that that lesson ;-) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @s5bug I this case I mostly agree with @LeeTibbert. Specifically, the scenario I'm guarding against is this: the user specifies There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
My view is it is more useful to tell a user "hey you shouldn't be doing this" than let it go through. If SN wants to support people doing strange things with compiler flags, that's fine by me, but for cases outside of this one that require a #ifndef _POSIX_C_SOURCE
#define _POSIX_C_SOURCE 123456L
#endifcould we recommend #if defined(_POSIX_C_SOURCE)
#if _POSIX_C_SOURCE < 123456L
#error ...
#endif
#else
#define _POSIX_C_SOURCE 123456L
#endifsomewhere?
My godbolt link shows this is not an issue: a warning is only thrown when a double-define occurs (GCC's private
I want to reiterate that the user should not be doing this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I think it immediately says the developer there is POSIX inside. Something like the internal Scala Native There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I'm not convinced this is the case;
It then goes on detailing various macros, including Of course it's possible that there exists some other documentation or "best practices" which says otherwise. If so, I'd be happy to read that... |
||
| #endif | ||
|
|
||
| #include <stddef.h> | ||
| #include <signal.h> | ||
|
|
||
|
|
@@ -19,4 +25,5 @@ int cats_effect_install_handler(int signum, Handler handler) { | |
| } | ||
| return sigaction(signum, &action, NULL); | ||
| } | ||
|
|
||
| #endif | ||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK _POSIX_C_SOURCE is newer than _POSIX_SOURCE. I believe that it
is supposed to have a value defined in the Open Group Standard. Something
much higher than 1.
Later: see version suggestion below and related discussion in CE Issue #4509
All the .h file code I was looking for used _POSIX_SOURCE, and not the former.
I guess the compiler will tell you/us if it can not find the symbols revealed by the
correct macro.