|
Message-ID: <b7f79af8-3861-3738-0459-9c5a7faabc29@codeaurora.org> Date: Thu, 11 Aug 2016 10:34:40 -0700 From: "Zhao, Weiming" <weimingz@...eaurora.org> To: musl@...ts.openwall.com Subject: swap two macro tests to avoid warning HI, When I use MUSL in some C++ project building, I got the warning of '__STDC_VERSION__' is not defined How about we first check if __cplusplus is defined? if yes, the the __STD_VERSION__ test will be short circuited and won't trigger the warning. diff --git a/include/assert.h b/include/assert.h index 8571f21..9d7a05b 100644 --- a/include/assert.h +++ b/include/assert.h @@ -12,7 +12,7 @@ #endif #endif -#if __STDC_VERSION__ >= 201112L && !defined(__cplusplus) +#if !defined(__cplusplus) && __STDC_VERSION__ >= 201112L #define static_assert _Static_assert #endif diff --git a/include/features.h b/include/features.h index 3cc3e57..64671b3 100644 --- a/include/features.h +++ b/include/features.h @@ -16,21 +16,27 @@ #define _XOPEN_SOURCE 700 #endif +#ifndef __cplusplus #if __STDC_VERSION__ >= 199901L #define __restrict restrict #elif !defined(__GNUC__) #define __restrict #endif +#endif -#if __STDC_VERSION__ >= 199901L || defined(__cplusplus) +#if defined(__cplusplus) || __STDC_VERSION__ >= 199901L #define __inline inline #endif +#ifdef __cplusplus +#define _Noreturn [[noreturn]] +#else #if __STDC_VERSION__ >= 201112L #elif defined(__GNUC__) #define _Noreturn __attribute__((__noreturn__)) #else #define _Noreturn #endif +#endif #endif Thanks, Weiming -- Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.