mailing list of musl libc
 help / color / mirror / code / Atom feed
From: puwenxu <puwenxu1@huawei.com>
To: "musl@lists.openwall.com" <musl@lists.openwall.com>
Subject: [musl] Questions on commit 98e688a9da5e7b2925dda17a2d6820dddf1fb287
Date: Fri, 28 Oct 2022 14:20:50 +0000	[thread overview]
Message-ID: <e5ac7a212c514302b3cc6655f15e628b@huawei.com> (raw)


[-- 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


             reply	other threads:[~2022-10-28 14:31 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-28 14:20 puwenxu [this message]
2022-10-28 15:02 ` Rich Felker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e5ac7a212c514302b3cc6655f15e628b@huawei.com \
    --to=puwenxu1@huawei.com \
    --cc=musl@lists.openwall.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).