Skip to content

cgen: remove more things from c_reserved #26241

@dy-tea

Description

@dy-tea

Describe the feature

This list of keywords is defined in vlib/v/gen/c/cgen.v.

Since we prefix the builtin functions with builtin__, many of these keywords should not appear in generated C code.

Use Case

This will both simplify cgen and make some bugs less likely. I was encountering an issue where I wanted to get a field link from a struct in comptime but link was being replaced with __v_link, meaning invalid C code was generated. For link specifically I could not find where this was reserved unlike some of the reserved words defined by microsoft in headers or similar.

Proposed Solution

Ascertain which keywords may still be needed and remove the rest.

Other Information

No response

Acknowledgements

  • I may be able to implement this feature request
  • This feature might incur a breaking change

Version used

V 0.5.0 a3fd7f3

Environment details (OS name and version, etc.)

V full version V 0.5.0 ba97785.a3fd7f3
OS linux, "CachyOS"
Processor 12 cpus, 64bit, little endian, 13th Gen Intel(R) Core(TM) i5-1335U
Memory 5.26GB/15.31GB
V executable /home/dylan/Repos/v/v
V last modified time 2025-12-31 22:26:05
V home dir OK, value: /home/dylan/Repos/v
VMODULES OK, value: /home/dylan/.vmodules
VTMP OK, value: /tmp/v_1000
Current working dir OK, value: /home/dylan
Git version git version 2.52.0
V git status 0.5-1-ga3fd7f39
.git/config present true
cc version cc (GCC) 15.2.1 20251112
gcc version gcc (GCC) 15.2.1 20251112
clang version clang version 21.1.6
tcc version tcc version 0.9.28rc 2025-02-13 HEAD@f8bd136d (x86_64 Linux)
tcc git status thirdparty-linux-amd64 696c1d84
emcc version N/A
glibc version ldd (GNU libc) 2.42

Note

You can use the 👍 reaction to increase the issue's priority for developers.

Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Unit: cgenBugs/feature requests, that are related to the default C generating backend.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions