about summary refs log tree commit diff
path: root/posix/regex.h
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2020-12-29 17:32:25 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2021-01-04 08:38:52 -0300
commitc2a150d089fa096cb5f9e342da80fb30dc0d1953 (patch)
tree9fc88708b64fb0d2d4a2d5647e865922223cb898 /posix/regex.h
parentfee3b889d88193eb3cebaab2bcf60e39ce84d369 (diff)
downloadglibc-c2a150d089fa096cb5f9e342da80fb30dc0d1953.tar.gz
glibc-c2a150d089fa096cb5f9e342da80fb30dc0d1953.tar.xz
glibc-c2a150d089fa096cb5f9e342da80fb30dc0d1953.zip
posix: Sync regex code with gnulib
It sync with gnulib commit 43ee1a6bf.  The main change is 9682f18e9.
(which does not have a meaniful description).

Checked on x86_64-linux-gnu.
Diffstat (limited to 'posix/regex.h')
-rw-r--r--posix/regex.h17
1 files changed, 12 insertions, 5 deletions
diff --git a/posix/regex.h b/posix/regex.h
index bdc08ec720..8e4ef45578 100644
--- a/posix/regex.h
+++ b/posix/regex.h
@@ -612,7 +612,9 @@ extern int re_exec (const char *);
    'configure' might #define 'restrict' to those words, so pick a
    different name.  */
 #ifndef _Restrict_
-# if defined __restrict || 2 < __GNUC__ + (95 <= __GNUC_MINOR__)
+# if defined __restrict \
+     || 2 < __GNUC__ + (95 <= __GNUC_MINOR__) \
+     || __clang_major__ >= 3
 #  define _Restrict_ __restrict
 # elif 199901L <= __STDC_VERSION__ || defined restrict
 #  define _Restrict_ restrict
@@ -620,13 +622,18 @@ extern int re_exec (const char *);
 #  define _Restrict_
 # endif
 #endif
-/* For [restrict], use glibc's __restrict_arr if available.
-   Otherwise, GCC 3.1 (not in C++ mode) and C99 support [restrict].  */
+/* For the ISO C99 syntax
+     array_name[restrict]
+   use glibc's __restrict_arr if available.
+   Otherwise, GCC 3.1 and clang support this syntax (but not in C++ mode).
+   Other ISO C99 compilers support it as well.  */
 #ifndef _Restrict_arr_
 # ifdef __restrict_arr
 #  define _Restrict_arr_ __restrict_arr
-# elif ((199901L <= __STDC_VERSION__ || 3 < __GNUC__ + (1 <= __GNUC_MINOR__)) \
-        && !defined __GNUG__)
+# elif ((199901L <= __STDC_VERSION__ \
+         || 3 < __GNUC__ + (1 <= __GNUC_MINOR__) \
+         || __clang_major__ >= 3) \
+        && !defined __cplusplus)
 #  define _Restrict_arr_ _Restrict_
 # else
 #  define _Restrict_arr_