This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
fixinc: Remove gnu-regex.[ch]
- From: "Zack Weinberg" <zack at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 08 Jul 2003 13:41:41 -0700
- Subject: fixinc: Remove gnu-regex.[ch]
Now that libiberty includes a regexp engine, there is no need for
fixinc to have its own copy. And the version in libiberty is newer
and faster, so getting rid of it is a double win.
It was necessary to tweak a couple of regexps in inclhack.def; the
newer library is pickier about unescaped { } with something other than
a range expression inside.
Tested with 'make stmp-fixinc' on i686-linux.
zw
* Makefile.in (fixinc.sh): Remove gnu-regex.[ch] from dependencies.
* fixinc/Makefile.in: Remove all references to gnu-regex.[och].
* fixinc/fixfixes.c, fixinc/fixincl.c, fixinc/fixlib.c
* fixinc/fixtests.c: Use xregexec not regexec, xregcomp not regcomp.
* fixinc/fixlib.h: Include xregex.h not gnu-regex.h.
* fixinc/inclhack.def (hpux10_cpp_pow_inline, hpux11_cpp_pow_inline):
Escape { and } characters which are not part of range expressions.
* fixinc/fixincl.x: Regenerate.
===================================================================
Index: Makefile.in
--- Makefile.in 8 Jul 2003 17:47:16 -0000 1.1106
+++ Makefile.in 8 Jul 2003 20:36:33 -0000
@@ -2507,8 +2507,7 @@ fixinc.sh-warn = -Wno-error
FIXINCSRCDIR=$(srcdir)/fixinc
fixinc.sh: $(FIXINCSRCDIR)/mkfixinc.sh $(FIXINCSRCDIR)/fixincl.c \
- $(FIXINCSRCDIR)/procopen.c $(FIXINCSRCDIR)/gnu-regex.c \
- $(FIXINCSRCDIR)/server.c $(FIXINCSRCDIR)/gnu-regex.h \
+ $(FIXINCSRCDIR)/procopen.c $(FIXINCSRCDIR)/server.c \
$(FIXINCSRCDIR)/server.h $(FIXINCSRCDIR)/inclhack.def specs.ready
(MAKE="$(MAKE)"; srcdir=`cd $(srcdir)/fixinc && ${PWD_COMMAND}` ; \
CC="$(CC_FOR_BUILD)"; CFLAGS="$(BUILD_CFLAGS)"; LDFLAGS="$(BUILD_LDFLAGS)"; \
===================================================================
Index: fixinc/Makefile.in
--- fixinc/Makefile.in 23 May 2003 20:48:48 -0000 1.41
+++ fixinc/Makefile.in 8 Jul 2003 20:36:34 -0000
@@ -68,12 +68,12 @@ INCLUDES = -I. -I.. -I$(srcdir) -I$(srcd
LIBERTY = ../../libiberty/libiberty.a
ALLOBJ = fixincl.o fixtests.o fixfixes.o server.o procopen.o \
- gnu-regex.o fixlib.o
+ fixlib.o
-TESTOBJ = fixincl.o fixlib.o fixtests.o gnu-regex.o
-FIXOBJ = fixfixes.o fixlib.o gnu-regex.o
+TESTOBJ = fixincl.o fixlib.o fixtests.o
+FIXOBJ = fixfixes.o fixlib.o
-HDR = server.h gnu-regex.h fixlib.h machname.h
+HDR = server.h fixlib.h machname.h
FI = fixincl@build_exeext@
AF = applyfix@build_exeext@
@@ -96,8 +96,6 @@ $(AF): $(FIXOBJ) $(LIBERTY)
# String length warnings
fixincl.o-warn = -Wno-error
-# Signed/Unsigned warnings, but in code pulled from upstream.
-gnu-regex.o-warn = -Wno-error
$(ALLOBJ) : $(HDR)
fixincl.o : fixincl.c $(srcdir)/fixincl.x
@@ -105,7 +103,6 @@ fixtests.o : fixtests.c
fixfixes.o : fixfixes.c $(srcdir)/fixincl.x
server.o : server.c
procopen.o : procopen.c
-gnu-regex.o : gnu-regex.c
fixlib.o : fixlib.c
# 'machname.h' is built in the build directory.
===================================================================
Index: fixinc/fixfixes.c
--- fixinc/fixfixes.c 23 May 2003 20:48:48 -0000 1.46
+++ fixinc/fixfixes.c 8 Jul 2003 20:36:35 -0000
@@ -291,7 +291,7 @@ FIX_PROC_HEAD( format_fix )
* Replace every copy of the text we find
*/
compile_re (pz_pat, &re, 1, "format search-text", "format_fix" );
- while (regexec (&re, text, 10, rm, 0) == 0)
+ while (xregexec (&re, text, 10, rm, 0) == 0)
{
fwrite( text, rm[0].rm_so, 1, stdout );
format_write( pz_fmt, text, rm );
@@ -341,7 +341,7 @@ FIX_PROC_HEAD( char_macro_use_fix )
compile_re (pat, &re, 1, "macro pattern", "char_macro_use_fix");
for (p = text;
- regexec (&re, p, 1, rm, 0) == 0;
+ xregexec (&re, p, 1, rm, 0) == 0;
p = limit + 1)
{
/* p + rm[0].rm_eo is the first character of the macro replacement.
@@ -426,7 +426,7 @@ FIX_PROC_HEAD( char_macro_def_fix )
compile_re (pat, &re, 1, "macro pattern", "fix_char_macro_defines");
for (p = text;
- regexec (&re, p, 1, rm, 0) == 0;
+ xregexec (&re, p, 1, rm, 0) == 0;
p = limit + 1)
{
/* p + rm[0].rm_eo is the first character of the macro name.
@@ -516,7 +516,7 @@ FIX_PROC_HEAD( machine_name_fix )
scratch[1] = '_';
for (base = text;
- regexec (label_re, base, 2, match, 0) == 0;
+ xregexec (label_re, base, 2, match, 0) == 0;
base = limit)
{
base += match[0].rm_eo;
@@ -547,7 +547,7 @@ FIX_PROC_HEAD( machine_name_fix )
if (base == limit)
break;
- if (regexec (name_re, base, 1, match, REG_NOTBOL))
+ if (xregexec (name_re, base, 1, match, REG_NOTBOL))
goto done; /* No remaining match in this file */
/* Match; is it on the line? */
@@ -608,7 +608,7 @@ FIX_PROC_HEAD( wrap_fix )
* IF we do *not* match the no-wrap re, then we have a double negative.
* A double negative means YES.
*/
- if (regexec( &no_wrapping_re, text, 0, NULL, 0 ) != 0)
+ if (xregexec( &no_wrapping_re, text, 0, NULL, 0 ) != 0)
{
/*
* A single file can get wrapped more than once by different fixes.
@@ -690,7 +690,7 @@ FIX_PROC_HEAD( gnu_type_fix )
compile_re (pz_pat, &re, 1, "gnu type typedef", "gnu_type_fix");
- while (regexec (&re, text, GTYPE_SE_CT+1, rm, 0) == 0)
+ while (xregexec (&re, text, GTYPE_SE_CT+1, rm, 0) == 0)
{
text = emit_gnu_type (text, rm);
}
===================================================================
Index: fixinc/fixincl.c
--- fixinc/fixincl.c 23 May 2003 20:48:48 -0000 1.61
+++ fixinc/fixincl.c 8 Jul 2003 20:36:35 -0000
@@ -693,7 +693,7 @@ egrep_test (pz_data, p_test)
fprintf (stderr, "fixincl ERROR RE not compiled: `%s'\n",
p_test->pz_test_text);
#endif
- if (regexec (p_test->p_test_regex, pz_data, 0, 0, 0) == 0)
+ if (xregexec (p_test->p_test_regex, pz_data, 0, 0, 0) == 0)
return APPLY_FIX;
return SKIP_FIX;
}
@@ -808,7 +808,7 @@ extract_quoted_files (pz_data, pz_fixed_
}
/* Find the next entry */
- if (regexec (&incl_quote_re, pz_incl_quot, 1, p_re_match, 0) != 0)
+ if (xregexec (&incl_quote_re, pz_incl_quot, 1, p_re_match, 0) != 0)
break;
}
}
@@ -1315,7 +1315,7 @@ test_for_changes (read_fd)
/* Close the file and see if we have to worry about
`#include "file.h"' constructs. */
fclose (out_fp);
- if (regexec (&incl_quote_re, pz_curr_data, 1, &match, 0) == 0)
+ if (xregexec (&incl_quote_re, pz_curr_data, 1, &match, 0) == 0)
extract_quoted_files (pz_curr_data, pz_curr_file, &match);
}
===================================================================
Index: fixinc/fixlib.c
--- fixinc/fixlib.c 23 May 2003 20:48:48 -0000 1.17
+++ fixinc/fixlib.c 8 Jul 2003 20:36:35 -0000
@@ -131,7 +131,7 @@ template[ \t]*<|\
if (!compiled)
compile_re (cxxpat, &cxxre, 0, "contents check", "is_cxx_header");
- if (regexec (&cxxre, text, 0, 0, 0) == 0)
+ if (xregexec (&cxxre, text, 0, 0, 0) == 0)
return BOOL_TRUE;
}
@@ -181,7 +181,7 @@ skip_quote( q, text )
Compile one regular expression pattern for later use. PAT contains
the pattern, RE points to a regex_t structure (which should have
been bzeroed). MATCH is 1 if we need to know where the regex
- matched, 0 if not. If regcomp fails, prints an error message and
+ matched, 0 if not. If xregcomp fails, prints an error message and
aborts; E1 and E2 are strings to shove into the error message.
The patterns we search for are all egrep patterns.
@@ -201,7 +201,7 @@ compile_re( pat, re, match, e1, e2 )
flags = (match ? REG_EXTENDED|REG_NEWLINE
: REG_EXTENDED|REG_NEWLINE|REG_NOSUB);
- err = regcomp (re, pat, flags);
+ err = xregcomp (re, pat, flags);
if (err)
{
===================================================================
Index: fixinc/fixlib.h
--- fixinc/fixlib.h 23 May 2003 20:48:48 -0000 1.27
+++ fixinc/fixlib.h 8 Jul 2003 20:36:35 -0000
@@ -32,7 +32,7 @@ Boston, MA 02111-1307, USA. */
#include "tm.h"
#include <signal.h>
-#include "gnu-regex.h"
+#include "xregex.h"
#include "machname.h"
#include "libiberty.h"
===================================================================
Index: fixinc/fixtests.c
--- fixinc/fixtests.c 23 May 2003 20:48:48 -0000 1.29
+++ fixinc/fixtests.c 8 Jul 2003 20:36:35 -0000
@@ -82,7 +82,7 @@ TEST_FOR_FIX_PROC_HEAD( machine_name_tes
mn_get_regexps(&label_re, &name_re, "machine_name_test");
for (base = text;
- regexec (label_re, base, 2, match, 0) == 0;
+ xregexec (label_re, base, 2, match, 0) == 0;
base = limit)
{
base += match[0].rm_eo;
@@ -107,7 +107,7 @@ TEST_FOR_FIX_PROC_HEAD( machine_name_tes
shouldn't matter since the name_re has no ^ anchor, but let's
be accurate anyway. */
- if (regexec (name_re, base, 1, match, REG_NOTBOL))
+ if (xregexec (name_re, base, 1, match, REG_NOTBOL))
return SKIP_FIX; /* No match in file - no fix needed */
/* Match; is it on the line? */
===================================================================
Index: fixinc/inclhack.def
--- fixinc/inclhack.def 2 Jul 2003 01:30:10 -0000 1.158
+++ fixinc/inclhack.def 8 Jul 2003 20:36:36 -0000
@@ -1003,11 +1003,11 @@ fix = {
files = fixinc-test-limits.h, math.h;
select = <<- END_POW_INLINE
^# +ifdef +__cplusplus
- +}
- +inline +double +pow\(double +__d,int +__expon\) +{
+ +\}
+ +inline +double +pow\(double +__d,int +__expon\) +\{
[ ]+return +pow\(__d,\(double\)__expon\);
- +}
- +extern +"C" +{
+ +\}
+ +extern +"C" +\{
#else
# +endif
END_POW_INLINE;
@@ -1029,9 +1029,9 @@ fix = {
fix = {
hackname = hpux11_cpp_pow_inline;
files = math.h;
- select = " +inline double pow\\(double d,int expon\\) {\n"
+ select = " +inline double pow\\(double d,int expon\\) \\{\n"
" +return pow\\(d, \\(double\\)expon\\);\n"
- " +}\n";
+ " +\\}\n";
c_fix = format;
c_fix_arg = "";