mailing list of musl libc
 help / color / mirror / code / Atom feed
* [musl] [C23 feature tests 0/4] Needed by other changes in C23
@ 2023-05-31  8:45 Jens Gustedt
  2023-05-31  8:45 ` [musl] [C23 feature tests 1/4] C23: provide fallbacks for the use of C attributes Jens Gustedt
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Jens Gustedt @ 2023-05-31  8:45 UTC (permalink / raw)
  To: musl

C23 introduces new attribute syntax and uses some of the attributes in
the header specification of some functions. If musl is not compiled in
C23 mode (which it will be for some time) we have to emulate or ignore
these attributes with some macro tricks.

Other features include support for new integer types, some of them
mandatory such as _BitInt types. musl itself doesn't use these
features for the compilation of the library itself, for example all
functionality for 128 bit types will be emulated.  But feature test
will be needed on the application side to detect full support of
[u]int128_t types such that musl and compilers that support the types
can work together.

Jens Gustedt (4):
  C23: provide fallbacks for the use of C attributes
  C23: add a feature test for the [u]int128_t
  Add a feature test for the _BitInt types.
  C23: add an internal interface for the new unsequenced attribute

 include/features.h | 41 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

-- 
2.34.1


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

* [musl] [C23 feature tests 1/4] C23: provide fallbacks for the use of C attributes
  2023-05-31  8:45 [musl] [C23 feature tests 0/4] Needed by other changes in C23 Jens Gustedt
@ 2023-05-31  8:45 ` Jens Gustedt
  2023-05-31  8:45 ` [musl] [C23 feature tests 2/4] C23: add a feature test for the [u]int128_t Jens Gustedt
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Jens Gustedt @ 2023-05-31  8:45 UTC (permalink / raw)
  To: musl

---
 include/features.h | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/include/features.h b/include/features.h
index 85cfb72a..8e1d84e3 100644
--- a/include/features.h
+++ b/include/features.h
@@ -35,6 +35,26 @@
 #define _Noreturn
 #endif
 
+#ifdef __has_c_attribute
+# if __has_c_attribute(__noreturn__)
+#  define __noreturn [[__noreturn__]]
+# endif
+# if __has_c_attribute(__deprecated__)
+#  define __deprecated [[__deprecated__]]
+# endif
+#endif
+
+#ifndef __noreturn
+# define __noreturn _Noreturn
+#endif
+#ifndef __deprecated
+# if defined(__GNUC__)
+#  define __deprecated __attribute__((__deprecated__))
+# else
+#  define __deprecated
+# endif
+#endif
+
 #define __REDIR(x,y) __typeof__(x) x __asm__(#y)
 
 #endif
-- 
2.34.1


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

* [musl] [C23 feature tests 2/4] C23: add a feature test for the [u]int128_t
  2023-05-31  8:45 [musl] [C23 feature tests 0/4] Needed by other changes in C23 Jens Gustedt
  2023-05-31  8:45 ` [musl] [C23 feature tests 1/4] C23: provide fallbacks for the use of C attributes Jens Gustedt
