Skip to content
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

[llvm-test-suite][tools] Fix not utility to avoid std::system #142

Merged
merged 2 commits into from
Jul 25, 2024

Conversation

tarunprabhu
Copy link
Contributor

Avoid using std::system on Unix systems. Some systems such as Ubuntu return a different error code from calls to std::system. Use posix_spawn to avoid having to special case these. std::system is now only used on Windows.

@jeanPerier identified this as an issue here
@jroelofs, could you check that this doesn't cause any issues on iOS.

tools/not.cpp Outdated
#include <spawn.h>
#include <sys/wait.h>
#endif

#ifdef __APPLE__
#include <TargetConditionals.h>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TargetConditionals.h is only needed for TARGET_OS_IPHONE, so I think we can drop this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the #ifdef be changed to TARGET_OS_IPHONE then?

Avoid using std::system on Unix systems. Some systems such as Ubuntu return
a different error code from calls to std::system. Use posix_spawn to avoid
having to special case these. std::system is now only used on Windows.
Copy link
Contributor

@jeanPerier jeanPerier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @tarunprabhu. I am no expert in those if-def, but this patch ran OK on my Ubuntu machine.

tools/not.cpp Outdated Show resolved Hide resolved
@tarunprabhu tarunprabhu merged commit 3216058 into llvm:main Jul 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants