gcc: update to 14.2.1+20250405.

This commit is contained in:
oreo639 2024-06-13 23:30:25 -07:00
parent a8d497a321
commit 2dce7342c8
7 changed files with 67 additions and 1239 deletions

View file

@ -63,7 +63,7 @@ libcc1plugin.so.0 gcc-6.2.1_1
libitm.so.1 libitm-4.7.3_1
liblto_plugin.so.0 gcc-4.7.3_1
libgcc_s.so.1 libgcc-4.4.0_1
libgo.so.22 libgo-13.2.0_1
libgo.so.23 libgo-14.1.0_1
libgccjit.so.0 libgccjit-10.2.1pre1_1
libperl.so.5.40 perl-5.40.1_1
libgmp.so.10 gmp-5.0.1_1
@ -861,8 +861,8 @@ libgdkmm-2.4.so.1 gtkmm2-2.24.0_1
libgtkmm-2.4.so.1 gtkmm2-2.24.0_1
libquadmath.so.0 libquadmath-4.4.0_1
libgfortran.so.5 libgfortran-8.2.0_1
libgnarl-13.so libada-13.2.0_1
libgnat-13.so libada-13.2.0_1
libgnarl-14.so libada-14.1.0_1
libgnat-14.so libada-14.1.0_1
libsharpyuv.so.0 libsharpyuv-1.3.0_1
libwebp.so.7 libwebp-0.6.0_1
libwebpmux.so.3 libwebp-0.6.0_1

View file

@ -1,297 +0,0 @@
From 15345980633c502f0486a2e40e96224f49134130 Mon Sep 17 00:00:00 2001
From: Jakub Jelinek <jakub@redhat.com>
Date: Tue, 19 Sep 2023 09:26:35 +0200
Subject: [PATCH] libgomp: Handle NULL environ like pointer to NULL pointer
[PR111413]
clearenv function just sets environ to NULL (after sometimes freeing it),
rather than setting it to a pointer to NULL, and our code was assuming
it is always non-NULL.
Fixed thusly, the change seems to be large but actually is just
+ if (environ)
for (env = environ; *env != 0; env++)
plus reindentation. I've also noticed the block after this for loop
was badly indented (too much) and fixed that too.
No testcase added, as it needs clearenv + dlopen.
2023-09-19 Jakub Jelinek <jakub@redhat.com>
PR libgomp/111413
* env.c (initialize_env): Don't dereference environ if it is NULL.
Reindent.
---
libgomp/env.c | 251 +++++++++++++++++++++++++-------------------------
1 file changed, 126 insertions(+), 125 deletions(-)
diff --git a/libgomp/env.c b/libgomp/env.c
index f24484d7f7074..a21adb3fd4bdb 100644
--- a/libgomp/env.c
+++ b/libgomp/env.c
@@ -2224,139 +2224,140 @@ initialize_env (void)
none = gomp_get_initial_icv_item (GOMP_DEVICE_NUM_FOR_NO_SUFFIX);
initialize_icvs (&none->icvs);
- for (env = environ; *env != 0; env++)
- {
- if (!startswith (*env, "OMP_"))
- continue;
-
- /* Name of the environment variable without suffix "OMP_". */
- char *name = *env + sizeof ("OMP_") - 1;
- for (omp_var = 0; omp_var < OMP_VAR_CNT; omp_var++)
- {
- if (startswith (name, envvars[omp_var].name))
- {
- pos = envvars[omp_var].name_len;
- if (name[pos] == '=')
- {
- pos++;
- flag_var_addr
- = add_initial_icv_to_list (GOMP_DEVICE_NUM_FOR_NO_SUFFIX,
- envvars[omp_var].flag_vars[0],
- params);
- }
- else if (startswith (&name[pos], "_DEV=")
- && envvars[omp_var].flag & GOMP_ENV_SUFFIX_DEV)
- {
- pos += 5;
- flag_var_addr
- = add_initial_icv_to_list (GOMP_DEVICE_NUM_FOR_DEV,
- envvars[omp_var].flag_vars[0],
- params);
- }
- else if (startswith (&name[pos], "_ALL=")
- && envvars[omp_var].flag & GOMP_ENV_SUFFIX_ALL)
- {
- pos += 5;
- flag_var_addr
- = add_initial_icv_to_list (GOMP_DEVICE_NUM_FOR_ALL,
- envvars[omp_var].flag_vars[0],
- params);
- }
- else if (startswith (&name[pos], "_DEV_")
- && envvars[omp_var].flag & GOMP_ENV_SUFFIX_DEV_X)
- {
- pos += 5;
- if (!get_device_num (*env, &name[pos], &dev_num,
- &dev_num_len))
- break;
-
- pos += dev_num_len + 1;
- flag_var_addr
- = add_initial_icv_to_list (dev_num,
- envvars[omp_var].flag_vars[0],
- params);
- }
- else
- {
- gomp_error ("Invalid environment variable in %s", *env);
- break;
- }
- env_val = &name[pos];
+ if (environ)
+ for (env = environ; *env != 0; env++)
+ {
+ if (!startswith (*env, "OMP_"))
+ continue;
- if (envvars[omp_var].parse_func (*env, env_val, params))
- {
- for (i = 0; i < 3; ++i)
- if (envvars[omp_var].flag_vars[i])
- gomp_set_icv_flag (flag_var_addr,
- envvars[omp_var].flag_vars[i]);
- else
+ /* Name of the environment variable without suffix "OMP_". */
+ char *name = *env + sizeof ("OMP_") - 1;
+ for (omp_var = 0; omp_var < OMP_VAR_CNT; omp_var++)
+ {
+ if (startswith (name, envvars[omp_var].name))
+ {
+ pos = envvars[omp_var].name_len;
+ if (name[pos] == '=')
+ {
+ pos++;
+ flag_var_addr
+ = add_initial_icv_to_list (GOMP_DEVICE_NUM_FOR_NO_SUFFIX,
+ envvars[omp_var].flag_vars[0],
+ params);
+ }
+ else if (startswith (&name[pos], "_DEV=")
+ && envvars[omp_var].flag & GOMP_ENV_SUFFIX_DEV)
+ {
+ pos += 5;
+ flag_var_addr
+ = add_initial_icv_to_list (GOMP_DEVICE_NUM_FOR_DEV,
+ envvars[omp_var].flag_vars[0],
+ params);
+ }
+ else if (startswith (&name[pos], "_ALL=")
+ && envvars[omp_var].flag & GOMP_ENV_SUFFIX_ALL)
+ {
+ pos += 5;
+ flag_var_addr
+ = add_initial_icv_to_list (GOMP_DEVICE_NUM_FOR_ALL,
+ envvars[omp_var].flag_vars[0],
+ params);
+ }
+ else if (startswith (&name[pos], "_DEV_")
+ && envvars[omp_var].flag & GOMP_ENV_SUFFIX_DEV_X)
+ {
+ pos += 5;
+ if (!get_device_num (*env, &name[pos], &dev_num,
+ &dev_num_len))
break;
- }
- break;
- }
- }
- }
+ pos += dev_num_len + 1;
+ flag_var_addr
+ = add_initial_icv_to_list (dev_num,
+ envvars[omp_var].flag_vars[0],
+ params);
+ }
+ else
+ {
+ gomp_error ("Invalid environment variable in %s", *env);
+ break;
+ }
+ env_val = &name[pos];
- all = gomp_get_initial_icv_item (GOMP_DEVICE_NUM_FOR_ALL);
- for (omp_var = 0; omp_var < OMP_HOST_VAR_CNT; omp_var++)
- {
- if (none != NULL
- && gomp_get_icv_flag (none->flags, host_envvars[omp_var].flag_var))
- get_icv_member_addr (&none->icvs,
- host_envvars[omp_var].flag_var, params);
- else if (all != NULL
- && gomp_get_icv_flag (all->flags,
- host_envvars[omp_var].flag_var))
- get_icv_member_addr (&all->icvs, host_envvars[omp_var].flag_var,
- params);
- else
- continue;
+ if (envvars[omp_var].parse_func (*env, env_val, params))
+ {
+ for (i = 0; i < 3; ++i)
+ if (envvars[omp_var].flag_vars[i])
+ gomp_set_icv_flag (flag_var_addr,
+ envvars[omp_var].flag_vars[i]);
+ else
+ break;
+ }
- switch (host_envvars[omp_var].type_code)
- {
- case PARSE_INT:
- for (i = 0; i < 3; ++i)
- if (host_envvars[omp_var].dest[i] != NULL && params[i] != NULL)
- *(int *) (host_envvars[omp_var].dest[i]) = *(int *) params[i];
- break;
- case PARSE_BOOL:
- for (i = 0; i < 3; ++i)
- if (host_envvars[omp_var].dest[i] != NULL && params[i] != NULL)
- *(bool *) (host_envvars[omp_var].dest[i]) = *(bool *) params[i];
- break;
- case PARSE_UINT:
- for (i = 0; i < 3; ++i)
- if (host_envvars[omp_var].dest[i] != NULL && params[i] != NULL)
- *(unsigned int *) (host_envvars[omp_var].dest[i])
- = *(unsigned int *) params[i];
- break;
- case PARSE_ULONG:
- for (i = 0; i < 3; ++i)
- if (host_envvars[omp_var].dest[i] != NULL && params[i] != NULL)
- *(unsigned long *) (host_envvars[omp_var].dest[i])
- = *(unsigned long *) params[i];
- break;
- case PARSE_UCHAR:
- for (i = 0; i < 3; ++i)
- if (host_envvars[omp_var].dest[i] != NULL && params[i] != NULL)
- *(unsigned char *) (host_envvars[omp_var].dest[i])
- = *(unsigned char *) params[i];
- break;
- case PARSE_SCHEDULE:
- *(enum gomp_schedule_type *) (host_envvars[omp_var].dest[0])
- = *(enum gomp_schedule_type *) params[0];
- *(int *) (host_envvars[omp_var].dest[1]) = *(int *) params[1];
- break;
- case PARSE_BIND:
- *(char *) (host_envvars[omp_var].dest[0]) = *(char *) params[0];
- *(char **) (host_envvars[omp_var].dest[1]) = *(char **) params[1];
- *(unsigned long *) (host_envvars[omp_var].dest[2])
- = *(unsigned long *) params[2];
- break;
+ break;
+ }
}
}
+ all = gomp_get_initial_icv_item (GOMP_DEVICE_NUM_FOR_ALL);
+ for (omp_var = 0; omp_var < OMP_HOST_VAR_CNT; omp_var++)
+ {
+ if (none != NULL
+ && gomp_get_icv_flag (none->flags, host_envvars[omp_var].flag_var))
+ get_icv_member_addr (&none->icvs,
+ host_envvars[omp_var].flag_var, params);
+ else if (all != NULL
+ && gomp_get_icv_flag (all->flags,
+ host_envvars[omp_var].flag_var))
+ get_icv_member_addr (&all->icvs, host_envvars[omp_var].flag_var,
+ params);
+ else
+ continue;
+
+ switch (host_envvars[omp_var].type_code)
+ {
+ case PARSE_INT:
+ for (i = 0; i < 3; ++i)
+ if (host_envvars[omp_var].dest[i] != NULL && params[i] != NULL)
+ *(int *) (host_envvars[omp_var].dest[i]) = *(int *) params[i];
+ break;
+ case PARSE_BOOL:
+ for (i = 0; i < 3; ++i)
+ if (host_envvars[omp_var].dest[i] != NULL && params[i] != NULL)
+ *(bool *) (host_envvars[omp_var].dest[i]) = *(bool *) params[i];
+ break;
+ case PARSE_UINT:
+ for (i = 0; i < 3; ++i)
+ if (host_envvars[omp_var].dest[i] != NULL && params[i] != NULL)
+ *(unsigned int *) (host_envvars[omp_var].dest[i])
+ = *(unsigned int *) params[i];
+ break;
+ case PARSE_ULONG:
+ for (i = 0; i < 3; ++i)
+ if (host_envvars[omp_var].dest[i] != NULL && params[i] != NULL)
+ *(unsigned long *) (host_envvars[omp_var].dest[i])
+ = *(unsigned long *) params[i];
+ break;
+ case PARSE_UCHAR:
+ for (i = 0; i < 3; ++i)
+ if (host_envvars[omp_var].dest[i] != NULL && params[i] != NULL)
+ *(unsigned char *) (host_envvars[omp_var].dest[i])
+ = *(unsigned char *) params[i];
+ break;
+ case PARSE_SCHEDULE:
+ *(enum gomp_schedule_type *) (host_envvars[omp_var].dest[0])
+ = *(enum gomp_schedule_type *) params[0];
+ *(int *) (host_envvars[omp_var].dest[1]) = *(int *) params[1];
+ break;
+ case PARSE_BIND:
+ *(char *) (host_envvars[omp_var].dest[0]) = *(char *) params[0];
+ *(char **) (host_envvars[omp_var].dest[1]) = *(char **) params[1];
+ *(unsigned long *) (host_envvars[omp_var].dest[2])
+ = *(unsigned long *) params[2];
+ break;
+ }
+ }
+
if (((none != NULL && gomp_get_icv_flag (none->flags, GOMP_ICV_BIND))
|| (all != NULL && gomp_get_icv_flag (all->flags, GOMP_ICV_BIND)))
&& gomp_global_icv.bind_var == omp_proc_bind_false)

View file

@ -1,142 +0,0 @@
From d7bead833631486e337e541e692d9b4a1ca14edd Mon Sep 17 00:00:00 2001
From: Fangrui Song <i@maskray.me>
Date: Fri, 28 Apr 2023 09:59:17 -0700
Subject: [PATCH] [sanitizer] Remove crypt and crypt_r interceptors
From Florian Weimer's D144073
> On GNU/Linux (glibc), the crypt and crypt_r functions are not part of the main shared object (libc.so.6), but libcrypt (with multiple possible sonames). The sanitizer libraries do not depend on libcrypt, so it can happen that during sanitizer library initialization, no real implementation will be found because the crypt, crypt_r functions are not present in the process image (yet). If its interceptors are called nevertheless, this results in a call through a null pointer when the sanitizer library attempts to forward the call to the real implementation.
>
> Many distributions have already switched to libxcrypt, a library that is separate from glibc and that can be build with sanitizers directly (avoiding the need for interceptors). This patch disables building the interceptor for glibc targets.
Let's remove crypt and crypt_r interceptors (D68431) to fix issues with
newer glibc.
For older glibc, msan will not know that an uninstrumented crypt_r call
initializes `data`, so there is a risk for false positives. However, with some
codebase survey, I think crypt_r uses are very few and the call sites typically
have a `memset(&data, 0, sizeof(data));` anyway.
Fix https://github.com/google/sanitizers/issues/1365
Related: https://bugzilla.redhat.com/show_bug.cgi?id=2169432
Reviewed By: #sanitizers, fweimer, thesamesam, vitalybuka
Differential Revision: https://reviews.llvm.org/D149403
---
.../sanitizer_common_interceptors.inc | 37 -------------------
.../sanitizer_platform_interceptors.h | 2 -
.../sanitizer_platform_limits_posix.cpp | 8 ----
.../sanitizer_platform_limits_posix.h | 1 -
.../TestCases/Linux/crypt_r.cpp | 36 ------------------
.../TestCases/Posix/crypt.cpp | 32 ----------------
6 files changed, 116 deletions(-)
delete mode 100644 compiler-rt/test/sanitizer_common/TestCases/Linux/crypt_r.cpp
delete mode 100644 compiler-rt/test/sanitizer_common/TestCases/Posix/crypt.cpp
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc b/compiler-rt/lib/sanitizer_common/sanitizer_common_interceptors.inc
index b30c91f06cfeb0..490a8b12d8b17d 100644
--- a/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc
+++ b/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc
@@ -10086,41 +10086,6 @@ INTERCEPTOR(SSIZE_T, getrandom, void *buf, SIZE_T buflen, unsigned int flags) {
#define INIT_GETRANDOM
#endif
-#if SANITIZER_INTERCEPT_CRYPT
-INTERCEPTOR(char *, crypt, char *key, char *salt) {
- void *ctx;
- COMMON_INTERCEPTOR_ENTER(ctx, crypt, key, salt);
- COMMON_INTERCEPTOR_READ_RANGE(ctx, key, internal_strlen(key) + 1);
- COMMON_INTERCEPTOR_READ_RANGE(ctx, salt, internal_strlen(salt) + 1);
- char *res = REAL(crypt)(key, salt);
- if (res != nullptr)
- COMMON_INTERCEPTOR_INITIALIZE_RANGE(res, internal_strlen(res) + 1);
- return res;
-}
-#define INIT_CRYPT COMMON_INTERCEPT_FUNCTION(crypt);
-#else
-#define INIT_CRYPT
-#endif
-
-#if SANITIZER_INTERCEPT_CRYPT_R
-INTERCEPTOR(char *, crypt_r, char *key, char *salt, void *data) {
- void *ctx;
- COMMON_INTERCEPTOR_ENTER(ctx, crypt_r, key, salt, data);
- COMMON_INTERCEPTOR_READ_RANGE(ctx, key, internal_strlen(key) + 1);
- COMMON_INTERCEPTOR_READ_RANGE(ctx, salt, internal_strlen(salt) + 1);
- char *res = REAL(crypt_r)(key, salt, data);
- if (res != nullptr) {
- COMMON_INTERCEPTOR_WRITE_RANGE(ctx, data,
- __sanitizer::struct_crypt_data_sz);
- COMMON_INTERCEPTOR_INITIALIZE_RANGE(res, internal_strlen(res) + 1);
- }
- return res;
-}
-#define INIT_CRYPT_R COMMON_INTERCEPT_FUNCTION(crypt_r);
-#else
-#define INIT_CRYPT_R
-#endif
-
#if SANITIZER_INTERCEPT_GETENTROPY
INTERCEPTOR(int, getentropy, void *buf, SIZE_T buflen) {
void *ctx;
@@ -10698,8 +10663,6 @@ static void InitializeCommonInterceptors() {
INIT_GETUSERSHELL;
INIT_SL_INIT;
INIT_GETRANDOM;
- INIT_CRYPT;
- INIT_CRYPT_R;
INIT_GETENTROPY;
INIT_QSORT;
INIT_QSORT_R;
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h b/compiler-rt/lib/sanitizer_common/sanitizer_platform_interceptors.h
index eb39fabfd59839..c82ab5c2105621 100644
--- a/libsanitizer/sanitizer_common/sanitizer_platform_interceptors.h
+++ b/libsanitizer/sanitizer_common/sanitizer_platform_interceptors.h
@@ -569,8 +569,6 @@
#define SANITIZER_INTERCEPT_FDEVNAME SI_FREEBSD
#define SANITIZER_INTERCEPT_GETUSERSHELL (SI_POSIX && !SI_ANDROID)
#define SANITIZER_INTERCEPT_SL_INIT (SI_FREEBSD || SI_NETBSD)
-#define SANITIZER_INTERCEPT_CRYPT (SI_POSIX && !SI_ANDROID)
-#define SANITIZER_INTERCEPT_CRYPT_R (SI_LINUX && !SI_ANDROID)
#define SANITIZER_INTERCEPT_GETRANDOM \
((SI_LINUX && __GLIBC_PREREQ(2, 25)) || SI_FREEBSD)
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp
index a04eed7aa5a6e3..6d61d276d77e35 100644
--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp
+++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.cpp
@@ -177,10 +177,6 @@ typedef struct user_fpregs elf_fpregset_t;
# include "sanitizer_platform_interceptors.h"
# include "sanitizer_platform_limits_posix.h"
-#if SANITIZER_INTERCEPT_CRYPT_R
-#include <crypt.h>
-#endif
-
namespace __sanitizer {
unsigned struct_utsname_sz = sizeof(struct utsname);
unsigned struct_stat_sz = sizeof(struct stat);
@@ -300,10 +296,6 @@ namespace __sanitizer {
unsigned struct_statvfs64_sz = sizeof(struct statvfs64);
#endif // SANITIZER_GLIBC
-#if SANITIZER_INTERCEPT_CRYPT_R
- unsigned struct_crypt_data_sz = sizeof(struct crypt_data);
-#endif
-
#if SANITIZER_LINUX && !SANITIZER_ANDROID
unsigned struct_timex_sz = sizeof(struct timex);
unsigned struct_msqid_ds_sz = sizeof(struct msqid_ds);
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h b/compiler-rt/lib/sanitizer_common/sanitizer_platform_limits_posix.h
index e6f298c26e1fb6..58244c9944a03a 100644
--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
+++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
@@ -309,7 +309,6 @@ extern unsigned struct_msqid_ds_sz;
extern unsigned struct_mq_attr_sz;
extern unsigned struct_timex_sz;
extern unsigned struct_statvfs_sz;
-extern unsigned struct_crypt_data_sz;
#endif // SANITIZER_LINUX && !SANITIZER_ANDROID
struct __sanitizer_iovec {

View file

@ -1,60 +0,0 @@
From f4029de35fb1b293a4fd586574b1b4b73ddf7880 Mon Sep 17 00:00:00 2001
From: Prathamesh Kulkarni <prathamesh.kulkarni@linaro.org>
Date: Wed, 26 Jul 2023 22:36:26 +0530
Subject: [PATCH] [aarch64/match.pd] Fix ICE observed in PR110280.
gcc/ChangeLog:
PR tree-optimization/110280
* match.pd (vec_perm_expr(v, v, mask) -> v): Explicitly build vector
using build_vector_from_val with the element of input operand, and
mask's type if operand and mask's types don't match.
gcc/testsuite/ChangeLog:
PR tree-optimization/110280
* gcc.target/aarch64/sve/pr110280.c: New test.
(cherry picked from commit 85d8e0d8d5342ec8b4e6a54e22741c30b33c6f04)
---
gcc/match.pd | 9 ++++++++-
gcc/testsuite/gcc.target/aarch64/sve/pr110280.c | 12 ++++++++++++
2 files changed, 20 insertions(+), 1 deletion(-)
create mode 100644 gcc/testsuite/gcc.target/aarch64/sve/pr110280.c
diff --git a/gcc/match.pd b/gcc/match.pd
index 9118244825054..c3bb4fbc0a7a2 100644
--- a/gcc/match.pd
+++ b/gcc/match.pd
@@ -8292,7 +8292,14 @@ and,
(simplify
(vec_perm vec_same_elem_p@0 @0 @1)
- @0)
+ (if (types_match (type, TREE_TYPE (@0)))
+ @0
+ (with
+ {
+ tree elem = uniform_vector_p (@0);
+ }
+ (if (elem)
+ { build_vector_from_val (type, elem); }))))
/* Push VEC_PERM earlier if that may help FMA perception (PR101895). */
(simplify
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/pr110280.c b/gcc/testsuite/gcc.target/aarch64/sve/pr110280.c
new file mode 100644
index 0000000000000..d3279f383629f
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/pr110280.c
@@ -0,0 +1,12 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -fdump-tree-optimized" } */
+
+#include "arm_sve.h"
+
+svuint32_t l()
+{
+ _Alignas(16) const unsigned int lanes[4] = {0, 0, 0, 0};
+ return svld1rq_u32(svptrue_b8(), lanes);
+}
+
+/* { dg-final { scan-tree-dump-not "VEC_PERM_EXPR" "optimized" } } */

View file

@ -1,125 +0,0 @@
--- a/libstdc++-v3/python/libstdcxx/v6/printers.py
+++ b/libstdc++-v3/python/libstdcxx/v6/printers.py
@@ -1198,7 +1198,7 @@
def __init__ (self, typename, val):
self.typename = strip_versioned_namespace(typename)
- self.typename = re.sub('^std::experimental::fundamentals_v\d::', 'std::experimental::', self.typename, 1)
+ self.typename = re.sub(r'^std::experimental::fundamentals_v\d::', 'std::experimental::', self.typename, 1)
self.val = val
self.contained_type = None
contained_value = None
@@ -1299,7 +1299,7 @@
mgrtypes = []
for s in strings:
try:
- x = re.sub("std::string(?!\w)", s, m.group(1))
+ x = re.sub(r"std::string(?!\w)", s, m.group(1))
# The following lookup might raise gdb.error if the
# manager function was never instantiated for 's' in the
# program, because there will be no such type.
@@ -1246,7 +1246,7 @@
def __init__ (self, typename, val):
valtype = self._recognize (val.type.template_argument(0))
typename = strip_versioned_namespace(typename)
- self.typename = re.sub('^std::(experimental::|)(fundamentals_v\d::|)(.*)', r'std::\1\3<%s>' % valtype, typename, 1)
+ self.typename = re.sub(r'^std::(experimental::|)(fundamentals_v\d::|)(.*)', r'std::\1\3<%s>' % valtype, typename, 1)
payload = val['_M_payload']
if self.typename.startswith('std::experimental'):
engaged = val['_M_engaged']
diff '--color=auto' -Naur a/libstdc++-v3/python/libstdcxx/v6/xmethods.py b/libstdc++-v3/python/libstdcxx/v6/xmethods.py
--- a/libstdc++-v3/python/libstdcxx/v6/xmethods.py 2022-08-19 08:09:55.524700157 +0000
+++ b/libstdc++-v3/python/libstdcxx/v6/xmethods.py 2023-12-09 21:06:42.544909771 +0000
@@ -148,7 +148,7 @@
self.methods = [self._method_dict[m] for m in self._method_dict]
def match(self, class_type, method_name):
- if not re.match('^std::(__\d+::)?array<.*>$', class_type.tag):
+ if not re.match(r'^std::(__\d+::)?array<.*>$', class_type.tag):
return None
method = self._method_dict.get(method_name)
if method is None or not method.enabled:
@@ -265,7 +265,7 @@
self.methods = [self._method_dict[m] for m in self._method_dict]
def match(self, class_type, method_name):
- if not re.match('^std::(__\d+::)?deque<.*>$', class_type.tag):
+ if not re.match(r'^std::(__\d+::)?deque<.*>$', class_type.tag):
return None
method = self._method_dict.get(method_name)
if method is None or not method.enabled:
@@ -309,7 +309,7 @@
self.methods = [self._method_dict[m] for m in self._method_dict]
def match(self, class_type, method_name):
- if not re.match('^std::(__\d+::)?forward_list<.*>$', class_type.tag):
+ if not re.match(r'^std::(__\d+::)?forward_list<.*>$', class_type.tag):
return None
method = self._method_dict.get(method_name)
if method is None or not method.enabled:
@@ -390,7 +390,7 @@
self.methods = [self._method_dict[m] for m in self._method_dict]
def match(self, class_type, method_name):
- if not re.match('^std::(__\d+::)?(__cxx11::)?list<.*>$', class_type.tag):
+ if not re.match(r'^std::(__\d+::)?(__cxx11::)?list<.*>$', class_type.tag):
return None
method = self._method_dict.get(method_name)
if method is None or not method.enabled:
@@ -505,7 +505,7 @@
self.methods = [self._method_dict[m] for m in self._method_dict]
def match(self, class_type, method_name):
- if not re.match('^std::(__\d+::)?vector<.*>$', class_type.tag):
+ if not re.match(r'^std::(__\d+::)?vector<.*>$', class_type.tag):
return None
method = self._method_dict.get(method_name)
if method is None or not method.enabled:
@@ -554,7 +554,7 @@
self.methods = [self._method_dict[m] for m in self._method_dict]
def match(self, class_type, method_name):
- if not re.match('^std::(__\d+::)?%s<.*>$' % self._name, class_type.tag):
+ if not re.match(r'^std::(__\d+::)?%s<.*>$' % self._name, class_type.tag):
return None
method = self._method_dict.get(method_name)
if method is None or not method.enabled:
@@ -587,9 +587,9 @@
def __call__(self, obj):
impl_type = obj.dereference().type.fields()[0].type.tag
# Check for new implementations first:
- if re.match('^std::(__\d+::)?__uniq_ptr_(data|impl)<.*>$', impl_type):
+ if re.match(r'^std::(__\d+::)?__uniq_ptr_(data|impl)<.*>$', impl_type):
tuple_member = obj['_M_t']['_M_t']
- elif re.match('^std::(__\d+::)?tuple<.*>$', impl_type):
+ elif re.match(r'^std::(__\d+::)?tuple<.*>$', impl_type):
tuple_member = obj['_M_t']
else:
return None
@@ -651,7 +651,7 @@
self.methods = [self._method_dict[m] for m in self._method_dict]
def match(self, class_type, method_name):
- if not re.match('^std::(__\d+::)?unique_ptr<.*>$', class_type.tag):
+ if not re.match(r'^std::(__\d+::)?unique_ptr<.*>$', class_type.tag):
return None
method = self._method_dict.get(method_name)
if method is None or not method.enabled:
@@ -720,7 +720,7 @@
def __call__(self, obj, index):
# Check bounds if _elem_type is an array of known bound
- m = re.match('.*\[(\d+)]$', str(self._elem_type))
+ m = re.match(r'.*\[(\d+)]$', str(self._elem_type))
if m and index >= int(m.group(1)):
raise IndexError('shared_ptr<%s> index "%d" should not be >= %d.' %
(self._elem_type, int(index), int(m.group(1))))
@@ -769,7 +769,7 @@
self.methods = [self._method_dict[m] for m in self._method_dict]
def match(self, class_type, method_name):
- if not re.match('^std::(__\d+::)?shared_ptr<.*>$', class_type.tag):
+ if not re.match(r'^std::(__\d+::)?shared_ptr<.*>$', class_type.tag):
return None
method = self._method_dict.get(method_name)
if method is None or not method.enabled:

View file

@ -1,563 +0,0 @@
From 5ceea2ac106d6dd1aa8175670b15a801316cf1c9 Mon Sep 17 00:00:00 2001
From: Jonathan Wakely <jwakely@redhat.com>
Date: Tue, 30 Apr 2024 09:52:13 +0100
Subject: [PATCH] libstdc++: Fix std::chrono::tzdb to work with vanguard format
I found some issues in the std::chrono::tzdb parser by testing the
tzdata "vanguard" format, which uses new features that aren't enabled in
the "main" and "rearguard" data formats.
Since 2024a the keyword "minimum" is no longer valid for the FROM and TO
fields in a Rule line, which means that "m" is now a valid abbreviation
for "maximum". Previously we expected either "mi" or "ma". For backwards
compatibility, a FROM field beginning with "mi" is still supported and
is treated as 1900. The "maximum" keyword is only allowed in TO now,
because it makes no sense in FROM. To support these changes the
minmax_year and minmax_year2 classes for parsing FROM and TO are
replaced with a single years_from_to class that reads both fields.
The vanguard format makes use of %z in Zone FORMAT fields, which caused
an exception to be thrown from ZoneInfo::set_abbrev because no % or /
characters were expected when a Zone doesn't use a named Rule. The
ZoneInfo::to(sys_info&) function now uses format_abbrev_str to replace
any %z with the current offset. Although format_abbrev_str also checks
for %s and STD/DST formats, those only make sense when a named Rule is
in effect, so won't occur when ZoneInfo::to(sys_info&) is used.
Since making this change on trunk, the tzdata-2024b release started
using %z in the main format, not just vanguard. This makes a backport to
release branches necessary (see PR 116657).
This change also implements a feature that has always been missing from
time_zone::_M_get_sys_info: finding the Rule that is active before the
specified time point, so that we can correctly handle %s in the FORMAT
for the first new sys_info that gets created. This requires implementing
a poorly documented feature of zic, to get the LETTERS field from a
later transition, as described at
https://mm.icann.org/pipermail/tz/2024-April/058891.html
In order for this to work we need to be able to distinguish an empty
letters field (as used by CE%sT where the variable part is either empty
or "S") from "the letters field is not known for this transition". The
tzdata file uses "-" for an empty letters field, which libstdc++ was
previously replacing with "" when the Rule was parsed. Instead, we now
preserve the "-" in the Rule object, so that "" can be used for the case
where we don't know the letters (and so need to decide it).
libstdc++-v3/ChangeLog:
* src/c++20/tzdb.cc (minmax_year, minmax_year2): Remove.
(years_from_to): New class replacing minmax_year and
minmax_year2.
(format_abbrev_str, select_std_or_dst_abbrev): Move earlier in
the file. Handle "-" for letters.
(ZoneInfo::to): Use format_abbrev_str to expand %z.
(ZoneInfo::set_abbrev): Remove exception. Change parameter from
reference to value.
(operator>>(istream&, Rule&)): Do not clear letters when it
contains "-".
(time_zone::_M_get_sys_info): Add missing logic to find the Rule
in effect before the time point.
* testsuite/std/time/tzdb/1.cc: Adjust for vanguard format using
"GMT" as the Zone name, not as a Link to "Etc/GMT".
* testsuite/std/time/time_zone/sys_info_abbrev.cc: New test.
(cherry picked from commit 0ca8d56f2085715f27ee536c6c344bc47af49cdd)
---
libstdc++-v3/src/c++20/tzdb.cc | 265 +++++++++++-------
.../std/time/time_zone/sys_info_abbrev.cc | 106 +++++++
libstdc++-v3/testsuite/std/time/tzdb/1.cc | 6 +-
3 files changed, 274 insertions(+), 103 deletions(-)
create mode 100644 libstdc++-v3/testsuite/std/time/time_zone/sys_info_abbrev.cc
diff --git a/libstdc++-v3/src/c++20/tzdb.cc b/libstdc++-v3/src/c++20/tzdb.cc
index e058caf27d89..034e72f02743 100644
--- a/libstdc++-v3/src/c++20/tzdb.cc
+++ b/libstdc++-v3/src/c++20/tzdb.cc
@@ -342,51 +342,103 @@ namespace std::chrono
friend istream& operator>>(istream&, on_day&);
};
- // Wrapper for chrono::year that reads a year, or one of the keywords
- // "minimum" or "maximum", or an unambiguous prefix of a keyword.
- struct minmax_year
+ // Wrapper for two chrono::year values, which reads the FROM and TO
+ // fields of a Rule line. The FROM field is a year and TO is a year or
+ // one of the keywords "maximum" or "only" (or an abbreviation of those).
+ // For backwards compatibility, the keyword "minimum" is recognized
+ // for FROM and interpreted as 1900.
+ struct years_from_to
{
- year& y;
+ year& from;
+ year& to;
- friend istream& operator>>(istream& in, minmax_year&& y)
+ friend istream& operator>>(istream& in, years_from_to&& yy)
{
- if (ws(in).peek() == 'm') // keywords "minimum" or "maximum"
+ string s;
+ auto c = ws(in).peek();
+ if (c == 'm') [[unlikely]] // keyword "minimum"
{
- string s;
- in >> s; // extract the rest of the word, but only look at s[1]
- if (s[1] == 'a')
- y.y = year::max();
- else if (s[1] == 'i')
- y.y = year::min();
- else
- in.setstate(ios::failbit);
+ in >> s; // extract the rest of the word
+ yy.from = year(1900);
+ }
+ else if (int num = 0; in >> num) [[likely]]
+ yy.from = year{num};
+
+ c = ws(in).peek();
+ if (c == 'm') // keyword "maximum"
+ {
+ in >> s; // extract the rest of the word
+ yy.to = year::max();
+ }
+ else if (c == 'o') // keyword "only"
+ {
+ in >> s; // extract the rest of the word
+ yy.to = yy.from;
}
else if (int num = 0; in >> num)
- y.y = year{num};
+ yy.to = year{num};
+
return in;
}
};
- // As above for minmax_year, but also supports the keyword "only",
- // meaning that the TO year is the same as the FROM year.
- struct minmax_year2
+ bool
+ select_std_or_dst_abbrev(string& abbrev, minutes save)
{
- minmax_year to;
- year from;
+ if (size_t pos = abbrev.find('/'); pos != string::npos)
+ {
+ // Select one of "STD/DST" for standard or daylight.
+ if (save == 0min)
+ abbrev.erase(pos);
+ else
+ abbrev.erase(0, pos + 1);
+ return true;
+ }
+ return false;
+ }
- friend istream& operator>>(istream& in, minmax_year2&& y)
- {
- if (ws(in).peek() == 'o') // keyword "only"
- {
- string s;
- in >> s; // extract the whole keyword
- y.to.y = y.from;
- }
- else
- in >> std::move(y.to);
- return in;
- }
- };
+ // Set the sys_info::abbrev string by expanding any placeholders.
+ void
+ format_abbrev_str(sys_info& info, string_view letters = {})
+ {
+ if (size_t pos = info.abbrev.find('%'); pos != string::npos)
+ {
+ if (info.abbrev[pos + 1] == 's')
+ {
+ // Expand "%s" to the variable part, given by Rule::letters.
+ if (letters == "-")
+ info.abbrev.erase(pos, 2);
+ else
+ info.abbrev.replace(pos, 2, letters);
+ }
+ else if (info.abbrev[pos + 1] == 'z')
+ {
+ // Expand "%z" to the UT offset as +/-hh, +/-hhmm, or +/-hhmmss.
+ hh_mm_ss<seconds> t(info.offset);
+ string z(1, "+-"[t.is_negative()]);
+ long val = t.hours().count();
+ int digits = 2;
+ if (int m = t.minutes().count())
+ {
+ digits = 4;
+ val *= 100;
+ val += m;
+ if (int s = t.seconds().count())
+ {
+ digits = 6;
+ val *= 100;
+ val += s;
+ }
+ }
+ auto sval = std::to_string(val);
+ z += string(digits - sval.size(), '0');
+ z += sval;
+ info.abbrev.replace(pos, 2, z);
+ }
+ }
+ else
+ select_std_or_dst_abbrev(info.abbrev, info.save);
+ }
// A time zone information record.
// Zone NAME STDOFF RULES FORMAT [UNTIL]
@@ -462,6 +514,7 @@ namespace std::chrono
info.offset = offset();
info.save = minutes(m_save);
info.abbrev = format();
+ format_abbrev_str(info); // expand %z
return true;
}
@@ -469,12 +522,9 @@ namespace std::chrono
friend class time_zone;
void
- set_abbrev(const string& abbrev)
+ set_abbrev(string abbrev)
{
- // In practice, the FORMAT field never needs expanding here.
- if (abbrev.find_first_of("/%") != abbrev.npos)
- __throw_runtime_error("std::chrono::time_zone: invalid data");
- m_buf = abbrev;
+ m_buf = std::move(abbrev);
m_pos = 0;
m_expanded = true;
}
@@ -544,9 +594,7 @@ namespace std::chrono
// Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S
- in >> quoted(rule.name)
- >> minmax_year{rule.from}
- >> minmax_year2{rule.to, rule.from};
+ in >> quoted(rule.name) >> years_from_to{rule.from, rule.to};
if (char type; in >> type && type != '-')
in.setstate(ios::failbit);
@@ -557,7 +605,7 @@ namespace std::chrono
if (save_time.indicator != at_time::Wall)
{
// We don't actually store the save_time.indicator, because we
- // assume that it's always deducable from the actual offset value.
+ // assume that it's always deducible from the offset value.
auto expected = save_time.time == 0s
? at_time::Standard
: at_time::Daylight;
@@ -567,8 +615,6 @@ namespace std::chrono
rule.save = save_time.time;
in >> rule.letters;
- if (rule.letters == "-")
- rule.letters.clear();
return in;
}
@@ -714,58 +760,6 @@ namespace std::chrono
#endif // TZDB_DISABLED
};
-#ifndef TZDB_DISABLED
- namespace
- {
- bool
- select_std_or_dst_abbrev(string& abbrev, minutes save)
- {
- if (size_t pos = abbrev.find('/'); pos != string::npos)
- {
- // Select one of "STD/DST" for standard or daylight.
- if (save == 0min)
- abbrev.erase(pos);
- else
- abbrev.erase(0, pos + 1);
- return true;
- }
- return false;
- }
-
- // Set the sys_info::abbrev string by expanding any placeholders.
- void
- format_abbrev_str(sys_info& info, string_view letters = {})
- {
- if (size_t pos = info.abbrev.find("%s"); pos != string::npos)
- {
- // Expand "%s" to the variable part, given by Rule::letters.
- info.abbrev.replace(pos, 2, letters);
- }
- else if (size_t pos = info.abbrev.find("%z"); pos != string::npos)
- {
- // Expand "%z" to the UT offset as +/-hh, +/-hhmm, or +/-hhmmss.
- hh_mm_ss<seconds> t(info.offset);
- string z(1, "+-"[t.is_negative()]);
- long val = t.hours().count();
- if (minutes m = t.minutes(); m != m.zero())
- {
- val *= 100;
- val += m.count();
- if (seconds s = t.seconds(); s != s.zero())
- {
- val *= 100;
- val += s.count();
- }
- }
- z += std::to_string(val);
- info.abbrev.replace(pos, 2, z);
- }
- else
- select_std_or_dst_abbrev(info.abbrev, info.save);
- }
- }
-#endif // TZDB_DISABLED
-
// Implementation of std::chrono::time_zone::get_info(const sys_time<D>&)
sys_info
time_zone::_M_get_sys_info(sys_seconds tp) const
@@ -834,12 +828,72 @@ namespace std::chrono
info.abbrev = ri.format();
string_view letters;
- if (i != infos.begin())
+ if (i != infos.begin() && i[-1].expanded())
+ letters = i[-1].next_letters();
+
+ if (letters.empty())
{
- if (i[-1].expanded())
- letters = i[-1].next_letters();
- // XXX else need to find Rule active before this time and use it
- // to know the initial offset, save, and letters.
+ sys_seconds t = info.begin - seconds(1);
+ const year_month_day date(chrono::floor<days>(t));
+
+ // Try to find a Rule active before this time, to get initial
+ // SAVE and LETTERS values. There may not be a Rule for the period
+ // before the first DST transition, so find the earliest DST->STD
+ // transition and use the LETTERS from that.
+ const Rule* active_rule = nullptr;
+ sys_seconds active_rule_start = sys_seconds::min();
+ const Rule* first_std = nullptr;
+ for (const auto& rule : rules)
+ {
+ if (rule.save == minutes(0))
+ {
+ if (!first_std)
+ first_std = &rule;
+ else if (rule.from < first_std->from)
+ first_std = &rule;
+ else if (rule.from == first_std->from)
+ {
+ if (rule.start_time(rule.from, {})
+ < first_std->start_time(first_std->from, {}))
+ first_std = &rule;
+ }
+ }
+
+ year y = date.year();
+
+ if (y > rule.to) // rule no longer applies at time t
+ continue;
+ if (y < rule.from) // rule doesn't apply yet at time t
+ continue;
+
+ sys_seconds rule_start;
+
+ seconds offset{}; // appropriate for at_time::Universal
+ if (rule.when.indicator == at_time::Wall)
+ offset = info.offset;
+ else if (rule.when.indicator == at_time::Standard)
+ offset = ri.offset();
+
+ // Time the rule takes effect this year:
+ rule_start = rule.start_time(y, offset);
+
+ if (rule_start >= t && rule.from < y)
+ {
+ // Try this rule in the previous year.
+ rule_start = rule.start_time(--y, offset);
+ }
+
+ if (active_rule_start < rule_start && rule_start < t)
+ {
+ active_rule_start = rule_start;
+ active_rule = &rule;
+ }
+ }
+
+ if (active_rule)
+ letters = active_rule->letters;
+ else if (first_std)
+ letters = first_std->letters;
}
const Rule* curr_rule = nullptr;
@@ -2064,9 +2118,11 @@ namespace std::chrono
istringstream in2(std::move(rules));
in2 >> rules_time;
inf.m_save = duration_cast<minutes>(rules_time.time);
+ // If the FORMAT is "STD/DST" then we can choose the right one
+ // now, so that we store a shorter string.
select_std_or_dst_abbrev(fmt, inf.m_save);
}
- inf.set_abbrev(fmt);
+ inf.set_abbrev(std::move(fmt));
}
// YEAR [MONTH [DAY [TIME]]]
@@ -2077,7 +2133,12 @@ namespace std::chrono
abbrev_month m{January};
int d = 1;
at_time t{};
+ // XXX DAY should support ON format, e.g. lastSun or Sun>=8
in >> m >> d >> t;
+ // XXX UNTIL field should be interpreted
+ // "using the rules in effect just before the transition"
+ // so might need to store as year_month_day and hh_mm_ss and only
+ // convert to a sys_time once we know the offset in effect.
inf.m_until = sys_days(year(y)/m.m/day(d)) + seconds(t.time);
}
else
diff --git a/libstdc++-v3/testsuite/std/time/time_zone/sys_info_abbrev.cc b/libstdc++-v3/testsuite/std/time/time_zone/sys_info_abbrev.cc
new file mode 100644
index 000000000000..f1a8fff02f58
--- /dev/null
+++ b/libstdc++-v3/testsuite/std/time/time_zone/sys_info_abbrev.cc
@@ -0,0 +1,106 @@
+// { dg-do run { target c++20 } }
+// { dg-require-effective-target tzdb }
+// { dg-require-effective-target cxx11_abi }
+// { dg-xfail-run-if "no weak override on AIX" { powerpc-ibm-aix* } }
+
+#include <chrono>
+#include <fstream>
+#include <testsuite_hooks.h>
+
+static bool override_used = false;
+
+namespace __gnu_cxx
+{
+ const char* zoneinfo_dir_override() {
+ override_used = true;
+ return "./";
+ }
+}
+
+using namespace std::chrono;
+
+void
+test_format()
+{
+ std::ofstream("tzdata.zi") << R"(# version test_1
+Zone Africa/Bissau -1:2:20 - LMT 1912 Ja 1 1u
+ -1 - %z 1975
+ 0 - GMT
+Zon Some/Zone 1:2:3 - %z 1900
+ 1:23:45 - %z 1950
+Zo Another/Zone 1:2:3 - AZ0 1901
+ 1 Roolz A%sZ 2000
+ 1 Roolz SAZ/DAZ 2005
+ 1 Roolz %z
+Rule Roolz 1950 max - April 1 2 1 D
+Rul Roolz 1950 max - Oct 1 1 0 S
+Z Strange/Zone 1 - X%sX 1980
+ 1 - FOO/BAR 1990
+ 2:00 - %zzz 1995
+ 0:9 - %zzz 1996
+ 0:8:7 - %zzz 1997
+ 0:6:5.5 - %zzz 1998
+)";
+
+ const auto& db = reload_tzdb();
+ VERIFY( override_used ); // If this fails then XFAIL for the target.
+ VERIFY( db.version == "test_1" );
+
+ // Test formatting %z as
+ auto tz = locate_zone("Africa/Bissau");
+ auto inf = tz->get_info(sys_days(1974y/1/1));
+ VERIFY( inf.abbrev == "-01" );
+
+ tz = locate_zone("Some/Zone");
+ inf = tz->get_info(sys_days(1899y/1/1));
+ VERIFY( inf.abbrev == "+010203" );
+ inf = tz->get_info(sys_days(1955y/1/1));
+ VERIFY( inf.abbrev == "+012345" );
+
+ tz = locate_zone("Another/Zone");
+ // Test formatting %s as the LETTER/S field from the active Rule.
+ inf = tz->get_info(sys_days(1910y/January/1));
+ VERIFY( inf.abbrev == "ASZ" );
+ inf = tz->get_info(sys_days(1950y/January/1));
+ VERIFY( inf.abbrev == "ASZ" );
+ inf = tz->get_info(sys_days(1950y/June/1));
+ VERIFY( inf.abbrev == "ADZ" );
+ inf = tz->get_info(sys_days(1999y/January/1));
+ VERIFY( inf.abbrev == "ASZ" );
+ inf = tz->get_info(sys_days(1999y/July/1));
+ VERIFY( inf.abbrev == "ADZ" );
+ // Test formatting STD/DST according to the active Rule.
+ inf = tz->get_info(sys_days(2000y/January/2));
+ VERIFY( inf.abbrev == "SAZ" );
+ inf = tz->get_info(sys_days(2001y/January/1));
+ VERIFY( inf.abbrev == "SAZ" );
+ inf = tz->get_info(sys_days(2001y/July/1));
+ VERIFY( inf.abbrev == "DAZ" );
+ // Test formatting %z as the offset determined by the active Rule.
+ inf = tz->get_info(sys_days(2005y/January/2));
+ VERIFY( inf.abbrev == "+01" );
+ inf = tz->get_info(sys_days(2006y/January/1));
+ VERIFY( inf.abbrev == "+01" );
+ inf = tz->get_info(sys_days(2006y/July/1));
+ VERIFY( inf.abbrev == "+02" );
+
+ // Test formatting %z, %s and S/D for a Zone with no associated Rules.
+ tz = locate_zone("Strange/Zone");
+ inf = tz->get_info(sys_days(1979y/January/1));
+ VERIFY( inf.abbrev == "XX" ); // No Rule means nothing to use for %s.
+ inf = tz->get_info(sys_days(1981y/July/1));
+ VERIFY( inf.abbrev == "FOO" ); // Always standard time means first string.
+ inf = tz->get_info(sys_days(1994y/July/1));
+ VERIFY( inf.abbrev == "+02zz" );
+ inf = tz->get_info(sys_days(1995y/July/1));
+ VERIFY( inf.abbrev == "+0009zz" );
+ inf = tz->get_info(sys_days(1996y/July/1));
+ VERIFY( inf.abbrev == "+000807zz" );
+ inf = tz->get_info(sys_days(1997y/July/1));
+ VERIFY( inf.abbrev == "+000606zz" );
+}
+
+int main()
+{
+ test_format();
+}
diff --git a/libstdc++-v3/testsuite/std/time/tzdb/1.cc b/libstdc++-v3/testsuite/std/time/tzdb/1.cc
index 5f69e182603d..73d316f55708 100644
--- a/libstdc++-v3/testsuite/std/time/tzdb/1.cc
+++ b/libstdc++-v3/testsuite/std/time/tzdb/1.cc
@@ -40,11 +40,15 @@ test_locate()
const tzdb& db = get_tzdb();
const time_zone* tz = db.locate_zone("GMT");
VERIFY( tz != nullptr );
- VERIFY( tz->name() == "Etc/GMT" );
VERIFY( tz == std::chrono::locate_zone("GMT") );
VERIFY( tz == db.locate_zone("Etc/GMT") );
VERIFY( tz == db.locate_zone("Etc/GMT+0") );
+ // Since 2022f GMT is now a Zone and Etc/GMT a link instead of vice versa,
+ // but only when using the vanguard format. As of 2024a, the main and
+ // rearguard formats still have Etc/GMT as a Zone and GMT as a link.
+ VERIFY( tz->name() == "GMT" || tz->name() == "Etc/GMT" );
+
VERIFY( db.locate_zone(db.current_zone()->name()) == db.current_zone() );
}
--
2.43.5

