Hi,

I fixed two kinds of Clang warnings in uclibc-ng (see patches attached). Is that something you would be willing to include?

Best regards,
Marius

--
Marius Melzer, marius.mel...@kernkonzept.com

Kernkonzept GmbH, Dresden, Germany, HRB 31129, CEO Dr.-Ing. Michael Hohmuth
From b251126f8d718ba4035140223518ba91a3434b2a Mon Sep 17 00:00:00 2001
From: Marius Melzer <marius.mel...@kernkonzept.com>
Date: Wed, 20 Dec 2023 13:36:18 +0100
Subject: [PATCH 2/2] Fix -Wnon-literal-null-conversion clang warning

Clang warns that the NULL character literal '\0' is used as a pointer
value. Change this to 0 in order to avoid the warning.
---
 libc/inet/resolv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libc/inet/resolv.c b/libc/inet/resolv.c
index cda3b399a..2f627ca08 100644
--- a/libc/inet/resolv.c
+++ b/libc/inet/resolv.c
@@ -1778,7 +1778,7 @@ int __read_etc_hosts_r(
 found:
 		result_buf->h_name = *(result_buf->h_aliases++);
 		result_buf->h_addr_list = (char**)(buf + HALISTOFF);
-		*(result_buf->h_addr_list + 1) = '\0';
+		*(result_buf->h_addr_list + 1) = 0;
 		h_addr0 = (struct in_addr*)(buf + INADDROFF);
 		result_buf->h_addr = (char*)h_addr0;
 		if (0) /* nothing */;
-- 
2.43.0

From 31f2f58ed426e9f76f745f1d0656b65662025d0c Mon Sep 17 00:00:00 2001
From: Marius Melzer <marius.mel...@kernkonzept.com>
Date: Wed, 20 Dec 2023 13:31:47 +0100
Subject: [PATCH 1/2] Fix -Wgnu-designator clang warnings

Clang warns about the use of old GNU-style designators. To avoid this,
use the C99 designators instead.
---
 libc/stdlib/random.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/libc/stdlib/random.c b/libc/stdlib/random.c
index b009c4310..05ce3fe84 100644
--- a/libc/stdlib/random.c
+++ b/libc/stdlib/random.c
@@ -139,8 +139,8 @@ static struct random_data unsafe_state =
        in the initialization of randtbl) because the state table pointer is set
        to point to randtbl[1] (as explained below).)  */
 
-    fptr : &randtbl[SEP_3 + 1],
-    rptr : &randtbl[1],
+    .fptr = &randtbl[SEP_3 + 1],
+    .rptr = &randtbl[1],
 
     /* The following things are the pointer to the state information table,
        the type of the current generator, the degree of the current polynomial
@@ -152,13 +152,13 @@ static struct random_data unsafe_state =
        indexing every time to find the address of the last element to see if
        the front and rear pointers have wrapped.  */
 
-    state : &randtbl[1],
+    .state = &randtbl[1],
 
-    rand_type : TYPE_3,
-    rand_deg : DEG_3,
-    rand_sep : SEP_3,
+    .rand_type = TYPE_3,
+    .rand_deg = DEG_3,
+    .rand_sep = SEP_3,
 
-    end_ptr : &randtbl[sizeof (randtbl) / sizeof (randtbl[0])]
+    .end_ptr = &randtbl[sizeof (randtbl) / sizeof (randtbl[0])]
 };
 
 
-- 
2.43.0

_______________________________________________
devel mailing list -- devel@uclibc-ng.org
To unsubscribe send an email to devel-le...@uclibc-ng.org

Reply via email to