mailing list of musl libc
 help / color / mirror / code / Atom feed
* swap two macro tests to avoid warning
@ 2016-08-11 17:34 Zhao, Weiming
  2016-08-11 18:37 ` Rich Felker
  0 siblings, 1 reply; 3+ messages in thread
From: Zhao, Weiming @ 2016-08-11 17:34 UTC (permalink / raw)
  To: musl

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



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: swap two macro tests to avoid warning
  2016-08-11 17:34 swap two macro tests to avoid warning Zhao, Weiming
@ 2016-08-11 18:37 ` Rich Felker
  2016-08-11 23:13   ` Zhao, Weiming
  0 siblings, 1 reply; 3+ messages in thread
From: Rich Felker @ 2016-08-11 18:37 UTC (permalink / raw)
  To: musl

On Thu, Aug 11, 2016 at 10:34:40AM -0700, Zhao, Weiming wrote:
> HI,
> 
> When I use MUSL in some C++ project building, I got the warning of
> '__STDC_VERSION__' is not defined

As before, if you're getting warnings from the system headers I think
there's something wrong with how you have musl and/or your toolchain
installed. Can you provide some details on how this is happening?

Rich


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: swap two macro tests to avoid warning
  2016-08-11 18:37 ` Rich Felker
@ 2016-08-11 23:13   ` Zhao, Weiming
  0 siblings, 0 replies; 3+ messages in thread
From: Zhao, Weiming @ 2016-08-11 23:13 UTC (permalink / raw)
  To: musl

Thanks Rich.

You're right. I need to use -isystem.


Thanks,

Weiming


On 8/11/2016 11:37 AM, Rich Felker wrote:
> On Thu, Aug 11, 2016 at 10:34:40AM -0700, Zhao, Weiming wrote:
>> HI,
>>
>> When I use MUSL in some C++ project building, I got the warning of
>> '__STDC_VERSION__' is not defined
> As before, if you're getting warnings from the system headers I think
> there's something wrong with how you have musl and/or your toolchain
> installed. Can you provide some details on how this is happening?
>
> Rich

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-08-11 23:13 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-11 17:34 swap two macro tests to avoid warning Zhao, Weiming
2016-08-11 18:37 ` Rich Felker
2016-08-11 23:13   ` Zhao, Weiming

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).