* [fixincludes, patch] PR30008 - fixes are not applied to files in non-standard locations (was: fixinclude fnmatch patch)
@ 2007-01-06 14:44 Daniel Franke
2007-01-06 17:25 ` Bruce Korb
2007-01-06 18:03 ` Bruce Korb
0 siblings, 2 replies; 5+ messages in thread
From: Daniel Franke @ 2007-01-06 14:44 UTC (permalink / raw)
To: gcc-patches; +Cc: Bruce Korb
[-- Attachment #1: Type: text/plain, Size: 1089 bytes --]
:ADDPATCH fixincludes:
Some distributions store files that need fixing in non-standard locations.
Instead of enumerating those locations, this patch allows for wildcards in
the files-section of hacks, e.g.
files = "*features.h"
to match "features.h", "foo/features.h" or "foo/bar/../features.h".
Bootstrapped and regtested on x86_64-pc-linux-gnu and i686-pc-linux-gnu.
Most of the attached patch was provided by Bruce Korb [1], I only contributed
some minor fixes.
2007-01-05 Bruce Korb <bkorb@gnu.org>,
Daniel Franke <franke.daniel@gmail.com>
PR target/30008
* fixincl.tpl: ? (Bruce?)
* fixincl.c (fix_applies, machine_matches): Use fnmatch for pattern matching.
* fixincl.x: Regenerate.
* inclhack.def (glibc_c99_inline_[1234], broken_cabs, broken_nan,
kandr_concat, sco_math): Replace lists of specfic file names by search
patterns.
The patch does not include the changes to the generated file fixincl.x, anyone
applying the patch has to regenerate that file.
Ok for trunk?
Daniel
[1] http://gcc.gnu.org/ml/gcc-patches/2006-12/msg01653.html
[-- Attachment #2: pr30008.diff --]
[-- Type: text/x-diff, Size: 8706 bytes --]
Index: fixincl.tpl
===================================================================
--- fixincl.tpl (revision 120492)
+++ fixincl.tpl (working copy)
@@ -48,7 +48,7 @@
IF (exist? "files")=]
tSCC z[=(. Hack)=]List[] =
- "[=FOR files =]|[=files=][=ENDFOR=]|";[=
+ "[= (join "\\0" (stack "files")) =]\0";[=
ELSE =]
#define z[=(. Hack)=]List (char*)NULL[=
@@ -73,7 +73,7 @@
ELSE =]
#define apz[=(. Hack)=]Machs (const char**)NULL[=
- ENDIF (exist? "files") =][=
+ ENDIF (exist? "mach") =][=
IF (exist? "select")=]
Index: fixincl.c
===================================================================
--- fixincl.c (revision 120492)
+++ fixincl.c (working copy)
@@ -23,6 +23,7 @@
#include "fixlib.h"
+#include <fnmatch.h>
#include <sys/stat.h>
#ifndef SEPARATE_FIX_PROC
#include <sys/wait.h>
@@ -359,90 +360,30 @@
static int
machine_matches( tFixDesc* p_fixd )
- {
-# ifndef SEPARATE_FIX_PROC
- tSCC case_fmt[] = "case %s in\n"; /* 9 bytes, plus string */
- tSCC esac_fmt[] =
- " )\n echo %s ;;\n* ) echo %s ;;\nesac";/* 4 bytes */
- tSCC skip[] = "skip"; /* 4 bytes */
- tSCC run[] = "run"; /* 3 bytes */
- /* total bytes to add to machine sum: 49 - see fixincl.tpl */
+{
+ char const ** papz_machs = p_fixd->papz_machs;
+ int have_match = BOOL_FALSE;
- const char **papz_machs = p_fixd->papz_machs;
- char *pz;
- const char *pz_sep = "";
- tCC *pz_if_true;
- tCC *pz_if_false;
- char cmd_buf[ MACH_LIST_SIZE_LIMIT ]; /* size lim from fixincl.tpl */
-
- /* Start the case statement */
-
- sprintf (cmd_buf, case_fmt, pz_machine);
- pz = cmd_buf + strlen (cmd_buf);
-
- /* Determine if a match means to apply the fix or not apply it */
-
- if (p_fixd->fd_flags & FD_MACH_IFNOT)
- {
- pz_if_true = skip;
- pz_if_false = run;
- }
- else
- {
- pz_if_true = run;
- pz_if_false = skip;
- }
-
- /* Emit all the machine names. If there are more than one,
- then we will insert " | \\\n" between the names */
-
- for (;;)
- {
- const char* pz_mach = *(papz_machs++);
-
- if (pz_mach == (const char*) NULL)
- break;
- sprintf (pz, "%s%s", pz_sep, pz_mach);
- pz += strlen (pz);
- pz_sep = " | \\\n";
- }
-
- /* Now emit the match and not-match actions and the esac */
-
- sprintf (pz, esac_fmt, pz_if_true, pz_if_false);
-
- /* Run the script.
- The result will start either with 's' or 'r'. */
-
- {
- int skip;
- pz = run_shell (cmd_buf);
- skip = (*pz == 's');
- free ( (void*)pz );
- if (skip)
- {
- p_fixd->fd_flags |= FD_SKIP_TEST;
- return BOOL_FALSE;
- }
- }
-
- return BOOL_TRUE;
-# else /* is SEPARATE_FIX_PROC */
- const char **papz_machs = p_fixd->papz_machs;
- int invert = (p_fixd->fd_flags & FD_MACH_IFNOT) != 0;
for (;;)
{
- const char* pz_mach = *(papz_machs++);
-
- if (pz_mach == (const char*) NULL)
+ char const * pz_mpat = *(papz_machs++);
+ if (pz_mpat == NULL)
break;
- if (strstr (pz_mach, "dos") != NULL && !invert)
- return BOOL_TRUE;
+
+ if (fnmatch(pz_mpat, pz_machine, 0) == 0)
+ {
+ have_match = BOOL_TRUE;
+ break;
+ }
}
- p_fixd->fd_flags |= FD_SKIP_TEST;
- return BOOL_FALSE;
-# endif
+ if (have_match == BOOL_FALSE)
+ p_fixd->fd_flags |= FD_SKIP_TEST;
+
+ if (p_fixd->fd_flags & FD_MACH_IFNOT)
+ return ! have_match;
+
+ return have_match;
}
/* * * * * * * * * * * * *
@@ -1074,11 +1015,11 @@
/* * * * * * * * * * * * *
-
- Process the potential fixes for a particular include file.
- Input: the original text of the file and the file's name
- Result: none. A new file may or may not be created. */
-
+ *
+ * Process the potential fixes for a particular include file.
+ * Input: the original text of the file and the file's name
+ * Result: none. A new file may or may not be created.
+ */
static t_bool
fix_applies (tFixDesc* p_fixd)
{
@@ -1087,7 +1028,7 @@
int test_ct;
tTestDesc *p_test;
-# ifdef SEPARATE_FIX_PROC
+#ifdef SEPARATE_FIX_PROC
/*
* There is only one fix that uses a shell script as of this writing.
* I hope to nuke it anyway, it does not apply to DOS and it would
@@ -1095,35 +1036,26 @@
*/
if (p_fixd->fd_flags & (FD_SHELL_SCRIPT | FD_SKIP_TEST))
return BOOL_FALSE;
-# else
+#else
if (p_fixd->fd_flags & FD_SKIP_TEST)
return BOOL_FALSE;
-# endif
+#endif
/* IF there is a file name restriction,
THEN ensure the current file name matches one in the pattern */
if (pz_scan != (char *) NULL)
{
- size_t name_len;
-
while ((pz_fname[0] == '.') && (pz_fname[1] == '/'))
pz_fname += 2;
- name_len = strlen (pz_fname);
for (;;)
{
- pz_scan = strstr (pz_scan + 1, pz_fname);
- /* IF we can't match the string at all,
- THEN bail */
- if (pz_scan == (char *) NULL)
- return BOOL_FALSE;
-
- /* IF the match is surrounded by the '|' markers,
- THEN we found a full match -- time to run the tests */
-
- if ((pz_scan[-1] == '|') && (pz_scan[name_len] == '|'))
+ if (fnmatch (pz_scan, pz_fname, 0) == 0)
break;
+ pz_scan += strlen (pz_scan) + 1;
+ if (*pz_scan == NUL)
+ return BOOL_FALSE;
}
}
Index: inclhack.def
===================================================================
--- inclhack.def (revision 120492)
+++ inclhack.def (working copy)
@@ -1029,8 +1029,7 @@
fix = {
hackname = broken_cabs;
files = "math.h";
- files = "architecture/ppc/math.h";
- files = "architecture/i386/math.h";
+ files = "architecture/*/math.h";
select = "^extern[ \t]+double[ \t]+cabs";
c_fix = format;
@@ -1054,8 +1053,7 @@
fix = {
hackname = broken_nan;
- files = "architecture/ppc/math.h";
- files = "architecture/i386/math.h";
+ files = "architecture/*/math.h";
select = "#if defined(__APPLE_CC__) && (__APPLE_CC__ >= 1345)";
bypass = "powl";
c_fix = format;
@@ -1294,7 +1292,7 @@
*/
fix = {
hackname = glibc_c99_inline_1;
- files = features.h;
+ files = *features.h;
select = "^ *&& !defined __OPTIMIZE_SIZE__ && !defined __NO_INLINE__$";
c_fix = format;
c_fix_arg = "%0 && __STDC_VERSION__ < 199901L";
@@ -1314,7 +1312,7 @@
*/
fix = {
hackname = glibc_c99_inline_2;
- files = sys/stat.h;
+ files = *sys/stat.h;
select = "extern __inline__ int";
sed = "s/extern int \\(stat\\|lstat\\|fstat\\|mknod\\)/"
"#if __STDC_VERSION__ < 199901L\\\nextern\\\n#endif\\\n"
@@ -1336,7 +1334,7 @@
fix = {
hackname = glibc_c99_inline_3;
- files = bits/string2.h;
+ files = *bits/string2.h;
bypass = "__STDC_VERSION__";
c_fix = format;
c_fix_arg = "# if defined(__cplusplus) || __STDC_VERSION__ >= 19901L";
@@ -1353,7 +1351,7 @@
fix = {
hackname = glibc_c99_inline_4;
- files = sys/sysmacros.h;
+ files = *sys/sysmacros.h;
bypass = "__STDC_VERSION__";
c_fix = format;
c_fix_arg = "\n#if __STDC_VERSION__ < 19901L\nextern\n#endif\n";
@@ -2250,13 +2248,7 @@
fix = {
hackname = kandr_concat;
files = "sparc/asm_linkage.h";
- files = "sun3/asm_linkage.h";
- files = "sun3x/asm_linkage.h";
- files = "sun4/asm_linkage.h";
- files = "sun4c/asm_linkage.h";
- files = "sun4m/asm_linkage.h";
- files = "sun4c/debug/asm_linkage.h";
- files = "sun4m/debug/asm_linkage.h";
+ files = "sun*/asm_linkage.h";
files = "arm/as_support.h";
files = "arm/mc_type.h";
files = "arm/xcb.h";
@@ -2851,14 +2843,7 @@
*/
fix = {
hackname = sco_math;
- files = math.h;
- files = ansi/math.h;
- files = posix/math.h;
- files = xpg4/math.h;
- files = xpg4v2/math.h;
- files = xpg4plus/math.h;
- files = ods_30_compat/math.h;
- files = oldstyle/math.h;
+ files = *math.h;
select = "inline double abs";
bypass = "__GNUG__";
sed = "/#define.*__fp_class(a) \\\\/i\\\n"
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [fixincludes, patch] PR30008 - fixes are not applied to files in non-standard locations (was: fixinclude fnmatch patch)
2007-01-06 14:44 [fixincludes, patch] PR30008 - fixes are not applied to files in non-standard locations (was: fixinclude fnmatch patch) Daniel Franke
@ 2007-01-06 17:25 ` Bruce Korb
2007-01-06 18:03 ` Bruce Korb
1 sibling, 0 replies; 5+ messages in thread
From: Bruce Korb @ 2007-01-06 17:25 UTC (permalink / raw)
To: Daniel Franke; +Cc: gcc-patches
Daniel Franke wrote:
> :ADDPATCH fixincludes:
>
> Some distributions store files that need fixing in non-standard locations.
> Instead of enumerating those locations, this patch allows for wildcards in
> the files-section of hacks, e.g.
>
> files = "*features.h"
>
> to match "features.h", "foo/features.h" or "foo/bar/../features.h".
>
> Bootstrapped and regtested on x86_64-pc-linux-gnu and i686-pc-linux-gnu.
>
>
> Most of the attached patch was provided by Bruce Korb [1], I only contributed
> some minor fixes.
>
> 2007-01-05 Bruce Korb <bkorb@gnu.org>,
> Daniel Franke <franke.daniel@gmail.com>
>
> PR target/30008
> * fixincl.tpl: ? (Bruce?)
> * fixincl.c (fix_applies, machine_matches): Use fnmatch for pattern matching.
> * fixincl.x: Regenerate.
> * inclhack.def (glibc_c99_inline_[1234], broken_cabs, broken_nan,
> kandr_concat, sco_math): Replace lists of specfic file names by search
> patterns.
>
>
> The patch does not include the changes to the generated file fixincl.x, anyone
> applying the patch has to regenerate that file.
>
> Ok for trunk?
I was just sitting down to do this. I want to tweak the patch a bit,
so I will do that, sanity check and commit it today. Thank you.
Regards, Bruce
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [fixincludes, patch] PR30008 - fixes are not applied to files in non-standard locations (was: fixinclude fnmatch patch)
2007-01-06 14:44 [fixincludes, patch] PR30008 - fixes are not applied to files in non-standard locations (was: fixinclude fnmatch patch) Daniel Franke
2007-01-06 17:25 ` Bruce Korb
@ 2007-01-06 18:03 ` Bruce Korb
2007-01-06 19:10 ` Daniel Franke
1 sibling, 1 reply; 5+ messages in thread
From: Bruce Korb @ 2007-01-06 18:03 UTC (permalink / raw)
To: Daniel Franke; +Cc: gcc-patches
[-- Attachment #1: Type: text/plain, Size: 73 bytes --]
The attached patch is being applied. Thank you, Daniel. Regards, Bruce
[-- Attachment #2: fixinc.diff --]
[-- Type: text/x-patch, Size: 12806 bytes --]
Index: ChangeLog
===================================================================
--- ChangeLog (revision 120526)
+++ ChangeLog (working copy)
@@ -1,3 +1,15 @@
+2007-01-05 Bruce Korb <bkorb@gnu.org>,
+ Daniel Franke <franke.daniel@gmail.com>
+
+ PR target/30008
+ * fixincl.tpl (List): separate file name patterns with a NUL byte instead
+ of a vertical bar ("|").
+ * fixincl.c (fix_applies, machine_matches): Use fnmatch for name matching.
+ * fixincl.x: Regenerate.
+ * inclhack.def (glibc_c99_inline_[1234], broken_cabs, broken_nan,
+ kandr_concat, sco_math): Replace lists of specfic file names by search
+ patterns.
+
2006-12-12 Olivier Hainque <hainque@adacore.com>
* fixincludes/mkfixinc.sh: Add "*-*-vxworks*" to the list of
Index: fixincl.tpl
===================================================================
--- fixincl.tpl (revision 120526)
+++ fixincl.tpl (working copy)
@@ -2,7 +2,7 @@
x=fixincl.x =]
[= (dne " * " "/* ")=]
*/
-/* DO NOT CVS-MERGE THIS FILE, EITHER [=`date`=]
+/* DO NOT SVN-MERGE THIS FILE, EITHER [=`date`=]
*
* You must regenerate it. Use the ./genfixes script.
*
@@ -48,7 +48,7 @@
IF (exist? "files")=]
tSCC z[=(. Hack)=]List[] =
- "[=FOR files =]|[=files=][=ENDFOR=]|";[=
+ "[= (join "\\0" (stack "files")) =]\0";[=
ELSE =]
#define z[=(. Hack)=]List (char*)NULL[=
@@ -73,7 +73,7 @@
ELSE =]
#define apz[=(. Hack)=]Machs (const char**)NULL[=
- ENDIF (exist? "files") =][=
+ ENDIF (exist? "mach") =][=
IF (exist? "select")=]
Index: README
===================================================================
--- README (revision 120526)
+++ README (working copy)
@@ -69,14 +69,17 @@
for variable names and is unique without regard to alphabetic case.
Please keep them alphabetical by this name. :-)
-2. If the problem is known to exist only in certain files,
- then name each such file with a "files = " entry.
+2. If the problem is known to exist only in certain files, then
+ identify the files with "files = " entries. If you use fnmatch(3C)
+ wild card characters in a "files" entry, be certain that the first
+ "files" entry has no such character. Otherwise, the "make check"
+ machinery will attempt to create files with those characters in the
+ name. That is inconvenient.
3. It is relatively expensive to fire off a process to fix a source
file, therefore write apply tests to avoid unnecessary fix
- processes. The preferred apply tests are "select", "bypass" and
- "c_test" because they are performed internally. The available
- tests are:
+ processes. The preferred apply tests are "select", "bypass", "mach"
+ and "c-test" because they are performed internally:
* select - Run a regex on the contents of the file being considered.
All such regex-es must match.
@@ -84,18 +87,17 @@
* bypass - Run a regex on the contents of the file being considered.
No such regex may match.
- * c_test - call a function in fixtests.c. See that file.
+ * c-test - call a function in fixtests.c. See that file.
- The next two tests are relatively slow because they must be handled
- in a separate shell process. Some platforms do not support server
- shells, so the whole process is even slower and more cumbersome there.
-
- * mach - Match the output of config.conf against a series of globbing
+ * mach - Match the output of config.conf against a series of fnmatch
patterns. It must match at least one of the patterns, unless
- "not-machine" has also been specified. If that has been
- specified, then the config.conf output may not match any of
- the patterns.
+ "not-machine" has also been specified. In that case, the
+ config.conf output must not match any of the patterns.
+ The next test is relatively slow because it must be handled in a
+ separate shell process. Some platforms do not support server shells,
+ so the whole process is even slower and more cumbersome there.
+
* test - These should be arguments to the program, "/bin/test".
You may perform multiple commands, if you enclose them
in backquotes and echo out valid test arguments. For
Index: inclhack.def
===================================================================
--- inclhack.def (revision 120526)
+++ inclhack.def (working copy)
@@ -1028,9 +1028,7 @@
*/
fix = {
hackname = broken_cabs;
- files = "math.h";
- files = "architecture/ppc/math.h";
- files = "architecture/i386/math.h";
+ files = math.h, "architecture/*/math.h";
select = "^extern[ \t]+double[ \t]+cabs";
c_fix = format;
@@ -1054,8 +1052,14 @@
fix = {
hackname = broken_nan;
+ /*
+ * It is tempting to omit the first "files" entry. Do not.
+ * The testing machinery will take the first "files" entry as the name
+ * of a test file to play with. It would be a nuisance to have a directory
+ * with the name "*".
+ */
files = "architecture/ppc/math.h";
- files = "architecture/i386/math.h";
+ files = "architecture/*/math.h";
select = "#if defined(__APPLE_CC__) && (__APPLE_CC__ >= 1345)";
bypass = "powl";
c_fix = format;
@@ -1294,7 +1298,7 @@
*/
fix = {
hackname = glibc_c99_inline_1;
- files = features.h;
+ files = features.h, '*/features.h';
select = "^ *&& !defined __OPTIMIZE_SIZE__ && !defined __NO_INLINE__$";
c_fix = format;
c_fix_arg = "%0 && __STDC_VERSION__ < 199901L";
@@ -1314,7 +1318,7 @@
*/
fix = {
hackname = glibc_c99_inline_2;
- files = sys/stat.h;
+ files = sys/stat.h, '*/sys/stat.h';
select = "extern __inline__ int";
sed = "s/extern int \\(stat\\|lstat\\|fstat\\|mknod\\)/"
"#if __STDC_VERSION__ < 199901L\\\nextern\\\n#endif\\\n"
@@ -1336,7 +1340,7 @@
fix = {
hackname = glibc_c99_inline_3;
- files = bits/string2.h;
+ files = bits/string2.h, '*/bits/string2.h';
bypass = "__STDC_VERSION__";
c_fix = format;
c_fix_arg = "# if defined(__cplusplus) || __STDC_VERSION__ >= 19901L";
@@ -1353,7 +1357,7 @@
fix = {
hackname = glibc_c99_inline_4;
- files = sys/sysmacros.h;
+ files = sys/sysmacros.h, '*/sys/sysmacros.h';
bypass = "__STDC_VERSION__";
c_fix = format;
c_fix_arg = "\n#if __STDC_VERSION__ < 19901L\nextern\n#endif\n";
@@ -2250,13 +2254,7 @@
fix = {
hackname = kandr_concat;
files = "sparc/asm_linkage.h";
- files = "sun3/asm_linkage.h";
- files = "sun3x/asm_linkage.h";
- files = "sun4/asm_linkage.h";
- files = "sun4c/asm_linkage.h";
- files = "sun4m/asm_linkage.h";
- files = "sun4c/debug/asm_linkage.h";
- files = "sun4m/debug/asm_linkage.h";
+ files = "sun*/asm_linkage.h";
files = "arm/as_support.h";
files = "arm/mc_type.h";
files = "arm/xcb.h";
@@ -2851,14 +2849,7 @@
*/
fix = {
hackname = sco_math;
- files = math.h;
- files = ansi/math.h;
- files = posix/math.h;
- files = xpg4/math.h;
- files = xpg4v2/math.h;
- files = xpg4plus/math.h;
- files = ods_30_compat/math.h;
- files = oldstyle/math.h;
+ files = math.h, '*/math.h';
select = "inline double abs";
bypass = "__GNUG__";
sed = "/#define.*__fp_class(a) \\\\/i\\\n"
Index: fixincl.c
===================================================================
--- fixincl.c (revision 120526)
+++ fixincl.c (working copy)
@@ -23,6 +23,7 @@
#include "fixlib.h"
+#include <fnmatch.h>
#include <sys/stat.h>
#ifndef SEPARATE_FIX_PROC
#include <sys/wait.h>
@@ -359,96 +360,31 @@
static int
machine_matches( tFixDesc* p_fixd )
- {
-# ifndef SEPARATE_FIX_PROC
- tSCC case_fmt[] = "case %s in\n"; /* 9 bytes, plus string */
- tSCC esac_fmt[] =
- " )\n echo %s ;;\n* ) echo %s ;;\nesac";/* 4 bytes */
- tSCC skip[] = "skip"; /* 4 bytes */
- tSCC run[] = "run"; /* 3 bytes */
- /* total bytes to add to machine sum: 49 - see fixincl.tpl */
+{
+ char const ** papz_machs = p_fixd->papz_machs;
+ int have_match = BOOL_FALSE;
- const char **papz_machs = p_fixd->papz_machs;
- char *pz;
- const char *pz_sep = "";
- tCC *pz_if_true;
- tCC *pz_if_false;
- char cmd_buf[ MACH_LIST_SIZE_LIMIT ]; /* size lim from fixincl.tpl */
-
- /* Start the case statement */
-
- sprintf (cmd_buf, case_fmt, pz_machine);
- pz = cmd_buf + strlen (cmd_buf);
-
- /* Determine if a match means to apply the fix or not apply it */
-
- if (p_fixd->fd_flags & FD_MACH_IFNOT)
- {
- pz_if_true = skip;
- pz_if_false = run;
- }
- else
- {
- pz_if_true = run;
- pz_if_false = skip;
- }
-
- /* Emit all the machine names. If there are more than one,
- then we will insert " | \\\n" between the names */
-
- for (;;)
- {
- const char* pz_mach = *(papz_machs++);
-
- if (pz_mach == (const char*) NULL)
- break;
- sprintf (pz, "%s%s", pz_sep, pz_mach);
- pz += strlen (pz);
- pz_sep = " | \\\n";
- }
-
- /* Now emit the match and not-match actions and the esac */
-
- sprintf (pz, esac_fmt, pz_if_true, pz_if_false);
-
- /* Run the script.
- The result will start either with 's' or 'r'. */
-
- {
- int skip;
- pz = run_shell (cmd_buf);
- skip = (*pz == 's');
- free ( (void*)pz );
- if (skip)
- {
- p_fixd->fd_flags |= FD_SKIP_TEST;
- return BOOL_FALSE;
- }
- }
-
- return BOOL_TRUE;
-# else /* is SEPARATE_FIX_PROC */
- const char **papz_machs = p_fixd->papz_machs;
- int invert = (p_fixd->fd_flags & FD_MACH_IFNOT) != 0;
for (;;)
{
- const char* pz_mach = *(papz_machs++);
-
- if (pz_mach == (const char*) NULL)
+ char const * pz_mpat = *(papz_machs++);
+ if (pz_mpat == NULL)
break;
- if (strstr (pz_mach, "dos") != NULL && !invert)
- return BOOL_TRUE;
+ if (fnmatch(pz_mpat, pz_machine, 0) == 0)
+ {
+ have_match = BOOL_TRUE;
+ break;
+ }
}
- p_fixd->fd_flags |= FD_SKIP_TEST;
- return BOOL_FALSE;
-# endif
+ if (p_fixd->fd_flags & FD_MACH_IFNOT)
+ return ! have_match;
+ return have_match;
}
/* * * * * * * * * * * * *
-
- run_compiles run all the regexp compiles for all the fixes once.
- */
+ *
+ * run_compiles run all the regexp compiles for all the fixes once.
+ */
void
run_compiles (void)
{
@@ -1074,11 +1010,11 @@
/* * * * * * * * * * * * *
-
- Process the potential fixes for a particular include file.
- Input: the original text of the file and the file's name
- Result: none. A new file may or may not be created. */
-
+ *
+ * Process the potential fixes for a particular include file.
+ * Input: the original text of the file and the file's name
+ * Result: none. A new file may or may not be created.
+ */
static t_bool
fix_applies (tFixDesc* p_fixd)
{
@@ -1087,7 +1023,7 @@
int test_ct;
tTestDesc *p_test;
-# ifdef SEPARATE_FIX_PROC
+#ifdef SEPARATE_FIX_PROC
/*
* There is only one fix that uses a shell script as of this writing.
* I hope to nuke it anyway, it does not apply to DOS and it would
@@ -1095,10 +1031,10 @@
*/
if (p_fixd->fd_flags & (FD_SHELL_SCRIPT | FD_SKIP_TEST))
return BOOL_FALSE;
-# else
+#else
if (p_fixd->fd_flags & FD_SKIP_TEST)
return BOOL_FALSE;
-# endif
+#endif
/* IF there is a file name restriction,
THEN ensure the current file name matches one in the pattern */
@@ -1113,17 +1049,11 @@
for (;;)
{
- pz_scan = strstr (pz_scan + 1, pz_fname);
- /* IF we can't match the string at all,
- THEN bail */
- if (pz_scan == (char *) NULL)
- return BOOL_FALSE;
-
- /* IF the match is surrounded by the '|' markers,
- THEN we found a full match -- time to run the tests */
-
- if ((pz_scan[-1] == '|') && (pz_scan[name_len] == '|'))
+ if (fnmatch (pz_scan, pz_fname, 0) == 0)
break;
+ pz_scan += strlen (pz_scan) + 1;
+ if (*pz_scan == NUL)
+ return BOOL_FALSE;
}
}
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [fixincludes, patch] PR30008 - fixes are not applied to files in non-standard locations (was: fixinclude fnmatch patch)
2007-01-06 18:03 ` Bruce Korb
@ 2007-01-06 19:10 ` Daniel Franke
2007-01-06 20:05 ` Bruce Korb
0 siblings, 1 reply; 5+ messages in thread
From: Daniel Franke @ 2007-01-06 19:10 UTC (permalink / raw)
To: bkorb; +Cc: gcc-patches
On Saturday 06 January 2007 19:11, Bruce Korb wrote:
> The attached patch is being applied. Thank you, Daniel. Regards, Bruce
I should have been more verbose about that particular minor fix ...
Your patch removes these lines:
- p_fixd->fd_flags |= FD_SKIP_TEST;
- return BOOL_FALSE;
in machine_matches(). Without them, I observed that no fixes were applied at
all. Thus, my patch added
+ if (have_match == BOOL_FALSE)
+ p_fixd->fd_flags |= FD_SKIP_TEST;
directly after the for-loop to skip any test where "mach" does not match.
Could you please verify?!
Thanks
Daniel
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [fixincludes, patch] PR30008 - fixes are not applied to files in non-standard locations (was: fixinclude fnmatch patch)
2007-01-06 19:10 ` Daniel Franke
@ 2007-01-06 20:05 ` Bruce Korb
0 siblings, 0 replies; 5+ messages in thread
From: Bruce Korb @ 2007-01-06 20:05 UTC (permalink / raw)
To: Daniel Franke; +Cc: gcc-patches
Daniel Franke wrote:
> On Saturday 06 January 2007 19:11, Bruce Korb wrote:
>> The attached patch is being applied. Thank you, Daniel. Regards, Bruce
>
> I should have been more verbose about that particular minor fix ...
>
> Your patch removes these lines:
>
> - p_fixd->fd_flags |= FD_SKIP_TEST;
> - return BOOL_FALSE;
>
> in machine_matches(). Without them, I observed that no fixes were applied at
> all. Thus, my patch added
>
> + if (have_match == BOOL_FALSE)
> + p_fixd->fd_flags |= FD_SKIP_TEST;
>
> directly after the for-loop to skip any test where "mach" does not match.
>
> Could you please verify?!
Yep. I didn't see that and didn't notice you had made that change
Thanks:
/* Check for sense inversion then set the "skip test" flag, if needed */
if (p_fixd->fd_flags & FD_MACH_IFNOT)
have_match = ! have_match;
if (! have_match)
p_fixd->fd_flags |= FD_SKIP_TEST;
return have_match;
}
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2007-01-06 20:05 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-06 14:44 [fixincludes, patch] PR30008 - fixes are not applied to files in non-standard locations (was: fixinclude fnmatch patch) Daniel Franke
2007-01-06 17:25 ` Bruce Korb
2007-01-06 18:03 ` Bruce Korb
2007-01-06 19:10 ` Daniel Franke
2007-01-06 20:05 ` Bruce Korb
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).