From 53ecbb6c0354764a7d0e226eff108c7ac4a513ed Mon Sep 17 00:00:00 2001 From: Pablo Galindo Date: Mon, 9 May 2022 15:33:15 +0100 Subject: [PATCH 1/6] gh-91731: Add macro compatibility for static_assert for old libcs --- Include/pymacro.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Include/pymacro.h b/Include/pymacro.h index 71d6714afd112c..67ba95df324f6c 100644 --- a/Include/pymacro.h +++ b/Include/pymacro.h @@ -10,6 +10,13 @@ # define static_assert _Static_assert #endif +// static_assert isd efined in GLIB from version 2.16. Before it requires +// compiler support (gcc >= 4.6) and is called _Static_assert. +#if defined(__GLIBC__) && __GLIBC__ <= 2 && __GLIBC_MINOR__ <= 16 +# define static_assert _Static_assert +#endif ++ + /* Minimum value between x and y */ #define Py_MIN(x, y) (((x) > (y)) ? (y) : (x)) From 4ec5d94387c419b04216d95936e511b0b229834f Mon Sep 17 00:00:00 2001 From: Pablo Galindo Salgado Date: Mon, 9 May 2022 15:56:56 +0100 Subject: [PATCH 2/6] Update Include/pymacro.h --- Include/pymacro.h | 1 - 1 file changed, 1 deletion(-) diff --git a/Include/pymacro.h b/Include/pymacro.h index 67ba95df324f6c..aa2bde701c10f6 100644 --- a/Include/pymacro.h +++ b/Include/pymacro.h @@ -15,7 +15,6 @@ #if defined(__GLIBC__) && __GLIBC__ <= 2 && __GLIBC_MINOR__ <= 16 # define static_assert _Static_assert #endif -+ /* Minimum value between x and y */ #define Py_MIN(x, y) (((x) > (y)) ? (y) : (x)) From 6cdd7248170c1e0583a247b893ae07d02589983f Mon Sep 17 00:00:00 2001 From: Pablo Galindo Salgado Date: Mon, 9 May 2022 16:48:53 +0100 Subject: [PATCH 3/6] Update Include/pymacro.h Co-authored-by: Victor Stinner --- Include/pymacro.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Include/pymacro.h b/Include/pymacro.h index aa2bde701c10f6..213f871b7d5a4b 100644 --- a/Include/pymacro.h +++ b/Include/pymacro.h @@ -12,7 +12,7 @@ // static_assert isd efined in GLIB from version 2.16. Before it requires // compiler support (gcc >= 4.6) and is called _Static_assert. -#if defined(__GLIBC__) && __GLIBC__ <= 2 && __GLIBC_MINOR__ <= 16 +#if defined(__GLIBC__) && (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ <= 16) && !defined(static_assert) # define static_assert _Static_assert #endif From d48721046db15a7a283a6e3ca71bfbbdaa362854 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Mon, 9 May 2022 17:52:45 +0200 Subject: [PATCH 4/6] Update Include/pymacro.h --- Include/pymacro.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Include/pymacro.h b/Include/pymacro.h index 213f871b7d5a4b..2014115a91d108 100644 --- a/Include/pymacro.h +++ b/Include/pymacro.h @@ -12,7 +12,7 @@ // static_assert isd efined in GLIB from version 2.16. Before it requires // compiler support (gcc >= 4.6) and is called _Static_assert. -#if defined(__GLIBC__) && (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ <= 16) && !defined(static_assert) +#if defined(__GLIBC__) && (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ <= 16)) && !defined(static_assert) # define static_assert _Static_assert #endif From c55a3d484de335903425ff7d4a3db66c9b2a12e5 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Mon, 9 May 2022 17:52:54 +0200 Subject: [PATCH 5/6] Update Include/pymacro.h --- Include/pymacro.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Include/pymacro.h b/Include/pymacro.h index 2014115a91d108..9eb7b14f2138fd 100644 --- a/Include/pymacro.h +++ b/Include/pymacro.h @@ -10,7 +10,7 @@ # define static_assert _Static_assert #endif -// static_assert isd efined in GLIB from version 2.16. Before it requires +// static_assert is defined in GLIB from version 2.16. Before it requires // compiler support (gcc >= 4.6) and is called _Static_assert. #if defined(__GLIBC__) && (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ <= 16)) && !defined(static_assert) # define static_assert _Static_assert From e9510532dfeaa589571413ad601ec42d7b5b0426 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Mon, 9 May 2022 17:54:42 +0200 Subject: [PATCH 6/6] Update Include/pymacro.h --- Include/pymacro.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Include/pymacro.h b/Include/pymacro.h index 9eb7b14f2138fd..5037bbd013801b 100644 --- a/Include/pymacro.h +++ b/Include/pymacro.h @@ -12,7 +12,9 @@ // static_assert is defined in GLIB from version 2.16. Before it requires // compiler support (gcc >= 4.6) and is called _Static_assert. -#if defined(__GLIBC__) && (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ <= 16)) && !defined(static_assert) +#if (defined(__GLIBC__) \ + && (__GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ <= 16)) \ + && !defined(static_assert)) # define static_assert _Static_assert #endif