Skip to content

added TokenList constructors with modern buffer wrappers and hide "unsafe" ones - if available - #496

Merged
firewave merged 6 commits into
cppcheck-opensource:masterfrom
firewave:unsafe-api
Aug 29, 2025
Merged

added TokenList constructors with modern buffer wrappers and hide "unsafe" ones - if available#496
firewave merged 6 commits into
cppcheck-opensource:masterfrom
firewave:unsafe-api

Conversation

@firewave

Copy link
Copy Markdown
Collaborator

No description provided.

@firewave

Copy link
Copy Markdown
CollaboratorAuthor

Supersedes #377.

@firewavefirewave changed the title provide safe API for TokenListonly provide "safe" API for TokenList out-of-the-boxAug 15, 2025
@firewavefirewave changed the title only provide "safe" API for TokenList out-of-the-boxmake it possible to hide "unsafe" TokenList APIAug 15, 2025
@firewave
firewaveforce-pushed the unsafe-api branch 4 times, most recently from 333f2dd to 8313678CompareAugust 15, 2025 15:13
@firewavefirewave changed the title make it possible to hide "unsafe" TokenList APIadded TokenList constructor with modern buffer wrappers and made it possible to hide "unsafe" onesAug 15, 2025
@firewave
firewaveforce-pushed the unsafe-api branch 7 times, most recently from 4229d04 to ea3a026CompareAugust 15, 2025 21:56
@firewave

Copy link
Copy Markdown
CollaboratorAuthor

This came up in a discussion in cppcheck-opensource/cppcheck#6379.

@firewave

Copy link
Copy Markdown
CollaboratorAuthor

The added test is only to make sure it compiles. I will leverage #261 so it will actually be used for the input.

@firewave
firewaveforce-pushed the unsafe-api branch 2 times, most recently from ddc8da8 to ae24823CompareAugust 19, 2025 07:33
@firewave

firewave commented Aug 19, 2025

Copy link
Copy Markdown
CollaboratorAuthor

Not sure about the SIMPLECPP_UNSAFE_API name. The new constructors are just use modern wrappers and the user can still misuse them like the existing ones. Maybe SIMPLECPP_ENABLE_PTR_CTORS?

@firewave

Copy link
Copy Markdown
CollaboratorAuthor

We could also add an overload with std::vector<char> so there's also a safer alternative for older standards.

@firewave
firewave marked this pull request as ready for review August 21, 2025 12:46
@firewave

Copy link
Copy Markdown
CollaboratorAuthor

Not sure about the SIMPLECPP_UNSAFE_API name. The new constructors are just use modern wrappers and the user can still misuse them like the existing ones. Maybe SIMPLECPP_ENABLE_PTR_CTORS?

Or SIMPLECPP_LEGACY_API?

@firewave

Copy link
Copy Markdown
CollaboratorAuthor

I renamed the define to SIMPLECPP_TOKENLIST_ALLOW_PTR.

@firewavefirewave changed the title added TokenList constructor with modern buffer wrappers and made it possible to hide "unsafe" onesadded TokenList constructors with modern buffer wrappers and made it possible to hide "unsafe" onesAug 29, 2025
@firewavefirewave changed the title added TokenList constructors with modern buffer wrappers and made it possible to hide "unsafe" onesadded TokenList constructors with modern buffer wrappers and hide "unsafe" ones - if availableAug 29, 2025
Comment threadsimplecpp.h
@firewave
firewave merged commit 4056cd5 into cppcheck-opensource:masterAug 29, 2025
13 checks passed
@firewave
firewave deleted the unsafe-api branch August 29, 2025 11:59
Sign up for freeto 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

@firewave@danmar