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

Enable macros to use certain things from the OS module when the target OS is not supported #24639

Merged
merged 4 commits into from
Jan 24, 2025

Conversation

PMunch
Copy link
Contributor

@PMunch PMunch commented Jan 23, 2025

Essentially this PR removes the {.error.} pragmas littered around in the OS module and submodules which prevents them from being imported if the target OS is not supported. This made it impossible to use certain supported features of the OS module in macros from a supported host OS. Instead of the {.error.} pragmas the oscommon module now has a constant supportedSystem which is false in the cases where the {.error.} pragmas where generated. All procedures which can't be run by macros is also not declared when supportedSystem is false.

It would be possible to create dummy versions of the omitted functions with an {.error.} pragma that would trigger upon their use, but this is currently not done.

This properly fixes #19414

@Araq Araq closed this Jan 24, 2025
@Araq Araq reopened this Jan 24, 2025
@Araq Araq merged commit 1f9cac1 into nim-lang:devel Jan 24, 2025
30 checks passed
Copy link
Contributor

Thanks for your hard work on this PR!
The lines below are statistics of the Nim compiler built from 1f9cac1

Hint: mm: orc; opt: speed; options: -d:release
178457 lines; 8.703s; 651.383MiB peakmem

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Importing os module for use in macros fails when compiling for platform that doesn't support os
2 participants