diff --git a/include/regex.h b/include/regex.h index 24eca2c297..d67ec65ad9 100644 --- a/include/regex.h +++ b/include/regex.h @@ -36,8 +36,15 @@ extern void __re_set_registers extern int __regcomp (regex_t *__preg, const char *__pattern, int __cflags); libc_hidden_proto (__regcomp) +#if 199901L <= __STDC_VERSION__ && !defined (__STDC_NO_VLA__) extern int __regexec (const regex_t *__preg, const char *__string, - size_t __nmatch, regmatch_t __pmatch[], int __eflags); + size_t __nmatch, regmatch_t __pmatch[__nmatch], + int __eflags); +#else +extern int __regexec (const regex_t *__preg, const char *__string, + size_t __nmatch, regmatch_t __pmatch[], + int __eflags); +#endif libc_hidden_proto (__regexec) extern size_t __regerror (int __errcode, const regex_t *__preg, diff --git a/posix/regex.h b/posix/regex.h index 14fb1d8364..ebacbaf95d 100644 --- a/posix/regex.h +++ b/posix/regex.h @@ -652,11 +652,17 @@ extern int regcomp (regex_t *_Restrict_ __preg, const char *_Restrict_ __pattern, int __cflags); +#if 199901L <= __STDC_VERSION__ && !defined (__STDC_NO_VLA__) extern int regexec (const regex_t *_Restrict_ __preg, const char *_Restrict_ __String, size_t __nmatch, - regmatch_t __pmatch[_Restrict_arr_], - int __eflags) - __attr_access ((__write_only__, 4, 3)); + regmatch_t __pmatch[_Restrict_arr_ __nmatch], + int __eflags); +#else +extern int regexec (const regex_t *_Restrict_ __preg, + const char *_Restrict_ __String, size_t __nmatch, + regmatch_t __pmatch[_Restrict_arr], + int __eflags); +#endif extern size_t regerror (int __errcode, const regex_t *_Restrict_ __preg, char *_Restrict_ __errbuf, size_t __errbuf_size)