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

Don't allow to define reserved flags via Compiler.define #8690

Conversation

RealyUniqueName
Copy link
Member

Fixes #8689
Shouldn't be merged yet because it will break hxnodejs, which defines its flags via Compiler.define():
https://github.com/HaxeFoundation/hxnodejs/blob/2587ccbffa3cc032d7ecca28d299e7357993f536/extraParams.hxml#L1-L3

@RealyUniqueName RealyUniqueName added this to the Backlog milestone Aug 23, 2019
@Gama11
Copy link
Member

Gama11 commented Aug 23, 2019

But hxnodejs doesn't define any reserved flags?

@RealyUniqueName
Copy link
Member Author

sys is reserved

@Gama11
Copy link
Member

Gama11 commented Aug 23, 2019

But it's not being defined yet (HaxeFoundation/hxnodejs#59). That's allowPackage() there. :)

@RealyUniqueName
Copy link
Member Author

Oh, right. Then it's safe to merge )

@RealyUniqueName RealyUniqueName modified the milestones: Backlog, Release 4.0 Aug 23, 2019
@RealyUniqueName
Copy link
Member Author

Still can't merge this becaus of this:

haxe/extra/ImportAll.hx

Lines 37 to 39 in f9733e7

if (Context.defined("interp")) {
haxe.macro.Compiler.define("macro");
}

@RealyUniqueName RealyUniqueName modified the milestones: Release 4.0, Bugs Aug 23, 2019
@skial skial mentioned this pull request Aug 26, 2019
1 task
@RealyUniqueName RealyUniqueName modified the milestones: Bugs, Release 4.1 Aug 26, 2019
@Simn
Copy link
Member

Simn commented Feb 17, 2020

Ultimately the problem is that documentation generation conflates macro and interp. We should treat these as separate targets because a portion of the API is not available in interp-mode (many things in haxe.macro) while another portion is not (really) available in macros (sys.thread).

We can hack around this problem first by moving that macro define into the compiler. That should allow us to merge this PR.

@RealyUniqueName RealyUniqueName modified the milestones: Release 4.2, Backlog Dec 16, 2020
tobil4sk added a commit to tobil4sk/haxec that referenced this pull request Sep 11, 2021
- Error for `-D haxe-ver` solved more generally
  - Add temporary function to be removed for HaxeFoundation#8690
- Minor refactoring
tobil4sk added a commit to tobil4sk/haxec that referenced this pull request Sep 11, 2021
- Error for `-D haxe-ver` solved more generally
  - Add temporary function to be removed for HaxeFoundation#8690
- Minor refactoring
RealyUniqueName pushed a commit that referenced this pull request Oct 12, 2021
* Fix inconsistency between - and _ in define.json

* Remove unnecessary dash conversion

define.json now already provides them with dashes so this manual
conversion is no longer necessary.

* Move `source-header` default value setting

* Split function with bool parameter

* Fix missing error when doing `-D haxe-ver`

* Use underscore defines internally

Move all define conversions to interfaces, and internally a flag is
represented using the underscore version only.

This prevents duplicate defines appearing in a bunch of places, and now
there are no longer tiny differences in the effects of `-D flag-a` and
`-D flag_a`. Same is true for macro functions for accessing defines.

* Use existing functions for accessing defines

* Remove duplicate definition of the `flash` define

This is already done for every target in `Common.init_platform`.

* Update documentation for `net-ver` compiler flag

* Remove `dump_context` made redundant in bef481f

* Clean up define outputs

All internal outputs of defines are now in alphabetical order

* Add tests for define flag conversions

* Add tests for `-D no-deprecation-warnings`

* Add tests for `-D source-header`

* Test for duplicate defines in `hlc.json` & `Options.txt`

* [hl] Fix `-D source-header` not working with hlc (#10376)

* Add tests for `source-header` on hlc

* Clean up

- Error for `-D haxe-ver` solved more generally
  - Add temporary function to be removed for #8690
- Minor refactoring

* Fix `--help-defines`
@Simn Simn removed this from the Backlog milestone Mar 24, 2023
@Simn
Copy link
Member

Simn commented Mar 25, 2023

Given all the conflicts, the best course of action here is to close. #8689 is still open to track the original issue.

@Simn Simn closed this Mar 25, 2023
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.

[macro] apply reserved_flags / reserved_flag_namespaces checks to Compiler.define()
3 participants