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

Bernd Moessner berndmoessner80 at gmail.com
Fri Jan 19 20:31:55 UTC 2024


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.


Regards

Bernd




More information about the devel mailing list