Bug 5200 - regex uses K&R definitions instead of ANSI C
Summary: regex uses K&R definitions instead of ANSI C
Alias: None
Product: glibc
Classification: Unclassified
Component: regex (show other bugs)
Version: unspecified
: P2 normal
Target Milestone: ---
Assignee: Ulrich Drepper
Depends on:
Reported: 2007-10-19 15:16 UTC by sds
Modified: 2014-07-04 07:14 UTC (History)
2 users (show)

See Also:
Last reconfirmed:
fweimer: security-

regexec ansi C patch (1.32 KB, patch)
2007-10-19 15:19 UTC, sds
Details | Diff
regcomp ansi C patch (862 bytes, patch)
2007-10-19 15:20 UTC, sds
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description sds 2007-10-19 15:16:50 UTC
regcomp.c and regexec.c use old K&R function definitions instead of the ANSI C.
this makes it impossible to compile regex with g++.
glibc regex is used by gnulib 
and thus by dozens of packages that import regex from gnulib.
this makes all those packages uncompilable with g++.
(even when the package is plain C, it is useful to compile it
with c++ every now and then to get a better type checking).
I have patched regcomp.c and regexec.c to compile with g++.
I don't see a way to attach a file though.
Comment 1 sds 2007-10-19 15:19:22 UTC
Created attachment 2055 [details]
regexec ansi C patch
Comment 2 sds 2007-10-19 15:20:01 UTC
Created attachment 2056 [details]
regcomp ansi C patch
Comment 3 Ulrich Drepper 2007-10-20 03:29:48 UTC
regex is C code, don't use a C++ compiler.  The use of K&R is deliberate and
will not be changed.