mailing list of musl libc
 help / color / mirror / code / Atom feed
* [musl] [C23 implied 1/2] C23: update some legacy function pointers
  2023-05-24 10:03 [musl] [C23 implied 0/2] stuff detected with the intended changes Jens Gustedt
@ 2023-04-16 20:41 ` Jens Gustedt
  2023-04-17 19:30 ` [musl] [C23 implied 2/2] clang: only exclude C library includes, but allow compiler specific headers Jens Gustedt
  1 sibling, 0 replies; 5+ messages in thread
From: Jens Gustedt @ 2023-04-16 20:41 UTC (permalink / raw)
  To: musl

In C23, empty parameter lists loose their meaning as "function that
may receive any number of parameters".

When compiling with -std=c2x, there were three left-overs in musl that
still used that. Change them to use the correct prototype, since it is
available at all these places, anyhow.
---
 src/legacy/ftw.c            | 2 +-
 src/thread/__syscall_cp.c   | 4 +++-
 src/thread/pthread_cancel.c | 8 ++++++--
 3 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/src/legacy/ftw.c b/src/legacy/ftw.c
index e757fc6f..8e9e34d7 100644
--- a/src/legacy/ftw.c
+++ b/src/legacy/ftw.c
@@ -5,5 +5,5 @@ int ftw(const char *path, int (*fn)(const char *, const struct stat *, int), int
 	/* The following cast assumes that calling a function with one
 	 * argument more than it needs behaves as expected. This is
 	 * actually undefined, but works on all real-world machines. */
-	return nftw(path, (int (*)())fn, fd_limit, FTW_PHYS);
+	return nftw(path, (int (*)(const char *, const struct stat *, int, struct FTW *))fn, fd_limit, FTW_PHYS);
 }
diff --git a/src/thread/__syscall_cp.c b/src/thread/__syscall_cp.c
index 42a01674..d0b675e2 100644
--- a/src/thread/__syscall_cp.c
+++ b/src/thread/__syscall_cp.c
@@ -1,7 +1,9 @@
 #include "pthread_impl.h"
 #include "syscall.h"
 
