Skip to content

Add va_list typedef and variadic function support #225

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

Merged
merged 1 commit into from
Aug 5, 2025
Merged

Add va_list typedef and variadic function support #225

merged 1 commit into from
Aug 5, 2025

Conversation

jserv
Copy link
Collaborator

@jserv jserv commented Aug 2, 2025

This commit adds va_list typedef for basic variadic function support and implement typedef pointer handling in parser (typedef char *string).

Close #202

Summary by Bito

This pull request introduces a new typedef for va_list to enhance variadic function support and improves pointer handling with a ptr_level field. These changes optimize type management in the parser and include comprehensive tests to validate the new features and their functionality.

@jserv jserv requested review from ChAoSUnItY and DrXiao August 2, 2025 19:15
This commit implements comprehensive support for variadic functions,
including:
- Add built-in va_list typedef (int *) for variadic argument handling
- Fix typedef pointer level preservation in parser
- Add proper array indexing support for typedef pointers
- Support pointer arithmetic with typedef pointers
- Add expression dereferencing support: *(++p)

The is_ptr field in type_t structure is used to track pointer levels for
typedef'd pointer types, not as a boolean flag. This rename makes the
field's purpose clearer and aligns with its actual usage as a counter
throughout the codebase.

This enables both traditional pointer arithmetic access to variadic
arguments and modern va_list typedef forwarding between functions.

Close #202
@jserv jserv merged commit cc0741f into master Aug 5, 2025
12 checks passed
@jserv jserv deleted the va_list branch August 5, 2025 04:45
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.

Implement va_list and related functions
2 participants