Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
7d9ccd90
Commit
7d9ccd90
authored
Mar 31, 1999
by
Bruce Korb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reworked method for traversing sym-linked directory hierarchies
From-SVN: r26086
parent
5877286e
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
66 additions
and
38 deletions
+66
-38
gcc/fixinc/fixincl.c
+38
-8
gcc/fixinc/hackshell.tpl
+28
-30
gcc/fixinc/inclhack.tpl
+0
-0
No files found.
gcc/fixinc/fixincl.c
View file @
7d9ccd90
...
@@ -139,6 +139,8 @@ struct fix_desc
...
@@ -139,6 +139,8 @@ struct fix_desc
char
*
pz_dest_dir
=
NULL
;
char
*
pz_dest_dir
=
NULL
;
char
*
pz_src_dir
=
NULL
;
char
*
pz_src_dir
=
NULL
;
char
*
pz_machine
=
NULL
;
char
*
pz_machine
=
NULL
;
char
*
pz_find_base
=
NULL
;
int
find_base_len
=
0
;
pid_t
process_chain_head
=
(
pid_t
)
-
1
;
pid_t
process_chain_head
=
(
pid_t
)
-
1
;
...
@@ -240,6 +242,17 @@ main (argc, argv)
...
@@ -240,6 +242,17 @@ main (argc, argv)
}
}
}
}
{
static
const
char
var
[]
=
"FIND_BASE"
;
pz_find_base
=
getenv
(
var
);
if
(
pz_find_base
==
(
char
*
)
NULL
)
{
fprintf
(
stderr
,
var_not_found
,
var
);
exit
(
EXIT_FAILURE
);
}
find_base_len
=
strlen
(
pz_find_base
);
}
/* Compile all the regular expressions now.
/* Compile all the regular expressions now.
That way, it is done only once for the whole run.
That way, it is done only once for the whole run.
*/
*/
...
@@ -298,10 +311,15 @@ main (argc, argv)
...
@@ -298,10 +311,15 @@ main (argc, argv)
errno
,
strerror
(
errno
));
errno
,
strerror
(
errno
));
exit
(
EXIT_FAILURE
);
exit
(
EXIT_FAILURE
);
}
}
#ifdef DEBUG
#ifndef DEBUG
{
int
status
;
(
void
)
wait
(
&
status
);
}
#else
fprintf
(
stderr
,
"Waiting for %d to complete %d files
\n
"
,
fprintf
(
stderr
,
"Waiting for %d to complete %d files
\n
"
,
child
,
file_name_ct
);
child
,
file_name_ct
);
#endif
{
{
int
status
;
int
status
;
pid_t
dead_kid
=
wait
(
&
status
);
pid_t
dead_kid
=
wait
(
&
status
);
...
@@ -309,17 +327,18 @@ main (argc, argv)
...
@@ -309,17 +327,18 @@ main (argc, argv)
if
(
dead_kid
!=
child
)
if
(
dead_kid
!=
child
)
fprintf
(
stderr
,
"fixincl woke up from a strange child %d (not %d)
\n
"
,
fprintf
(
stderr
,
"fixincl woke up from a strange child %d (not %d)
\n
"
,
dead_kid
,
child
);
dead_kid
,
child
);
#ifdef DEBUG
else
else
fprintf
(
stderr
,
"child finished %d files %s
\n
"
,
file_name_ct
,
fprintf
(
stderr
,
"child finished %d files %s
\n
"
,
file_name_ct
,
status
?
strerror
(
status
&
0xFF
)
:
"ok"
);
status
?
strerror
(
status
&
0xFF
)
:
"ok"
);
#endif
}
}
#endif
}
}
#else
#else
#error "NON-BOGUS LIMITS NOT SUPPORTED?!?!"
#error "NON-BOGUS LIMITS NOT SUPPORTED?!?!"
#endif
#endif
signal
(
SIGCLD
,
SIG_IGN
);
#ifdef DEBUG
#ifdef DEBUG
fprintf
(
stderr
,
"Child start -- processing %d files
\n
"
,
fprintf
(
stderr
,
"Child start -- processing %d files
\n
"
,
file_name_ct
);
file_name_ct
);
...
@@ -411,8 +430,10 @@ load_file (pz_file_name)
...
@@ -411,8 +430,10 @@ load_file (pz_file_name)
if
(
ferror
(
fp
))
if
(
ferror
(
fp
))
{
{
fprintf
(
stderr
,
"error %d (%s) reading %s
\n
"
,
errno
,
int
err
=
errno
;
strerror
(
errno
),
pz_file_name
);
if
(
err
!=
EISDIR
)
fprintf
(
stderr
,
"error %d (%s) reading %s
\n
"
,
err
,
strerror
(
err
),
pz_file_name
);
free
((
void
*
)
pz_data
);
free
((
void
*
)
pz_data
);
fclose
(
fp
);
fclose
(
fp
);
return
(
char
*
)
NULL
;
return
(
char
*
)
NULL
;
...
@@ -596,7 +617,16 @@ create_file (pz_file_name)
...
@@ -596,7 +617,16 @@ create_file (pz_file_name)
FILE
*
pf
;
FILE
*
pf
;
char
fname
[
MAXPATHLEN
];
char
fname
[
MAXPATHLEN
];
sprintf
(
fname
,
"%s/%s"
,
pz_dest_dir
,
pz_file_name
);
#ifdef DEBUG
if
(
strncmp
(
pz_file_name
,
pz_find_base
,
find_base_len
)
!=
0
)
{
fprintf
(
stderr
,
"Error: input file %s does not match %s/*
\n
"
,
pz_file_name
,
pz_find_base
);
exit
(
1
);
}
#endif
sprintf
(
fname
,
"%s/%s"
,
pz_dest_dir
,
pz_file_name
+
find_base_len
);
fd
=
open
(
fname
,
O_WRONLY
|
O_CREAT
|
O_TRUNC
,
S_IRALL
);
fd
=
open
(
fname
,
O_WRONLY
|
O_CREAT
|
O_TRUNC
,
S_IRALL
);
...
@@ -911,7 +941,7 @@ process (pz_data, pz_file_name)
...
@@ -911,7 +941,7 @@ process (pz_data, pz_file_name)
}
}
}
}
fprintf
(
stderr
,
"Applying %-
32
s to %s
\n
"
,
fprintf
(
stderr
,
"Applying %-
24
s to %s
\n
"
,
p_fixd
->
fix_name
,
pz_file_name
);
p_fixd
->
fix_name
,
pz_file_name
);
/* IF we do not have a read pointer,
/* IF we do not have a read pointer,
...
...
gcc/fixinc/hackshell.tpl
View file @
7d9ccd90
...
@@ -5,19 +5,15 @@
...
@@ -5,19 +5,15 @@
# fixincl program. It is the repetitive guts of the fixincludes logic.
# fixincl program. It is the repetitive guts of the fixincludes logic.
#
#
=]
=]
if $LINKS; then
files=`find . -name '*.h' \( -type f -o -type l \) -print`
else
files=`find . -name '*.h' -type f -print`
fi
echo Checking header files
echo Checking header files
for file in $files; do
for file in $files; do
if ( test ! -r $
file
-o \
if ( test ! -r $
{
file
}
-o \
-n "`fgrep 'This file is part of the GNU C Library' $
file
`" )
-n "`fgrep 'This file is part of the GNU C Library' $
{
file
}
`" )
then continue ; fi
then continue ; fi
fixlist=""
fixlist=""
DESTFILE=$
{
DESTDIR
}
/`echo $
{
file
}
| sed "s;$
{
FIND_BASE
}
/;;" `
[=
[=
#
#
# FOR every fix description,
# FOR every fix description,
...
@@ -30,7 +26,7 @@ _FOR fix "\n\n" =]
...
@@ -30,7 +26,7 @@ _FOR fix "\n\n" =]
# Fix [=_eval _index 1 + #%3d _printf=]: [=hackname _Cap=]
# Fix [=_eval _index 1 + #%3d _printf=]: [=hackname _Cap=]
#[=
#[=
_IF files _exist=]
_IF files _exist=]
case "$
file
" in [=_FOR files " | \\\n\t"=]./[=files=][=/files=] )[=
case "$
{
file
}
" in [=_FOR files " | \\\n\t"=]./[=files=][=/files=] )[=
_ENDIF=][=
_ENDIF=][=
_IF mach _exist=]
_IF mach _exist=]
...
@@ -52,8 +48,8 @@ _FOR fix "\n\n" =]
...
@@ -52,8 +48,8 @@ _FOR fix "\n\n" =]
true or false. It is enclosed in parenthesis to avoid
true or false. It is enclosed in parenthesis to avoid
precedence problems. The output looks like this:
precedence problems. The output looks like this:
if ( test -n "`egrep 'find-expr' $
file
`" -a
if ( test -n "`egrep 'find-expr' $
{
file
}
`" -a
-z "`egrep 'not-find' $
file
`" -a
-z "`egrep 'not-find' $
{
file
}
`" -a
'('
<some-test-expression>
')'
'('
<some-test-expression>
')'
) > /dev/null 2>
&
1 ; then
) > /dev/null 2>
&
1 ; then
...
@@ -62,13 +58,13 @@ _FOR fix "\n\n" =]
...
@@ -62,13 +58,13 @@ _FOR fix "\n\n" =]
_IF select _exist =]
_IF select _exist =]
if ( test [=
if ( test [=
_FOR select " -a \\\n "
_FOR select " -a \\\n "
=]-n [=select _shrstr "#`egrep %s $
file
`"
=]-n [=select _shrstr "#`egrep %s $
{
file
}
`"
_printf _shstr =][=
_printf _shstr =][=
/select=][=
/select=][=
_IF bypass _exist =][=
_IF bypass _exist =][=
_FOR bypass=] -a \
_FOR bypass=] -a \
-z [=bypass _shrstr "#`egrep %s $
file
`"
-z [=bypass _shrstr "#`egrep %s $
{
file
}
`"
_printf _shstr =][=
_printf _shstr =][=
/bypass=][=
/bypass=][=
_ENDIF=][=
_ENDIF=][=
...
@@ -89,7 +85,7 @@ _FOR fix "\n\n" =]
...
@@ -89,7 +85,7 @@ _FOR fix "\n\n" =]
_IF bypass _exist=][=
_IF bypass _exist=][=
_FOR bypass=] -a \
_FOR bypass=] -a \
-z [=bypass _shrstr "#`egrep %s $
file
`"
-z [=bypass _shrstr "#`egrep %s $
{
file
}
`"
_printf _shstr=][=
_printf _shstr=][=
/bypass=][=
/bypass=][=
_ENDIF=]
_ENDIF=]
...
@@ -98,16 +94,16 @@ _FOR fix "\n\n" =]
...
@@ -98,16 +94,16 @@ _FOR fix "\n\n" =]
_ELIF bypass _exist =]
_ELIF bypass _exist =]
if ( test [=_FOR bypass " -a \\\n "
if ( test [=_FOR bypass " -a \\\n "
=]-z [=bypass _shrstr "#`egrep %s $
file
`"
=]-z [=bypass _shrstr "#`egrep %s $
{
file
}
`"
_printf _shstr=][=/bypass=]
_printf _shstr=][=/bypass=]
) > /dev/null 2>
&
1 ; then[=
) > /dev/null 2>
&
1 ; then[=
_ENDIF=]
_ENDIF=]
fixlist="$
{
fixlist
}
fixlist="$
{
fixlist
}
[=hackname=]"
[=hackname=]"
if [ ! -r $
{
DEST
DIR
}
/$file
]
if [ ! -r $
{
DEST
FILE
}
]
then infile=$
file
then infile=$
{
file
}
else infile=$
{
DEST
DIR
}
/$file
; fi [=
else infile=$
{
DEST
FILE
}
; fi [=
_IF sed _exist=][=
_IF sed _exist=][=
_IF shell _exist =][=
_IF shell _exist =][=
...
@@ -118,16 +114,16 @@ _FOR fix "\n\n" =]
...
@@ -118,16 +114,16 @@ _FOR fix "\n\n" =]
sed [=
sed [=
_FOR sed =]-e [=sed _shrstr=] \
_FOR sed =]-e [=sed _shrstr=] \
[=
[=
/sed=]
<
$
infile
>
$
{
DEST
DIR
}
/$file
.[=
/sed=]
<
$
infile
>
$
{
DEST
FILE
}
.[=
_ELIF shell _exist =]
_ELIF shell _exist =]
( [=shell=] )
<
$
infile
>
$
{
DESTDIR
}
/
$file.
( [=shell=] )
<
$
infile
>
$
{
DESTDIR
}
/
FIXINC.tmp
# Shell scripts have the potential of removing the output
# Shell scripts have the potential of removing the output
# We interpret that to mean the file is not to be altered
# We interpret that to mean the file is not to be altered
#
#
if test ! -f $
{
DESTDIR
}
/
$file.
if test ! -f $
{
DESTDIR
}
/
fixinc.tmp
then continue ; fi [=
then continue ; fi [=
...
@@ -135,8 +131,8 @@ _FOR fix "\n\n" =]
...
@@ -135,8 +131,8 @@ _FOR fix "\n\n" =]
_ERROR hackname _get "ERROR: %s has no fixup" _printf=][=
_ERROR hackname _get "ERROR: %s has no fixup" _printf=][=
_ENDIF=]
_ENDIF=]
rm -f $
{
DESTFILE
}
mv -f $
{
DESTDIR
}
/
$file. $
{
DESTDIR
}
/$file
[=
mv -f $
{
DESTDIR
}
/
fixinc.tmp $
{
DESTFILE
}
[=
# Close off any opened "if" or "case" statements in reverse order
# Close off any opened "if" or "case" statements in reverse order
...
@@ -165,21 +161,23 @@ _FOR fix "\n\n" =]
...
@@ -165,21 +161,23 @@ _FOR fix "\n\n" =]
# THEN ensure the output is gone
# THEN ensure the output is gone
# ELSE look for local directory include syntax
# ELSE look for local directory include syntax
#
#
if ( test ! -f $
{
DEST
DIR
}
/$file
|| \
if ( test ! -f $
{
DEST
FILE
}
|| \
cmp $
file $
{
DESTDIR
}
/$file
) > /dev/null 2>
&
1
cmp $
{
file
}
$
{
DESTFILE
}
) > /dev/null 2>
&
1
then
then
rm -f $
{
DEST
DIR
}
/$file
rm -f $
{
DEST
FILE
}
else
else
echo "Fixed $
file
:$
{
fixlist
}
"
echo "Fixed $
{
file
}
:$
{
fixlist
}
"
# Find any include directives that use "file".
# Find any include directives that use "file".
#
#
dir=`echo $
{
file
}
| sed -e s';/[^/]*$;;'`
ddir=`echo $
{
DESTDIR
}
| sed 's;/[^/]*$;;'`/$dir
for include in `
for include in `
egrep '^[
]*#[ ]*include[ ]*"[^/]' $
{
DESTDIR
}
/$file
|
egrep '^[
]*#[ ]*include[ ]*"[^/]' $
{
DESTFILE
}
|
sed -e 's/^[ ]*#[ ]*include[
]*"\([^"]*\)".*$/\1/'`
sed -e 's/^[ ]*#[ ]*include[
]*"\([^"]*\)".*$/\1/'`
do
do
dir=`echo $file | sed -e s'|/[^/]*$||'`
required="$required $
{
SRCDIR
}
$dir/$include $
{
ddir
}
/$include"
required="$required $
{
SRCDIR
}
$dir/$include $
{
DESTDIR
}
/$dir/$include"
done
done
fi
fi
done # for file in $files
done # for file in $files
gcc/fixinc/inclhack.tpl
View file @
7d9ccd90
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment