cppcheck icon indicating copy to clipboard operation
cppcheck copied to clipboard

Dont check message on tests since this fails on newer libc++

Open pfultz2 opened this issue 6 months ago • 3 comments

pfultz2 avatar Jul 08 '25 16:07 pfultz2

Which libc++ on which system is failing? I am using LLVM 20 and 21 locally and so far the tests passed.

The problem with not checking the actual messages is that it might throw the same type but for the wrong reasons.

firewave avatar Jul 09 '25 09:07 firewave

Which libc++ on which system is failing? I am using LLVM 20 and 21 locally and so far the tests passed.

I am using apple clang version 16, but the libc++ version is 18.1 so this fails.

The problem with not checking the actual messages is that it might throw the same type but for the wrong reasons.

Then why doesnt it use a different type? Checking messages seems very fragile.

Also, why dont we use std::stod or std::strtod instead for these functions?

pfultz2 avatar Jul 09 '25 13:07 pfultz2

I am using apple clang version 16, but the libc++ version is 18.1 so this fails.

I was afraid that there might be a discrepancy between those. I tested the CI with the various available versions to check the proper value. But is is weird that it depends on the compiler version and not the standard library version. So that probably needs to add a check for __clang_major__.

Then why doesnt it use a different type? Checking messages seems very fragile.

Because we would need that type for the tests only. And I do not like to have test-only code in the application code. And do you really want to pile on more on the mess which is the exception handling within the analysis?

Also, why dont we use std::stod or std::strtod instead for these functions?

These different messages are coming from exactly those functions - which we only call with libc++ because std::istringstream is broken in it. Otherwise there would be no such hacks at all.

firewave avatar Jul 09 '25 13:07 firewave