aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorPaul Eggert2018-12-27 11:45:21 -0800
committerPaul Eggert2018-12-27 11:45:47 -0800
commitee7514b91beb254a7dc62f618046d34036555cea (patch)
tree7299efc4b14731bb30d013bb9594b2e7834b1d8d /lib
parenta8576aba8fa45549985566bc8be4921dce508dd9 (diff)
downloademacs-ee7514b91beb254a7dc62f618046d34036555cea.tar.gz
emacs-ee7514b91beb254a7dc62f618046d34036555cea.zip
Update from Gnulib
* build-aux/config.guess, lib/regcomp.c, lib/regex.c: * lib/regex_internal.h, lib/regexec.c: Copy from Gnulib.
Diffstat (limited to 'lib')
-rw-r--r--lib/regcomp.c16
-rw-r--r--lib/regex.c4
-rw-r--r--lib/regex_internal.h12
-rw-r--r--lib/regexec.c6
4 files changed, 8 insertions, 30 deletions
diff --git a/lib/regcomp.c b/lib/regcomp.c
index 0b05a63b632..2672ffcc37a 100644
--- a/lib/regcomp.c
+++ b/lib/regcomp.c
@@ -233,9 +233,7 @@ re_compile_pattern (const char *pattern, size_t length,
233 return NULL; 233 return NULL;
234 return gettext (__re_error_msgid + __re_error_msgid_idx[(int) ret]); 234 return gettext (__re_error_msgid + __re_error_msgid_idx[(int) ret]);
235} 235}
236#ifdef _LIBC
237weak_alias (__re_compile_pattern, re_compile_pattern) 236weak_alias (__re_compile_pattern, re_compile_pattern)
238#endif
239 237
240/* Set by 're_set_syntax' to the current regexp syntax to recognize. Can 238/* Set by 're_set_syntax' to the current regexp syntax to recognize. Can
241 also be assigned to arbitrarily: each pattern buffer stores its own 239 also be assigned to arbitrarily: each pattern buffer stores its own
@@ -260,9 +258,7 @@ re_set_syntax (reg_syntax_t syntax)
260 re_syntax_options = syntax; 258 re_syntax_options = syntax;
261 return ret; 259 return ret;
262} 260}
263#ifdef _LIBC
264weak_alias (__re_set_syntax, re_set_syntax) 261weak_alias (__re_set_syntax, re_set_syntax)
265#endif
266 262
267int 263int
268re_compile_fastmap (struct re_pattern_buffer *bufp) 264re_compile_fastmap (struct re_pattern_buffer *bufp)
@@ -281,9 +277,7 @@ re_compile_fastmap (struct re_pattern_buffer *bufp)
281 bufp->fastmap_accurate = 1; 277 bufp->fastmap_accurate = 1;
282 return 0; 278 return 0;
283} 279}
284#ifdef _LIBC
285weak_alias (__re_compile_fastmap, re_compile_fastmap) 280weak_alias (__re_compile_fastmap, re_compile_fastmap)
286#endif
287 281
288static inline void 282static inline void
289__attribute__ ((always_inline)) 283__attribute__ ((always_inline))
@@ -464,7 +458,7 @@ re_compile_fastmap_iter (regex_t *bufp, const re_dfastate_t *init_state,
464 the return codes and their meanings.) */ 458 the return codes and their meanings.) */
465 459
466int 460int
467regcomp (regex_t *_Restrict_ preg, const char *_Restrict_ pattern, int cflags) 461regcomp (regex_t *__restrict preg, const char *__restrict pattern, int cflags)
468{ 462{
469 reg_errcode_t ret; 463 reg_errcode_t ret;
470 reg_syntax_t syntax = ((cflags & REG_EXTENDED) ? RE_SYNTAX_POSIX_EXTENDED 464 reg_syntax_t syntax = ((cflags & REG_EXTENDED) ? RE_SYNTAX_POSIX_EXTENDED
@@ -515,16 +509,14 @@ regcomp (regex_t *_Restrict_ preg, const char *_Restrict_ pattern, int cflags)
515 509
516 return (int) ret; 510 return (int) ret;
517} 511}
518#ifdef _LIBC
519libc_hidden_def (__regcomp) 512libc_hidden_def (__regcomp)
520weak_alias (__regcomp, regcomp) 513weak_alias (__regcomp, regcomp)
521#endif
522 514
523/* Returns a message corresponding to an error code, ERRCODE, returned 515/* Returns a message corresponding to an error code, ERRCODE, returned
524 from either regcomp or regexec. We don't use PREG here. */ 516 from either regcomp or regexec. We don't use PREG here. */
525 517
526size_t 518size_t
527regerror (int errcode, const regex_t *_Restrict_ preg, char *_Restrict_ errbuf, 519regerror (int errcode, const regex_t *__restrict preg, char *__restrict errbuf,
528 size_t errbuf_size) 520 size_t errbuf_size)
529{ 521{
530 const char *msg; 522 const char *msg;
@@ -555,9 +547,7 @@ regerror (int errcode, const regex_t *_Restrict_ preg, char *_Restrict_ errbuf,
555 547
556 return msg_size; 548 return msg_size;
557} 549}
558#ifdef _LIBC
559weak_alias (__regerror, regerror) 550weak_alias (__regerror, regerror)
560#endif
561 551
562 552
563#ifdef RE_ENABLE_I18N 553#ifdef RE_ENABLE_I18N
@@ -657,10 +647,8 @@ regfree (regex_t *preg)
657 re_free (preg->translate); 647 re_free (preg->translate);
658 preg->translate = NULL; 648 preg->translate = NULL;
659} 649}
660#ifdef _LIBC
661libc_hidden_def (__regfree) 650libc_hidden_def (__regfree)
662weak_alias (__regfree, regfree) 651weak_alias (__regfree, regfree)
663#endif
664 652
665/* Entry points compatible with 4.2 BSD regex library. We don't define 653/* Entry points compatible with 4.2 BSD regex library. We don't define
666 them unless specifically requested. */ 654 them unless specifically requested. */
diff --git a/lib/regex.c b/lib/regex.c
index 2a86e107039..1fccd99f33e 100644
--- a/lib/regex.c
+++ b/lib/regex.c
@@ -20,10 +20,10 @@
20#ifndef _LIBC 20#ifndef _LIBC
21# include <libc-config.h> 21# include <libc-config.h>
22 22
23# if (__GNUC__ == 4 && 6 <= __GNUC_MINOR__) || 4 < __GNUC__ 23# if __GNUC_PREREQ (4, 6)
24# pragma GCC diagnostic ignored "-Wsuggest-attribute=pure" 24# pragma GCC diagnostic ignored "-Wsuggest-attribute=pure"
25# endif 25# endif
26# if (__GNUC__ == 4 && 3 <= __GNUC_MINOR__) || 4 < __GNUC__ 26# if __GNUC_PREREQ (4, 3)
27# pragma GCC diagnostic ignored "-Wold-style-definition" 27# pragma GCC diagnostic ignored "-Wold-style-definition"
28# pragma GCC diagnostic ignored "-Wtype-limits" 28# pragma GCC diagnostic ignored "-Wtype-limits"
29# endif 29# endif
diff --git a/lib/regex_internal.h b/lib/regex_internal.h
index b0e49cd828f..2c5ca29fef4 100644
--- a/lib/regex_internal.h
+++ b/lib/regex_internal.h
@@ -144,10 +144,9 @@
144# define __mbrtowc mbrtowc 144# define __mbrtowc mbrtowc
145# define __wcrtomb wcrtomb 145# define __wcrtomb wcrtomb
146# define __regfree regfree 146# define __regfree regfree
147# define attribute_hidden
148#endif /* not _LIBC */ 147#endif /* not _LIBC */
149 148
150#if __GNUC__ < 3 + (__GNUC_MINOR__ < 1) 149#if !__GNUC_PREREQ (3, 1)
151# define __attribute__(arg) 150# define __attribute__(arg)
152#endif 151#endif
153 152
@@ -868,15 +867,6 @@ re_string_elem_size_at (const re_string_t *pstr, Idx idx)
868} 867}
869#endif /* RE_ENABLE_I18N */ 868#endif /* RE_ENABLE_I18N */
870 869
871#ifndef __GNUC_PREREQ
872# if defined __GNUC__ && defined __GNUC_MINOR__
873# define __GNUC_PREREQ(maj, min) \
874 ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
875# else
876# define __GNUC_PREREQ(maj, min) 0
877# endif
878#endif
879
880#if __GNUC_PREREQ (3,4) 870#if __GNUC_PREREQ (3,4)
881# undef __attribute_warn_unused_result__ 871# undef __attribute_warn_unused_result__
882# define __attribute_warn_unused_result__ \ 872# define __attribute_warn_unused_result__ \
diff --git a/lib/regexec.c b/lib/regexec.c
index c7d099c38e4..5f682695c44 100644
--- a/lib/regexec.c
+++ b/lib/regexec.c
@@ -189,7 +189,7 @@ static reg_errcode_t extend_buffers (re_match_context_t *mctx, int min_len);
189 We return 0 if we find a match and REG_NOMATCH if not. */ 189 We return 0 if we find a match and REG_NOMATCH if not. */
190 190
191int 191int
192regexec (const regex_t *_Restrict_ preg, const char *_Restrict_ string, 192regexec (const regex_t *__restrict preg, const char *__restrict string,
193 size_t nmatch, regmatch_t pmatch[], int eflags) 193 size_t nmatch, regmatch_t pmatch[], int eflags)
194{ 194{
195 reg_errcode_t err; 195 reg_errcode_t err;
@@ -232,8 +232,8 @@ __typeof__ (__regexec) __compat_regexec;
232 232
233int 233int
234attribute_compat_text_section 234attribute_compat_text_section
235__compat_regexec (const regex_t *_Restrict_ preg, 235__compat_regexec (const regex_t *__restrict preg,
236 const char *_Restrict_ string, size_t nmatch, 236 const char *__restrict string, size_t nmatch,
237 regmatch_t pmatch[], int eflags) 237 regmatch_t pmatch[], int eflags)
238{ 238{
239 return regexec (preg, string, nmatch, pmatch, 239 return regexec (preg, string, nmatch, pmatch,