Unifex with fno exceptions#673
Conversation
b4b7dde to
7d27ebb
Compare
|
Would you mind running |
I did! I mean my IDE configured to automatically format on save. But it makes a lot of changes. I discarded most of them and tried to format manually only that I really intend to change. I'm using clang-format version 21.1.6 |
7d27ebb to
784dc22
Compare
784dc22 to
f96b2b7
Compare
MaxMotovilov
left a comment
There was a problem hiding this comment.
There are some apparently spurious changes in the code that need an explanation; also it is not at all clear how sync_wait() is expected to support set_error() completion.
| }; | ||
| } // namespace _schedule | ||
| inline constexpr _schedule::_fn schedule{}; | ||
| inline const _schedule::_fn schedule{}; |
There was a problem hiding this comment.
This is a pretty major change - what was the reason behind it?
There was a problem hiding this comment.
Because there is mismatched declaration with detail/unifex_fwd.hpp:76.
I checked other declarations like connect and start and all of it go with inline const.
Btw. I suppose it throws error only on my machine.
I use clang 21.1.6, and gcc 15.2.1.
There was a problem hiding this comment.
Any chance you could demonstrate this in a godbolt? Simply including both headers does not currently trigger it w/21.1 and 15.2 respectively although your updated versions could be more recent.
If that's not possible, could you paste the error from your run?
There was a problem hiding this comment.
I was wrong! It's neither clang nor gcc. It was msvc with /std:c++17.
The error message looks like:
[1/229] Building CXX object source\CMakeFiles\unifex.dir\async_manual_reset_event.cpp.obj
FAILED: source/CMakeFiles/unifex.dir/async_manual_reset_event.cpp.obj
C:\PROGRA~1\MICROS~2\2022\COMMUN~1\VC\Tools\MSVC\1444~1.352\bin\Hostx64\x64\cl.exe /nologo /TP -IC:\projects\libunifex\include -IC:\projects\libunifex\out\build\x64-Debug\include /DWIN32 /D_WINDOWS /W3 /GR /EHsc /MDd /Zi /Ob0 /Od /RTC1 -std:c++17 /W3 /WX /bigobj /showIncludes /Fosource\CMakeFiles\unifex.dir\async_manual_reset_event.cpp.obj /Fdsource\CMakeFiles\unifex.dir\unifex.pdb /FS -c C:\projects\libunifex\source\async_manual_reset_event.cpp
C:\projects\libunifex\include\unifex\scheduler_concepts.hpp(192): error C2370: 'unifex::schedule': redefinition; different storage class
C:\projects\libunifex\include\unifex/detail/unifex_fwd.hpp(76): note: see declaration of 'unifex::schedule'
[2/229] Building CXX object source\CMakeFiles\unifex.dir\async_auto_reset_event.cpp.obj
FAILED: source/CMakeFiles/unifex.dir/async_auto_reset_event.cpp.obj
C:\PROGRA~1\MICROS~2\2022\COMMUN~1\VC\Tools\MSVC\1444~1.352\bin\Hostx64\x64\cl.exe /nologo /TP -IC:\projects\libunifex\include -IC:\projects\libunifex\out\build\x64-Debug\include /DWIN32 /D_WINDOWS /W3 /GR /EHsc /MDd /Zi /Ob0 /Od /RTC1 -std:c++17 /W3 /WX /bigobj /showIncludes /Fosource\CMakeFiles\unifex.dir\async_auto_reset_event.cpp.obj /Fdsource\CMakeFiles\unifex.dir\unifex.pdb /FS -c C:\projects\libunifex\source\async_auto_reset_event.cpp
C:\projects\libunifex\include\unifex\scheduler_concepts.hpp(192): error C2370: 'unifex::schedule': redefinition; different storage class
C:\projects\libunifex\include\unifex/detail/unifex_fwd.hpp(76): note: see declaration of 'unifex::schedule'
[3/229] Building CXX object googletest-build\googletest\CMakeFiles\gtest.dir\src\gtest-all.cc.obj
C:\projects\libunifex\out\build\x64-Debug\cl : Command line warning D9025: overriding '/W4' with '/W3'
ninja: build stopped: subcommand failed.I can revert this change and fix it when I figured out what's wrong with building on msvc /std:c++17
Any chance you could demonstrate this in a godbolt?
For some reason I could not make an example with msvc on godbolt. https://godbolt.org/z/sb48aYav6
There was a problem hiding this comment.
BTW. With this fix msvc still fails with a ton of different errors.
|
See my new inline comments - also I think macOS clang makes an objection? https://github.com/facebookexperimental/libunifex/actions/runs/21514257277/job/62090827242?pr=673 |
I did not touch this test on this PR. And it also runs successfully on my machine and my repository. I would like to rerun this test. And maybe someone find how to fix this bug in the future. |
Add ability to build with -fno-exceptions.
In general this only fixes use
try/catchtoUNIFEX_TRY/UNIFEX_CATCHand wrap some code in#if !UNIFEX_NO_EXCEPTIONS ... #endif.Also this adds run CI testing with
-fno-exceptionsflag.This PR related to #671 but still doesn't give the answer to main question.