Open thrimbor opened 3 years ago
I will make this change for now. I will have to think a bit about any effects that might arise from the PDCLib code being compiled with _Noreturn
(or nothing at all), but then used with [[noreturn]]
...
Should be closed by https://github.com/DevSolar/pdclib/commit/068f3b5a108c0d5d994fb488dec6cb69d140ba59 and https://github.com/DevSolar/pdclib/commit/13217c52ef338207e7b08f2866aca4c10ae05c74; please verify and close the issue.
I will keep this open until I have had a good look at the implications of mixing _Noreturn and [[noreturn]], and at other instances of __STDC_VERSION__ use. The immediate issue is resolved though.
In nxdk, we have been getting warnings when building libc++ about functions marked as
noreturn
supposedly returning. I have tracked this down to the functionabort
, which wasn't marked asnoreturn
when building C++ code. This is caused by the preprocessor code in_PDCLIB_internal.h
(or_PDCLIB_aux.h
in our case, we haven't rebased in a while), which relies on__STDC_VERSION__
. Unfortunately,__STDC_VERSION__
is not defined in C++.This is the problematic part:
I checked how the compiler handles this, and it evaluates the
__STDC_VERSION__ < 201112L
condition to true, thereby not marking the functions as noreturn despite the compiler supporting it.I replaced it with the following code, which fixes the warnings mentioned above:
There are other uses of
__STD_VERSION__
in PDCLib that might need similar treatment.