Skip to content

tp: implement regexp on Windows#171

Merged
cdamus merged 2 commits into
sokatoafrom
issue/sokatoa-5004-regexp-on-windows
Apr 13, 2026
Merged

tp: implement regexp on Windows#171
cdamus merged 2 commits into
sokatoafrom
issue/sokatoa-5004-regexp-on-windows

Conversation

@cdamus

@cdamus cdamus commented Apr 10, 2026

Copy link
Copy Markdown
Collaborator

Implement the Regex class on Windows platform also, using std::regex instead of the unsupported POSIX regex.h, rather than leaving it broken.

For android-graphics/sokatoa#5004

Implement the Regex class on Windows platform also, using std::regex
instead of the unsupported POSIX regex.h, rather than leaving it broken.

For android-graphics/sokatoa#5004

Signed-off-by: Christian W. Damus <cdamus@eclipsesource.com>
@cdamus

cdamus commented Apr 10, 2026

Copy link
Copy Markdown
Collaborator Author

Note that Perfetto upstream has done a bunch of refactoring in the Trace Processor, including what looks like a reimplementation of their regex functions on top of std::regex across the board. I doubt that it is worth trying to cherry-pick the many commits involved in that effort into our fork.

In order to use std::regex, enable exceptions in the Windows build.
This does grow trace_processor_shell.exe by about 20%, so significantly.
@dfriederich

Copy link
Copy Markdown
Collaborator

Enabled C++ exception handling in the Windows build setup, otherwise the try block did not compile.
@cdamus please feel free to cleanup, fix, improve, etc :-)

@dfriederich
dfriederich self-requested a review April 10, 2026 21:47

@dfriederich dfriederich left a comment

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.

change worked for me on Windows after also enabling exception handling in the compiler.
In my understanding, if any code was previously throwing, it was just calling std::terminate directly. Now it will throw, not catch (except in our use of std::regex), and still end up calling std::terminate. One price to pay is the grown binary size, ca 20%.

@cdamus

cdamus commented Apr 13, 2026

Copy link
Copy Markdown
Collaborator Author

Enabled C++ exception handling in the Windows build setup, otherwise the try block did not compile. @cdamus please feel free to cleanup, fix, improve, etc :-)

Looks good to me @dfriederich ! Thanks for fixing that up.

@cdamus
cdamus merged commit 3628a88 into sokatoa Apr 13, 2026
1 check passed
@cdamus
cdamus deleted the issue/sokatoa-5004-regexp-on-windows branch April 13, 2026 17:22
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