mailing list of musl libc
 help / color / mirror / code / Atom feed
* [musl] Questions on commit 98e688a9da5e7b2925dda17a2d6820dddf1fb287
@ 2022-10-28 14:20 puwenxu
  2022-10-28 15:02 ` Rich Felker
  0 siblings, 1 reply; 2+ messages in thread
From: puwenxu @ 2022-10-28 14:20 UTC (permalink / raw)
  To: musl


[-- Attachment #1.1.1: Type: text/plain, Size: 834 bytes --]

Dear maintainer,
       As you can see in the pictures, the commit 98e688a9da5e7b2925dda17a2d6820dddf1fb287 modified the codes related to macro __cpluscplus.
[cid:image005.png@01D8EB1B.83A5DFC0]
During my usage of musl, I found that if the macro __cplusplus had not been defined, the compilation will fail, and report error on __cplusplus. I am very puzzled about this commit, I think this modification doesn't take the condition that the __cplusplus hasn't been defined into consideration. I'm eager to know why.
       In order to continue my job immediately, I modify the codes like the picture below. As far as I'm concerned, before using __cpluscplus, we should judge whether it has been defined. Attached is my full patch.
[cid:image006.png@01D8EB1B.83A5DFC0]
I'm looking forward to your reply.

Wish Pu
OS kernel lab

[-- Attachment #1.1.2: Type: text/html, Size: 4358 bytes --]

[-- Attachment #1.2: image005.png --]
[-- Type: image/png, Size: 168625 bytes --]

[-- Attachment #1.3: image006.png --]
[-- Type: image/png, Size: 232707 bytes --]

[-- Attachment #2: 0001-musl-Upgrade-musl.patch --]
[-- Type: application/octet-stream, Size: 3357 bytes --]

From debcca71d9c19481abdb54b58b4e4de70e6c2cd0 Mon Sep 17 00:00:00 2001
From: p00670060 <puwenxu1@huawei.com>
Date: Fri, 28 Oct 2022 12:08:07 +0800
Subject: [PATCH] musl: Upgrade musl

HongMeng inclusion
DTS/AR: AR.SR.IREQ02850018.001.002
TestPolicyOwner: Wu Wenguo <wuwenguo@huawei.com>
CVE: NA
TestCase: This is a commit no need test

--------

Signed-off-by: Pu Wenxu <puwenxu1@huawei.com>
---
 include/locale.h | 2 +-
 include/stddef.h | 2 +-
 include/stdio.h  | 2 +-
 include/stdlib.h | 2 +-
 include/string.h | 2 +-
 include/time.h   | 2 +-
 include/unistd.h | 2 +-
 include/wchar.h  | 2 +-
 8 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/include/locale.h b/include/locale.h
index 959d0605..9b1b3054 100644
--- a/include/locale.h
+++ b/include/locale.h
@@ -8,7 +8,7 @@ extern "C" {
 #include <features.h>
 
 #ifndef NULL
-#if __cplusplus >= 201103L
+#if defined(__cplusplus) &&  __cplusplus >= 201103L
 #define NULL nullptr
 #elif defined(__cplusplus)
 #define NULL 0L
diff --git a/include/stddef.h b/include/stddef.h
index 7aeed3f7..30876221 100644
--- a/include/stddef.h
+++ b/include/stddef.h
@@ -2,7 +2,7 @@
 #define _STDDEF_H
 
 #ifndef NULL
-#if __cplusplus >= 201103L
+#if defined(__cplusplus) && __cplusplus >= 201103L
 #define NULL nullptr
 #elif defined(__cplusplus)
 #define NULL 0L
diff --git a/include/stdio.h b/include/stdio.h
index cf0980c8..fc761038 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -26,7 +26,7 @@ extern "C" {
 #include <bits/alltypes.h>
 
 #ifndef NULL
-#if __cplusplus >= 201103L
+#if defined(__cplusplus) && __cplusplus >= 201103L
 #define NULL nullptr
 #elif defined(__cplusplus)
 #define NULL 0L
diff --git a/include/stdlib.h b/include/stdlib.h
index 3fc5f58d..f50dee40 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -8,7 +8,7 @@ extern "C" {
 #include <features.h>
 
 #ifndef NULL
-#if __cplusplus >= 201103L
+#if defined(__cplusplus) && __cplusplus >= 201103L
 #define NULL nullptr
 #elif defined(__cplusplus)
 #define NULL 0L
diff --git a/include/string.h b/include/string.h
index 0f0ef4b4..0701d728 100644
--- a/include/string.h
+++ b/include/string.h
@@ -8,7 +8,7 @@ extern "C" {
 #include <features.h>
 
 #ifndef NULL
-#if __cplusplus >= 201103L
+#if defined(__cplusplus) && __cplusplus >= 201103L
 #define NULL nullptr
 #elif defined(__cplusplus)
 #define NULL 0L
diff --git a/include/time.h b/include/time.h
index a76a3962..d08f568a 100644
--- a/include/time.h
+++ b/include/time.h
@@ -8,7 +8,7 @@ extern "C" {
 #include <features.h>
 
 #ifndef NULL
-#if __cplusplus >= 201103L
+#if defined(__cplusplus) && __cplusplus >= 201103L
 #define NULL nullptr
 #elif defined(__cplusplus)
 #define NULL 0L
diff --git a/include/unistd.h b/include/unistd.h
index 25016c64..53099349 100755
--- a/include/unistd.h
+++ b/include/unistd.h
@@ -18,7 +18,7 @@ extern "C" {
 #define SEEK_HOLE 4
 
 #ifndef NULL
-#if __cplusplus >= 201103L
+#if defined(__cplusplus) && __cplusplus >= 201103L
 #define NULL nullptr
 #elif defined(__cplusplus)
 #define NULL 0L
diff --git a/include/wchar.h b/include/wchar.h
index 31aa7d1d..115993d1 100644
--- a/include/wchar.h
+++ b/include/wchar.h
@@ -39,7 +39,7 @@ extern "C" {
 #endif
 
 #ifndef NULL
-#if __cplusplus >= 201103L
+#if defined(__cplusplus) && __cplusplus >= 201103L
 #define NULL nullptr
 #elif defined(__cplusplus)
 #define NULL 0L
-- 
2.22.0


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

end of thread, other threads:[~2022-10-28 15:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-28 14:20 [musl] Questions on commit 98e688a9da5e7b2925dda17a2d6820dddf1fb287 puwenxu
2022-10-28 15:02 ` Rich Felker

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).