regex uses old (K&R) style function definitions, which causes problems when it is compiled using g++ outside of glibc. For example: g++ -W -Wswitch -Wcomment -Wpointer-arith -Wimplicit -Wreturn-type -Wno-sign-compare -Wno-invalid-offsetof -g -DUNICODE -I. -I. -I.. -DHAVE_CONFIG_H -c regex.c In file included from regex.c:85: regex_internal.c:46: error: `reg_errcode_t re_string_allocate' redeclared as different kind of symbol regex_internal.h:383: error: previous declaration of `reg_errcode_t re_string_allocate(re_string_t*, const char*, int, int, char*, int, const re_dfa_t*)' For more details about the g++ problem, please see Sam Steingold's bug report <http://lists.gnu.org/archive/html/bug-gnulib/2005-08/msg00096.html>. These days there's no longer any reason for regex to use K&R function definition syntax, so I'm installing the attached patch into gnulib. Can you please propagate this into glibc? Thanks.
Created attachment 597 [details] use function prototypes for definitions
> These days there's no longer any reason for regex to use K&R function > definition syntax, Wrong. Using K&R function definitions ensures that the compiler warns about missing prototypes. This is finer grained than a compiler can achieve this. It is simply wrong to use g++ to compile regex.c. Period.
Ulrich Drepper wrote: > Using K&R function definitions ensures that the compiler warns about > missing prototypes. This is finer grained than a compiler can achieve this. Wrong. gcc has two options that warn for missing prototypes, even when ANSI/ISO C function definitions are used: -Wmissing-prototypes and -Wmissing-declarations. Look: ============================== foo.c ========================= int foo(int, int); int foo (int x, int y) { return x + y; } int no_prototype (int x, int y) { return x + y; } ============================================================ $ gcc -Wmissing-declarations -c foo.c foo.c:4: warning: no previous declaration for `no_prototype' $ gcc -Wmissing-prototypes -c foo.c foo.c:4: warning: no previous prototype for `no_prototype' > It is simply wrong to use g++ to compile regex.c. Period. Your attitude hampers the reuse of the code in GNU clisp. Saying "Period" is not a sound technical argument. I'm therefore reopening this issue.
Stop reopening the bug. This is all valid C code. Everybody who misuses the code is on her/his own.