-hidden long __syscall_cp_c();
+hidden long __syscall_cp_c(syscall_arg_t nr,
+                 syscall_arg_t u, syscall_arg_t v, syscall_arg_t w,
+                 syscall_arg_t x, syscall_arg_t y, syscall_arg_t z);
 
 static long sccp(syscall_arg_t nr,
                  syscall_arg_t u, syscall_arg_t v, syscall_arg_t w,
diff --git a/src/thread/pthread_cancel.c b/src/thread/pthread_cancel.c
index 139a6fc8..2b8a8a76 100644
--- a/src/thread/pthread_cancel.c
+++ b/src/thread/pthread_cancel.c
@@ -3,7 +3,7 @@
 #include "pthread_impl.h"
 #include "syscall.h"
 
-hidden long __cancel(), __syscall_cp_asm(), __syscall_cp_c();
+hidden long __cancel();
 
 long __cancel()
 {
@@ -14,10 +14,14 @@ long __cancel()
 	return -ECANCELED;
 }
 
-long __syscall_cp_asm(volatile void *, syscall_arg_t,
+hidden long __syscall_cp_asm(volatile void *, syscall_arg_t,
                       syscall_arg_t, syscall_arg_t, syscall_arg_t,
                       syscall_arg_t, syscall_arg_t, syscall_arg_t);
 
+hidden long __syscall_cp_c(syscall_arg_t,
+                    syscall_arg_t, syscall_arg_t, syscall_arg_t,
+                    syscall_arg_t, syscall_arg_t, syscall_arg_t);
+
 long __syscall_cp_c(syscall_arg_t nr,
                     syscall_arg_t u, syscall_arg_t v, syscall_arg_t w,
                     syscall_arg_t x, syscall_arg_t y, syscall_arg_t z)
-- 
2.34.1

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

* [musl] [C23 implied 2/2] clang: only exclude C library includes, but allow compiler specific headers
  2023-05-24 10:03 [musl] [C23 implied 0/2] stuff detected with the intended changes Jens Gustedt
  2023-04-16 20:41 ` [musl] [C23 implied 1/2] C23: update some legacy function pointers Jens Gustedt
@ 2023-04-17 19:30 ` Jens Gustedt
  2023-05-24 13:32   ` Rich Felker
  1 sibling, 1 reply; 5+ messages in thread
From: Jens Gustedt @ 2023-04-17 19:30 UTC (permalink / raw)
  To: musl

---
 tools/musl-clang.in | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/musl-clang.in b/tools/musl-clang.in
index 623de6f6..00189322 100644
--- a/tools/musl-clang.in
+++ b/tools/musl-clang.in
@@ -24,7 +24,7 @@ exec $cc \
     -B"$thisdir" \
     -fuse-ld=musl-clang \
     -static-libgcc \
-    -nostdinc \
+    -nostdlibinc \
     --sysroot "$libc" \
     -isystem "$libc_inc" \
     -L-user-start \
-- 
2.34.1

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

* [musl] [C23 implied 0/2] stuff detected with the intended changes
@ 2023-05-24 10:03 Jens Gustedt
  2023-04-16 20:41 ` [musl] [C23 implied 1/2] C23: update some legacy function pointers Jens Gustedt
  2023-04-17 19:30 ` [musl] [C23 implied 2/2] clang: only exclude C library includes, but allow compiler specific headers Jens Gustedt
  0 siblings, 2 replies; 5+ messages in thread
From: Jens Gustedt @ 2023-05-24 10:03 UTC (permalink / raw)
  To: musl

These are two patches that could make sense independent from C23. The
first just adds prototypes where they are still missing. The second
differentiates the headers that are visible for clang, in particular
atomics should be available.

Jens Gustedt (2):
  C23: update some legacy function pointers
  clang: only exclude C library includes, but allow compiler specific
    headers

 src/legacy/ftw.c            | 2 +-
 src/thread/__syscall_cp.c   | 4 +++-
 src/thread/pthread_cancel.c | 8 ++++++--
 tools/musl-clang.in         | 2 +-
 4 files changed, 11 insertions(+), 5 deletions(-)

-- 
2.34.1

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

* Re: [musl] [C23 implied 2/2] clang: only exclude C library includes, but allow compiler specific headers
  2023-04-17 19:30 ` [musl] [C23 implied 2/2] clang: only exclude C library includes, but allow compiler specific headers Jens Gustedt
@ 2023-05-24 13:32   ` Rich Felker
  2023-05-24 13:39     ` Jₑₙₛ Gustedt
  0 siblings, 1 reply; 5+ messages in thread
From: Rich Felker @ 2023-05-24 13:32 UTC (permalink / raw)
  To: Jens Gustedt; +Cc: musl

On Mon, Apr 17, 2023 at 09:30:53PM +0200, Jens Gustedt wrote:
> ---
>  tools/musl-clang.in | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/musl-clang.in b/tools/musl-clang.in
> index 623de6f6..00189322 100644
> --- a/tools/musl-clang.in
> +++ b/tools/musl-clang.in
> @@ -24,7 +24,7 @@ exec $cc \
>      -B"$thisdir" \
>      -fuse-ld=musl-clang \
>      -static-libgcc \
> -    -nostdinc \
> +    -nostdlibinc \
>      --sysroot "$libc" \
>      -isystem "$libc_inc" \
>      -L-user-start \
> -- 
> 2.34.1

It's not clear to me whether this works on all versions, but more
importantly, it's not clear whether it blocks the compiler header path
from being searched before the libc header path, which is necessary so
incompatible compiler-provided stdc headers don't get used.

Rich

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

* Re: [musl] [C23 implied 2/2] clang: only exclude C library includes, but allow compiler specific headers
  2023-05-24 13:32   ` Rich Felker
@ 2023-05-24 13:39     ` Jₑₙₛ Gustedt
  0 siblings, 0 replies; 5+ messages in thread
From: Jₑₙₛ Gustedt @ 2023-05-24 13:39 UTC (permalink / raw)
  To: Rich Felker; +Cc: musl

[-- Attachment #1: Type: text/plain, Size: 819 bytes --]

Rich,

on Wed, 24 May 2023 09:32:33 -0400 you (Rich Felker <dalias@libc.org>)
wrote:

> It's not clear to me whether this works on all versions, but more
> importantly, it's not clear whether it blocks the compiler header path
> from being searched before the libc header path, which is necessary so
> incompatible compiler-provided stdc headers don't get used.

That's the idea, yes. I am building this systematically for clang
versions 9 to 17, and it seems all work fine.

Thanks
Jₑₙₛ

-- 
:: ICube :::::::::::::::::::::::::::::: deputy director ::
:: Université de Strasbourg :::::::::::::::::::::: ICPS ::
:: INRIA Nancy Grand Est :::::::::::::::::::::::: Camus ::
:: :::::::::::::::::::::::::::::::::::: ☎ +33 368854536 ::
:: https://icube-icps.unistra.fr/index.php/Jens_Gustedt ::

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

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

end of thread, other threads:[~2023-05-24 13:39 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-24 10:03 [musl] [C23 implied 0/2] stuff detected with the intended changes Jens Gustedt
2023-04-16 20:41 ` [musl] [C23 implied 1/2] C23: update some legacy function pointers Jens Gustedt
2023-04-17 19:30 ` [musl] [C23 implied 2/2] clang: only exclude C library includes, but allow compiler specific headers Jens Gustedt
2023-05-24 13:32   ` Rich Felker
2023-05-24 13:39     ` Jₑₙₛ Gustedt

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