mirror of
https://github.com/justinian/jsix.git
synced 2025-12-10 08:24:32 -08:00
[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:
@@ -1,7 +1,7 @@
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
noreturn void
|
void
|
||||||
__assert_fail( const char *, const char *, unsigned, const char * )
|
__assert_fail( const char *, const char *, unsigned, const char * )
|
||||||
{
|
{
|
||||||
// TODO: display message
|
// TODO: display message
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ extern "C" {
|
|||||||
#define assert( argument ) ( (void) 0 )
|
#define assert( argument ) ( (void) 0 )
|
||||||
#else
|
#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 ) \
|
#define assert( argument ) \
|
||||||
do { if (!(argument)) { __assert_fail( #argument, __FILE__, __LINE__, __func__ ); }} while(0)
|
do { if (!(argument)) { __assert_fail( #argument, __FILE__, __LINE__, __func__ ); }} while(0)
|
||||||
|
|||||||
@@ -10,10 +10,8 @@
|
|||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#if !defined(__cplusplus) && __STDC_VERSION__ >= 201103L
|
||||||
#define noreturn [[noreturn]]
|
|
||||||
#elif __STDC_VERSION__ >= 201103L
|
|
||||||
#define noreturn _Noreturn
|
#define noreturn _Noreturn
|
||||||
#else
|
#elif !defined(__cplusplus)
|
||||||
#define noreturn
|
#define noreturn
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user