@ 2023-05-31  8:45 ` Jens Gustedt
  2023-05-31  8:45 ` [musl] [C23 feature tests 3/4] Add a feature test for the _BitInt types Jens Gustedt
  2023-05-31  8:45 ` [musl] [C23 feature tests 4/4] C23: add an internal interface for the new unsequenced attribute Jens Gustedt
  3 siblings, 0 replies; 5+ messages in thread
From: Jens Gustedt @ 2023-05-31  8:45 UTC (permalink / raw)
  To: musl

---
 include/features.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/include/features.h b/include/features.h
index 8e1d84e3..9d0d3724 100644
--- a/include/features.h
+++ b/include/features.h
@@ -57,4 +57,11 @@
 
 #define __REDIR(x,y) __typeof__(x) x __asm__(#y)
 
+// If the platform supports the 128 integer type and has _BitInt(N)
+// support where N large enough (all C23 compiler should have the
+// latter)
+#if __SIZEOF_INT128__ && (__BITINT_MAXWIDTH__ >= 128)
+#define __has_int128_t 1
+#endif
+
 #endif
-- 
2.34.1


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

* [musl] [C23 feature tests 3/4] Add a feature test for the _BitInt types.
  2023-05-31  8:45 [musl] [C23 feature tests 0/4] Needed by other changes in C23 Jens Gustedt
  2023-05-31  8:45 ` [musl] [C23 feature tests 1/4] C23: provide fallbacks for the use of C attributes Jens Gustedt
  2023-05-31  8:45 ` [musl] [C23 feature tests 2/4] C23: add a feature test for the [u]int128_t Jens Gustedt
@ 2023-05-31  8:45 ` Jens Gustedt
  2023-05-31  8:45 ` [musl] [C23 feature tests 4/4] C23: add an internal interface for the new unsequenced attribute Jens Gustedt
  3 siblings, 0 replies; 5+ messages in thread
From: Jens Gustedt @ 2023-05-31  8:45 UTC (permalink / raw)
  To: musl

This test is not needed for the configuration of musl itself, but only
for the interfaces that are offered through headers.
---
 include/features.h | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/include/features.h b/include/features.h
index 9d0d3724..46eca334 100644
--- a/include/features.h
+++ b/include/features.h
@@ -57,10 +57,14 @@
 
 #define __REDIR(x,y) __typeof__(x) x __asm__(#y)
 
-// If the platform supports the 128 integer type and has _BitInt(N)
-// support where N large enough (all C23 compiler should have the
-// latter)
-#if __SIZEOF_INT128__ && (__BITINT_MAXWIDTH__ >= 128)
+// If the platform supports the _BitInt(128) types (all C23 compiler
+// should have that)
+#if __BITINT_MAXWIDTH__ >= 128 || BITINT_MAXWIDTH >= 128
+#define __has_bitint128 1
+#endif
+
+// If the platform supports the 128 integer type and has _BitInt(128)
+#if __SIZEOF_INT128__ && __has_bitint128
 #define __has_int128_t 1
 #endif
 
-- 
2.34.1


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

* [musl] [C23 feature tests 4/4] C23: add an internal interface for the new unsequenced attribute
  2023-05-31  8:45 [musl] [C23 feature tests 0/4] Needed by other changes in C23 Jens Gustedt
                   ` (2 preceding siblings ...)
  2023-05-31  8:45 ` [musl] [C23 feature tests 3/4] Add a feature test for the _BitInt types Jens Gustedt
@ 2023-05-31  8:45 ` Jens Gustedt
  3 siblings, 0 replies; 5+ messages in thread
From: Jens Gustedt @ 2023-05-31  8:45 UTC (permalink / raw)
  To: musl

---
 include/features.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/include/features.h b/include/features.h
index 46eca334..adc41c04 100644
--- a/include/features.h
+++ b/include/features.h
@@ -42,6 +42,9 @@
 # if __has_c_attribute(__deprecated__)
 #  define __deprecated [[__deprecated__]]
 # endif
+# if __has_c_attribute(__unsequenced__)
+#  define __unsequenced [[__unsequenced__]]
+# endif
 #endif
 
 #ifndef __noreturn
@@ -54,6 +57,13 @@
 #  define __deprecated
 # endif
 #endif
+#ifndef __unsequenced
+# if defined(__GNUC__)
+#  define __unsequenced __attribute__((__const__))
+# else
+#  define __unsequenced
+# endif
+#endif
 
 #define __REDIR(x,y) __typeof__(x) x __asm__(#y)
 
-- 
2.34.1


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

end of thread, other threads:[~2023-05-31  8:47 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-31  8:45 [musl] [C23 feature tests 0/4] Needed by other changes in C23 Jens Gustedt
2023-05-31  8:45 ` [musl] [C23 feature tests 1/4] C23: provide fallbacks for the use of C attributes Jens Gustedt
2023-05-31  8:45 ` [musl] [C23 feature tests 2/4] C23: add a feature test for the [u]int128_t Jens Gustedt
2023-05-31  8:45 ` [musl] [C23 feature tests 3/4] Add a feature test for the _BitInt types Jens Gustedt
2023-05-31  8:45 ` [musl] [C23 feature tests 4/4] C23: add an internal interface for the new unsequenced attribute Jens 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).