View file

@ -3,41 +3,73 @@
# which use the version number.
pkgname=gcc
version=13.2.0
revision=3
version=14.2.1+20250405
revision=1
bootstrap=yes
_patchver="${version%+*}"
_minorver="${version%.*}"
_majorver="${_minorver%.*}"
_gmp_version=6.3.0
_mpfr_version=4.2.1
_mpc_version=1.3.1
_isl_version=0.26
create_wrksrc=yes
short_desc="GNU Compiler Collection"
maintainer="Enno Boland <gottox@voidlinux.org>"
homepage="http://gcc.gnu.org"
license="GFDL-1.2-or-later, GPL-3.0-or-later, LGPL-2.1-or-later"
# *-musl builders have issues fetching https://ftp.gnu.org/gnu/mpc/mpc-1.1.0.tar.gz
distfiles="
${GNU_SITE}/gcc/gcc-${version}/gcc-${version}.tar.xz
case "${version}" in
*+*) distfiles="https://gcc.gnu.org/pub/gcc/snapshots/${_majorver}-${version#*+}/gcc-${_majorver}-${version#*+}.tar.xz" ;;
*) distfiles="${GNU_SITE}/gcc/gcc-${version}.tar.xz" ;;
esac
distfiles+="
${GNU_SITE}/gmp/gmp-${_gmp_version}.tar.xz
${GNU_SITE}/mpfr/mpfr-${_mpfr_version}.tar.xz
${GNU_SITE}/mpc/mpc-${_mpc_version}.tar.gz
${SOURCEFORGE_SITE}/libisl/isl-${_isl_version}.tar.bz2"
checksum="e275e76442a6067341a27f04c5c6b83d8613144004c0413528863dc6b5c743da
checksum="9a84b0947d8fb18197eef3fce8e255e30a61f7f382cebb961b1705c1d99214a3
a3c2b80201b89e68616f4ad30bc66aee4927c3ce50e33929ca819d5c43538898
277807353a6726978996945af13e52829e3abd7a9a5b7fb2793894e18f1fcbb2
ab642492f5cf882b74aa0cb730cd410a81edcdbec895183ce930e706c1c759b8
5eac8664e9d67be6bd0bee5085d6840b8baf738c06814df47eaf4166d9776436"
skip_extraction="gmp-${_gmp_version}.tar.xz mpfr-${_mpfr_version}.tar.xz
mpc-${_mpc_version}.tar.gz isl-${_isl_version}.tar.bz2"
# Snapshot tarballs get removed after over a year, we can archive the ones we need in distfiles.
case "$XBPS_DISTFILES_FALLBACK" in
*"repo-default.voidlinux.org/distfiles"*) ;;
*) XBPS_DISTFILES_FALLBACK+=" https://repo-default.voidlinux.org/distfiles" ;;
esac
nopie=yes
lib32disabled=yes
bootstrap=yes
replaces="gcc-gcj<7.2.0 gcc-gcj-jdk-compat<7.2.0 libmpx>=0 libmpx-devel>=0
libssp>=0 libssp-devel>=0"
if [ "$CHROOT_READY" ]; then
hostmakedepends="tar texinfo perl flex"
else
# libzstd fails to link in bootstrap with glibc 2.36
# when zlib has been compiled with glibc 2.32.
LDFLAGS="-lzstd -pthread"
fi
makedepends="zlib-devel libzstd-devel"
depends="binutils libgcc-devel-${version}_${revision}
libstdc++-devel-${version}_${revision} libatomic-devel-${version}_${revision}"
checkdepends="dejagnu"
subpackages="libgcc libgomp libgomp-devel libatomic libatomic-devel"
build_options="ada gnatboot"
build_options_default="ada"
desc_option_ada="Enable Ada build"
desc_option_gnatboot="Enable Ada bootstrap using adacore.com binaries"
_have_gccgo=yes
_have_libquadmath=no
case "$XBPS_TARGET_MACHINE" in
i686*|x86_64*|ppc64le*) _have_libquadmath=yes ;;
esac
# MIPS is untested and does not have go in crosstoolchains
# 32-bit PowerPC seems weirdly broken since the 10.x release
# 32-bit little endian PowerPC has no support at all (no GOARCH)
@ -46,42 +78,20 @@ case "$XBPS_TARGET_MACHINE" in
mips*-musl|ppc*) _have_gccgo=no ;;
esac
case "$XBPS_TARGET_MACHINE" in
i686*|x86_64*|ppc64le*) _have_libquadmath=yes ;;
esac
if [ "$CHROOT_READY" ]; then
hostmakedepends="tar texinfo perl flex"
else
_have_gccgo=no
# libzstd fails to link in bootstrap with glibc 2.36
# when zlib has been compiled with glibc 2.32.
LDFLAGS="-lzstd -pthread"
fi
makedepends="zlib-devel libzstd-devel"
depends="binutils libgcc-devel-${version}_${revision}
libstdc++-devel-${version}_${revision} libatomic-devel-${version}_${revision}"
checkdepends="dejagnu"
subpackages="libgcc libgomp libgomp-devel libatomic libatomic-devel"
build_options="ada gnatboot"
build_options_default="ada"
desc_option_ada="Enable Ada build"
desc_option_gnatboot="Enable Ada bootstrap using adacore.com binaries"
if [ "$build_option_gnatboot" ]; then
case "$XBPS_TARGET_MACHINE" in
x86_64)
_gnat_tarball="gnat-gpl-2017-x86_64-linux-bin.tar.gz"
distfiles+=" https://community.download.adacore.com/v1/9682e2e1f2f232ce03fe21d77b14c37a0de5649b?filename=$_gnat_tarball>$_gnat_tarball"
checksum+=" b942bcac20dea39748b39f8b624d9619f60a8dee2e8195dbe3829c835b0956e6"
skip_extraction+=" $_gnat_tarball"
build_options_default="gnatboot"
;;
i686)
_gnat_tarball="gnat-gpl-2014-x86-linux-bin.tar.gz"
distfiles+=" https://community.download.adacore.com/v1/c5e9e6fdff5cb77ed90cf8c62536653e27c0bed6?filename=$_gnat_tarball>$_gnat_tarball"
checksum+=" 3b693510f5d22a240abb3034934c1adbd80ccd6e4f61a4f491cc408fdfd9c042"
skip_extraction+=" $_gnat_tarball"
build_options_default="gnatboot"
;;
esac
@ -90,10 +100,11 @@ fi
if [ "$CHROOT_READY" ]; then
subpackages+=" gcc-fortran libgfortran-devel libgfortran"
subpackages+=" gcc-objc gcc-objc++ libobjc-devel libobjc"
if [ "$_have_libquadmath" = "yes" ]; then
subpackages+=" libquadmath libquadmath-devel"
fi
else
_have_gccgo=no
fi
if [ "$_have_gccgo" = "yes" ]; then
@ -162,18 +173,14 @@ if [ "$CROSS_BUILD" ]; then
fi
post_extract() {
mv gcc-${version}/* gcc-${version}/.??* .
rmdir gcc-${version}
mv gmp-${_gmp_version} gmp
mv mpfr-${_mpfr_version} mpfr
mv mpc-${_mpc_version} mpc
mv isl-${_isl_version} isl
vsrcextract -C gmp gmp-${_gmp_version}.tar.xz
vsrcextract -C mpfr mpfr-${_mpfr_version}.tar.xz
vsrcextract -C mpc mpc-${_mpc_version}.tar.gz
vsrcextract -C isl isl-${_isl_version}.tar.bz2
if [ "$build_option_gnatboot" ]; then
local f="${XBPS_SRCDISTDIR}/${pkgname}-${version}/${_gnat_tarball}"
msg_normal "Extracting ${_gnat_tarball} ...\n"
mkdir -p ${wrksrc}/gnat-ins
tar -x -f "$f" --strip-components=1 -C ${wrksrc}/gnat-ins
vsrcextract -C gnat-ins ${_gnat_tarball}
cd ${wrksrc}/gnat-ins
make ins-all prefix=${wrksrc}/gnat
cd ${wrksrc}
@ -202,6 +209,7 @@ pre_configure() {
done
fi
}
do_configure() {
local _langs _args _hash
@ -307,6 +315,10 @@ do_configure() {
mkdir -p build
cd build
if [ "$build_option_gnatboot" ]; then
# file-prefix-map isn't supported in gcc6
export CFLAGS="${CFLAGS/-ffile-prefix-map=$wrksrc=./}"
export CXXFLAGS="${CXXFLAGS/-ffile-prefix-map=$wrksrc=./}"
_args+=" --enable-languages=${_langs},ada"
_args+=" --enable-libada"
CONFIG_SHELL=/bin/bash \
@ -325,6 +337,7 @@ do_configure() {
${wrksrc}/configure ${_args}
fi
}
do_build() {
if [ -z "$CHROOT_READY" ]; then
export LD_LIBRARY_PATH="${XBPS_MASTERDIR}/usr/lib${XBPS_TARGET_WORDSIZE}"
@ -340,6 +353,7 @@ do_build() {
make ${makejobs}
fi
}
pre_install() {
if [ "$CROSS_BUILD" ]; then
# XXX otherwise links to host libpthread
@ -348,6 +362,7 @@ pre_install() {
done
fi
}
do_install() {
cd build
@ -355,16 +370,16 @@ do_install() {
# Make version a symlink of major version to make all versions
# from the same series work automagically.
mv ${DESTDIR}/usr/lib/gcc/${_triplet}/${version} \
mv ${DESTDIR}/usr/lib/gcc/${_triplet}/${_patchver} \
${DESTDIR}/usr/lib/gcc/${_triplet}/${_minorver}
ln -sfr ${DESTDIR}/usr/lib/gcc/${_triplet}/${_minorver} \
${DESTDIR}/usr/lib/gcc/${_triplet}/${version}
${DESTDIR}/usr/lib/gcc/${_triplet}/${_patchver}
# Ditto for c++ headers.
mv ${DESTDIR}/usr/include/c++/${version} \
mv ${DESTDIR}/usr/include/c++/${_patchver} \
${DESTDIR}/usr/include/c++/${_minorver}
ln -sfr ${DESTDIR}/usr/include/c++/${_minorver} \
${DESTDIR}/usr/include/c++/${version}
${DESTDIR}/usr/include/c++/${_patchver}
# cc symlink
ln -sfr ${DESTDIR}/usr/bin/gcc ${DESTDIR}/usr/bin/cc
@ -373,7 +388,7 @@ do_install() {
# lto plugin symlink
vmkdir usr/lib/bfd-plugins
ln -sfr ${DESTDIR}/usr/lib/gcc/${_triplet}/${version}/liblto_plugin.so \
ln -sfr ${DESTDIR}/usr/lib/gcc/${_triplet}/${_patchver}/liblto_plugin.so \
${DESTDIR}/usr/lib/bfd-plugins
# Remove "fixed" header
@ -457,7 +472,7 @@ gcc-fortran_package() {
if [ "$CROSS_BUILD" ]; then
# A number of OMP modules are not built when cross
# compiling gcc. Copy them from the cross compiler.
local src="/usr/lib/gcc/${_triplet}/${version}/finclude"
local src="/usr/lib/gcc/${_triplet}/${_patchver}/finclude"
local dst="usr/lib/gcc/${_triplet}/${_minorver}/finclude"
for f in omp_lib.f90 omp_lib.h omp_lib.mod omp_lib_kinds.mod \
openacc.f90 openacc.mod openacc_kinds.mod openacc_lib.h; do
@ -714,7 +729,7 @@ libstdc++_package() {
short_desc+=" - Standard C++ Library"
pkg_install() {
vmove usr/share/gdb
vmove usr/share/gcc-${version}/python
vmove usr/share/gcc-${_patchver}/python
vmove "usr/lib/libstdc++.so*"
vlicense COPYING.RUNTIME RUNTIME.LIBRARY.EXCEPTION
}