Skip to content

native: preprocessed vars like EOF#24724

Merged
spytheman merged 2 commits into
vlang:masterfrom
Eliyaan:preprocessed
Jun 15, 2025
Merged

native: preprocessed vars like EOF#24724
spytheman merged 2 commits into
vlang:masterfrom
Eliyaan:preprocessed

Conversation

@Eliyaan

@Eliyaan Eliyaan commented Jun 15, 2025

Copy link
Copy Markdown
Member

Add support for variables like EOF

Comment thread vlib/v/gen/native/tests/linux.vv
Comment thread vlib/v/gen/native/gen.v
import strconv

const c_preprocessed = {
'C.EOF': -1

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

hardcoding this does not seem scalable to me, is it just temporary?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Until we are able to parse macros I do not see another way

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

the map will be easily replaceable once we are able to get the macros

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Yes, hard-coding (whether done manually, or with c2v) is the only way to handle this without adding a C preprocessor to V.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

So yes it is temporary

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can you add a TODO note for this? It would help in future.

@spytheman spytheman merged commit 959c11b into vlang:master Jun 15, 2025
66 checks passed
@Eliyaan Eliyaan deleted the preprocessed branch October 13, 2025 18:24
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.

4 participants