compile-time-regular-expressions
compile-time-regular-expressions copied to clipboard
Infinite compile time in Release mode with MSVC
Not a CTRE issue but a compiler one that may be interesting for you to follow: https://developercommunity.visualstudio.com/content/problem/1107230/msvc-version-1670-preview-31-release-build-never-completes-ran-for-12-hours-debug-build-takes-seconds.html
TLDR: With a long regex, Release build with latest MSVC and CTRE 2.8.3 never completes.
Ran into this trying to deal with the bad optional pattern https://github.com/hanickadot/compile-time-regular-expressions/issues/109
When optional was separate struct I removed forceinline and that pretty much reduced the compile time to nothing, something's definitely a bit off w/ the MSVC compiler though.
I guess this is a duplicate of #91, but unfortunately links in that issue are now wrong - azure removed the old logs.
The regex that I had tried was this:
R"(^([^\t\n\r]++)\t([^\t\n\r]++)\t.*?" "language:([^\t\n\r]++).*?$)";
I'm working on a big refactoring of loops, which will remove a long standing bug and will work differently, hopefully better :)
I realize this is a known issue, and I read some of the previous posts. I guess it has something to do with forced_inline. I am just posting that I also experienced this issue. I saw that disabling the inline optimizations should help. So I'm adding this to my CMakeLists.txt
for the app that uses ctre. This works fine in my case. It's just a little app.
if (MSVC)
target_compile_options(${PROJECT_NAME}_tile_csv_to_map
PRIVATE /Ob0)
endif ()
https://docs.microsoft.com/en-us/cpp/build/reference/ob-inline-function-expansion?view=msvc-160
Here's the regular expressions I'm using.
(\.([1-3])\.[cC][sS][vV])
(\d+),"?0x([0-9A-F]+)"?,(\d+),(\d+),"?([A-Za-z ]+)"?,(\d+),(\d+),(\d+),(\d+),(\d+),(\d+),(\d+),(\d+),(-?\d+),(-?\d+),(\d+)
This issue is solved by more recent MSVC versions (17.3+)