[libc] Fix noreturn c++ compatibility

Stop using bare "noreturn" with library functions, and use the more
cross-compatible "_Noreturn" instead.
This commit is contained in:
Justin C. Miller
2022-02-09 18:49:16 -08:00
parent 4e3ba66b0c
commit 57b2d6dbd8
3 changed files with 4 additions and 6 deletions

View File

@@ -1,7 +1,7 @@
#include <assert.h>
#include <stdlib.h>
noreturn void
void
__assert_fail( const char *, const char *, unsigned, const char * )
{
// TODO: display message

View File

@@ -20,7 +20,7 @@ extern "C" {
#define assert( argument ) ( (void) 0 )
#else
noreturn void __assert_fail( const char *, const char *, unsigned, const char * );
_Noreturn void __assert_fail( const char *, const char *, unsigned, const char * );
#define assert( argument ) \
do { if (!(argument)) { __assert_fail( #argument, __FILE__, __LINE__, __func__ ); }} while(0)

View File

@@ -10,10 +10,8 @@
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
*/
#ifdef __cplusplus
#define noreturn [[noreturn]]
#elif __STDC_VERSION__ >= 201103L
#if !defined(__cplusplus) && __STDC_VERSION__ >= 201103L
#define noreturn _Noreturn
#else
#elif !defined(__cplusplus)
#define noreturn
#endif