Latest toolchain throws error when including newlib's regex.h

Sebastian Huber sebastian.huber at embedded-brains.de
Sat Jan 20 15:49:21 UTC 2024



On 19.01.24 21:31, Bernd Moessner wrote:
> Dear all,
> 
> I'm currently encountering an issue with the latest RTEMS toolchain (GCC 
> 13) while attempting to build GoogleTest.
> 
> Simple example, test.cpp with the following content:
> 
> #include <sys/types.h>
> #include <regex.h>
> 
> compiled with
> 
> ~/quick-start/install/tools/toolchain-arm/bin/arm-rtems6-g++ test.cpp
> 
> gives me:
> 
> In file included from test.cpp:2:
> /home/blofeld/quick-start/install/tools/toolchain-arm/arm-rtems6/include/regex.h:99:45: error: expected primary-expression before '__restrict'
>     99 |                         size_t, regmatch_t [__restrict], int);
>        |                                             ^~~~~~~~~~
> /home/blofeld/quick-start/install/tools/toolchain-arm/arm-rtems6/include/regex.h:99:45: error: expected ']' before '__restrict'
>     99 |                         size_t, regmatch_t [__restrict], int);
>        |                                             ^~~~~~~~~~
>        |                                             ]
> /home/blofeld/quick-start/install/tools/toolchain-arm/arm-rtems6/include/regex.h:99:45: error: expected ')' before '__restrict'
>     99 |                         size_t, regmatch_t [__restrict], int);
>        |                                             ^~~~~~~~~~
>        |                                             )
> /home/blofeld/quick-start/install/tools/toolchain-arm/arm-rtems6/include/regex.h:98:16: note: to match this '('
>     98 | int     regexec(const regex_t *__restrict, const char *__restrict,
>        |                ^
> /home/blofeld/quick-start/install/tools/toolchain-arm/arm-rtems6/include/regex.h:99:55: error: expected initializer before ']' token
>     99 |                         size_t, regmatch_t [__restrict], int);
> 
> 
> Is rejecting " [__restrict] " a bug in GCC, or should the signature of 
> newlib`s /newlib/libc/include/regex.h be changed from
> 
> int    regexec(const regex_t *__restrict, const char *__restrict,
>              size_t, regmatch_t [__restrict], int);
> 
> to
> 
> int    regexec(const regex_t *__restrict, const char *__restrict,
>              size_t, regmatch_t __restrict *, int);
> 
> ? I would appreciate any insights or guidance you could provide on this 
> matter.

I would look at the pre-processed file (for example using 
-save-temps=obj). Then I would send a patch fixing the issue to the 
Newlib mailing list.

-- 
embedded brains GmbH & Co. KG
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.huber at embedded-brains.de
phone: +49-89-18 94 741 - 16
fax:   +49-89-18 94 741 - 08

Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/


More information about the devel mailing list