hsutter / cppfront

A personal experimental C++ Syntax 2 -> Syntax 1 compiler
Other
5.24k stars 224 forks source link

Fixes for arm-none-eabi-g++ #1045

Closed matgla closed 1 month ago

matgla commented 3 months ago

Typeid cannot be used when -fno-rtti is used. Fixed compilation of generated sources on arm-none-eabi-g++ 13.1.

matgla commented 3 months ago

Hi, I just wanted to raise issue that fix is necessary for -fno-rtti + -fno-exception builds. Usage of __PRETTY_FUNCTION and MSVC FUNCSIG__ is a little bit hacky I think, so maybe it's better to print just exception without type.

arm-none-eabi-g++ also fails on std::string to const char* conversion.

Gotbolt link with example usage compile time type_name : https://godbolt.org/z/75fnc5Krq

Real use example: 09:47:22.2417 [INFO] uart0: [host: 81.23ms (+1.83ms)|virt: 0.2ms (+0.2ms)] Type safety violation: Throw exception (-fno-exception) with type "std::error_condition&&" and the message "'fopen' attempt failed"

hsutter commented 1 month ago

Thanks! That's quite cute.

It looks like this may be your first contribution to cppfront. I've sent the Contributor License Agreement (CLA) to your email, and once it's signed I can look in more detail at your pull request. Thanks again for your contribution.

hsutter commented 1 month ago

Looks, good, thanks!