aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorBruce Korb <bkorb@gnu.org>2000-05-17 16:31:57 +0000
committerBruce Korb <korbb@gcc.gnu.org>2000-05-17 16:31:57 +0000
commit3f69bd930cb156f6b33e8e9d2126c1f956849370 (patch)
tree64963a44efd21788ca653d5957db8415f99f621d /gcc
parent5e36475b8211f61242ac4840d6ae30ee65c54538 (diff)
downloadgcc-3f69bd930cb156f6b33e8e9d2126c1f956849370.zip
gcc-3f69bd930cb156f6b33e8e9d2126c1f956849370.tar.gz
gcc-3f69bd930cb156f6b33e8e9d2126c1f956849370.tar.bz2
use #def constant for sub-pattern count
From-SVN: r33961
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog4
-rw-r--r--gcc/fixinc/fixfixes.c17
2 files changed, 13 insertions, 8 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index f3e232b..e526541 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -7,7 +7,9 @@
* fixinc/fixincl.c: improve the debug displays, ignore SIGPIPE
* fixinc/server.c: likewise
- * fixinc/fixfixes.c( char_macro_def_fix ): fix regex + #ifdef debugging code
+ * fixinc/fixfixes.c( char_macro_def_fix ): fix regex
+ + #ifdef debugging code + use #def constant for
+ sub-pattern count
* fixinc/inclhack.def( hpux11_fabsf ): Keep HP-UX 11 from stomping
on C++ math namespace
diff --git a/gcc/fixinc/fixfixes.c b/gcc/fixinc/fixfixes.c
index 68ce227..1f81d6a 100644
--- a/gcc/fixinc/fixfixes.c
+++ b/gcc/fixinc/fixfixes.c
@@ -296,11 +296,12 @@ FIX_PROC_HEAD( char_macro_use_fix )
#endif
;
+# define SUB_PAT_CT 1
char *pz_pat;
static regex_t re;
- regmatch_t rm[2];
+ regmatch_t rm[SUB_PAT_CT+1];
if (p_fixd->patch_args[1] == NULL)
{
@@ -316,10 +317,10 @@ FIX_PROC_HEAD( char_macro_use_fix )
exit(3);
}
- compile_re (pz_pat, &re, 2, "macro pattern", "char_macro_use_fix");
+ compile_re (pz_pat, &re, 1, "macro pattern", "char_macro_use_fix");
free (pz_pat);
- while (regexec (&re, text, 3, rm, 0) == 0)
+ while (regexec (&re, text, SUB_PAT_CT+1, rm, 0) == 0)
{
const char* pz = text + rm[1].rm_so;
@@ -334,6 +335,7 @@ FIX_PROC_HEAD( char_macro_use_fix )
}
fputs (text, stdout);
+# undef SUB_PAT_CT
}
@@ -382,8 +384,8 @@ FIX_PROC_HEAD( char_macro_def_fix )
char *pz_pat;
static regex_t re;
-
- regmatch_t rm[3];
+# define SUB_PAT_CT 2
+ regmatch_t rm[SUB_PAT_CT+1];
const char *p;
int rerr;
@@ -404,7 +406,7 @@ FIX_PROC_HEAD( char_macro_def_fix )
compile_re (pz_pat, &re, 1, "macro pattern", "char_macro_def_fix");
#ifdef DEBUG
- if ((rerr = regexec (&re, text, 3, rm, 0)) != 0)
+ if ((rerr = regexec (&re, text, SUB_PAT_CT+1, rm, 0)) != 0)
{
fprintf( stderr, "Match error %d:\n%s\n", rerr, pz_pat );
exit(3);
@@ -413,7 +415,7 @@ FIX_PROC_HEAD( char_macro_def_fix )
free (pz_pat);
- while ((rerr = regexec (&re, text, 3, rm, 0)) == 0)
+ while ((rerr = regexec (&re, text, SUB_PAT_CT+1, rm, 0)) == 0)
{
const char* pz = text + rm[2].rm_so;
@@ -450,6 +452,7 @@ FIX_PROC_HEAD( char_macro_def_fix )
* Emit the rest of the text
*/
fputs (text, stdout);
+# undef SUB_PAT_CT
}
/* Fix for machine name #ifdefs that are not in the namespace reserved