about summary refs log tree commit diff
path: root/misc/regexp.c
diff options
context:
space:
mode:
authorZack Weinberg <zackw@panix.com>2015-08-01 14:38:05 -0400
committerCarlos O'Donell <carlos@systemhalted.org>2015-08-01 14:38:05 -0400
commit2ec11c2b6e92b3622f0dc0a970634156b286ccd8 (patch)
treec42213e95f79504a90f2fffa6defee7077d45265 /misc/regexp.c
parentf4ddb3557e80a193c4169bbaf01a0e7f556098b9 (diff)
downloadglibc-2ec11c2b6e92b3622f0dc0a970634156b286ccd8.tar.gz
glibc-2ec11c2b6e92b3622f0dc0a970634156b286ccd8.tar.xz
glibc-2ec11c2b6e92b3622f0dc0a970634156b286ccd8.zip
Deprecate the use of regexp.h
<regexp.h> (not to be confused with <regex.h>) is an obsolete and
frankly horrible regular expression-matching API.  It was part of SVID
but was withdrawn in Issue 5 (for reference, we're on Issue 7 now).
It doesn't do anything you can't do with <regex.h>, and using it
involves defining a bunch of macros before including the header.
Moreover, the code in regexp.h that uses those macros has been buggy
since its creation (in 1996) and no one has noticed, which indicates
to me that there are no users.  (Specifically, RETURN() is used in a
whole bunch of cases where it should have been ERROR().)

The header is given a warning and marked deprecated for 2.22.

See:
https://sourceware.org/ml/libc-alpha/2015-07/msg00862.html and
https://sourceware.org/ml/libc-alpha/2015-07/msg00871.html.
Diffstat (limited to 'misc/regexp.c')
-rw-r--r--misc/regexp.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/misc/regexp.c b/misc/regexp.c
index 3b83203ced..ee7d572111 100644
--- a/misc/regexp.c
+++ b/misc/regexp.c
@@ -17,8 +17,10 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#define __DO_NOT_DEFINE_COMPILE
-#include <regexp.h>
+/* We don't include regexp.h here because of the macros it requires, and
+   because it now contains an unconditional #warning.  */
+
+#include <regex.h>
 
 /* Define the variables used for the interface.  */
 char *loc1;
@@ -32,7 +34,6 @@ char *locs;
    found in the buffer starting at EXPBUF.  `loc1' will return the
    first character matched and `loc2' points to the next unmatched
    character.  */
-extern int __step (const char *string, const char *expbuf);
 int
 __step (const char *string, const char *expbuf)
 {
@@ -55,7 +56,6 @@ weak_alias (__step, step)
 /* Match the beginning of STRING with the compiled regular expression
    in EXPBUF.  If the match is successful `loc2' will contain the
    position of the first unmatched character.  */
-extern int __advance (const char *string, const char *expbuf);
 int
 __advance (const char *string, const char *expbuf)
 {