Skip to content

implemented the __builtin_va_list type #140

Merged
windelbouwman merged 3 commits into
windelbouwman:masterfrom
LukeGrainwalker:builtinvalist
Jul 31, 2025
Merged

implemented the __builtin_va_list type #140
windelbouwman merged 3 commits into
windelbouwman:masterfrom
LukeGrainwalker:builtinvalist

Conversation

@LukeGrainwalker

Copy link
Copy Markdown
Contributor

The __builtin_va_list type was previously just a int*. Now it is its own type (generic pointer). The unit tests pass.

Comment thread librt/libc/include/stddef.h Outdated
typedef int wchar_t;
typedef unsigned int size_t;
typedef int ssize_t;
//typedef int ssize_t;

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

this should probably not be taken into effect.


typedef int* va_list;
//typedef int* va_list;
typedef __builtin_va_list va_list;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Internally it is now assumed that va_list is an int pointer. Can we solve support for __builtin_va_list differently? Maybe as a pre-processor define resolving to int*? What would make this simpler. Where is __builtin_va_list used in musl? Maybe there is a pre-processor hook there as well?

@LukeGrainwalker LukeGrainwalker Jul 31, 2025

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This confuses me wasn't va_list before an int pointer. The current implementation of __builtin__va__* in ppci is forcing a pointer to int upon whatever variable it uses as va_list. The best implementation would be, as i did, to implement va_list as its own type which is __builtin__va__list, as you can see i have removed the line 4. which makes va_list a type __builtin_va_list and not an int pointer.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Cool approach! Never thought of it, thanks!

@windelbouwman
windelbouwman merged commit 43013a9 into windelbouwman:master Jul 31, 2025
11 checks passed
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.

2 participants