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
87ad679b
Commit
87ad679b
authored
Dec 29, 1999
by
Bruce Korb
Committed by
Bruce Korb
Dec 29, 1999
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
C++ file type checking
From-SVN: r31125
parent
ec6bfc9b
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
256 additions
and
113 deletions
+256
-113
gcc/ChangeLog
+21
-0
gcc/fixinc/fixincl.c
+7
-6
gcc/fixinc/fixincl.sh
+46
-16
gcc/fixinc/fixincl.tpl
+10
-17
gcc/fixinc/fixincl.x
+0
-0
gcc/fixinc/fixlib.c
+71
-0
gcc/fixinc/fixlib.h
+6
-0
gcc/fixinc/fixtests.c
+31
-48
gcc/fixinc/hackshell.tpl
+5
-3
gcc/fixinc/inclhack.def
+11
-6
gcc/fixinc/inclhack.sh
+0
-0
gcc/fixinc/inclhack.tpl
+48
-17
No files found.
gcc/ChangeLog
View file @
87ad679b
1999
-
12
-
29
Bruce
Korb
<
autogen
@linuxbox
.
com
>
*
fixinc
/
fixincl
.
c
(
wait_for_pid
)
:
sometimes
a
WSTOPSIG
of
zero
is
OK
*
fixinc
/
fixincl
.
tpl
(
<
hack
>
TEST_CT
)
:
Just
do
the
existence
test
once
(
<
hack
>
_RE_CT
)
:
not
needed
*
fixinc
/
fixlib
.
c
(
is_cxx_header
)
:
moved
from
fixtests
.
c
rewritten
to
scan
the
file
text
once
only
"template<..."
test
added
*
fixinc
/
fixlib
.
h
(
apply_fix_p_t
)
:
moved
from
fixtests
.
c
(
is_cxx_header
)
:
declaration
added
*
fixinc
/
fixtests
.
c
(
is_cxx_header
)
:
removed
(
apply_fix_p_t
)
:
removed
(
double_slash_test
)
:
is_cxx_header
is
only
called
once
now
*
fixinc
/
hackshell
.
tpl
:
indexing
the
fixes
is
now
done
under
DEBUG
*
fixinc
/
inclhack
.
def
(
FIXINC_DEBUG
)
:
added
for
testing
DEBUG
state
within
the
templates
.
The
borken
spelling
of
"broken"
was
fixed
.
*
fixinc
/
inclhack
.
tpl
:
The
$
VERBOSE
level
is
used
on
various
messages
The
default
level
depends
on
FIXINC_DEBUG
.
1999
-
12
-
29
Kaveh
R
.
Ghazi
<
ghazi
@caip
.
rutgers
.
edu
>
*
crtstuff
.
c
:
If
!
inhibit_libc
,
include
stdlib
.
h
/
unistd
.
h
.
...
...
gcc/fixinc/fixincl.c
View file @
87ad679b
...
...
@@ -433,16 +433,17 @@ wait_for_pid(child)
{
if
(
!
WIFEXITED
(
status
))
{
if
(
NOT_SILENT
)
fprintf
(
stderr
,
"child process %d is hung on signal %d
\n
"
,
child
,
WSTOPSIG
(
status
));
if
(
WSTOPSIG
(
status
)
==
0
)
break
;
fprintf
(
stderr
,
"child process %d is hung on signal %d
\n
"
,
child
,
WSTOPSIG
(
status
));
exit
(
EXIT_FAILURE
);
}
if
(
WEXITSTATUS
(
status
)
!=
0
)
{
if
(
NOT_SILENT
)
fprintf
(
stderr
,
"child process %d exited with status %d
\n
"
,
child
,
WEXITSTATUS
(
status
));
fprintf
(
stderr
,
"child process %d exited with status %d
\n
"
,
child
,
WEXITSTATUS
(
status
));
exit
(
EXIT_FAILURE
);
}
break
;
/* normal child completion */
...
...
gcc/fixinc/fixincl.sh
View file @
87ad679b
...
...
@@ -34,8 +34,9 @@
# Directory in which to store the results.
# Fail if no arg to specify a directory for the output.
if
[
"x
$1
"
=
"x"
]
then
echo
fixincludes: no output directory specified
exit
1
then
echo
fixincludes: no output directory specified
exit
1
fi
LIB
=
${
1
}
...
...
@@ -54,6 +55,17 @@ else
}
fi
if
test
-z
"
$VERBOSE
"
then
VERBOSE
=
2
export
VERBOSE
else
case
"
$VERBOSE
"
in
[
0-9]
)
:
;;
*
)
VERBOSE
=
3
;;
esac
fi
# Define what target system we're fixing.
#
if
test
-r
./Makefile
;
then
...
...
@@ -96,7 +108,8 @@ case $LIB in
;;
esac
echo
Fixing headers into
${
LIB
}
for
${
target_canonical
}
target
if
test
$VERBOSE
-gt
0
then
echo
Fixing headers into
${
LIB
}
for
${
target_canonical
}
target
;
fi
# Determine whether this system has symbolic links.
if
ln
-s
X
$LIB
/ShouldNotExist 2>/dev/null
;
then
...
...
@@ -131,7 +144,8 @@ INPUT=`${PWDCMD}`
#
# # # # # # # # # # # # # # # # # # # # #
#
echo
Finding directories and links to directories
if
test
$VERBOSE
-gt
1
then
echo
Finding directories and links to directories
;
fi
# Find all directories and all symlinks that point to directories.
# Put the list in $all_dirs.
...
...
@@ -150,7 +164,8 @@ do
newdirs
=
for
d
in
$dirs
do
echo
" Searching
$INPUT
/
$d
"
if
test
$VERBOSE
-gt
1
then
echo
" Searching
$INPUT
/
$d
"
;
fi
# Find all directories under $d, relative to $d, excluding $d itself.
# (The /. is needed after $d in case $d is a symlink.)
...
...
@@ -186,8 +201,10 @@ done
# # # # # # # # # # # # # # # # # # # # #
#
dirs
=
echo
"All directories (including links to directories):"
echo
$all_dirs
if
test
$VERBOSE
-gt
2
then
echo
"All directories (including links to directories):"
echo
$all_dirs
fi
for
file
in
$all_dirs
;
do
rm
-rf
$LIB
/
$file
...
...
@@ -205,7 +222,8 @@ mkdir $LIB/root
treetops
=
".
${
LIB
}
"
if
$LINKS
;
then
echo
'Making symbolic directory links'
if
test
$VERBOSE
-gt
1
then
echo
'Making symbolic directory links'
;
fi
cwd
=
`
${
PWDCMD
}
`
for
sym_link
in
$search_dirs
;
do
...
...
@@ -235,7 +253,8 @@ if $LINKS; then
# If a link points to ., make a similar link to .
#
if
[
${
full_dest_dir
}
=
${
cinput
}
]
;
then
echo
${
sym_link
}
'->'
.
': Making self link'
if
test
$VERBOSE
-gt
2
then
echo
${
sym_link
}
'->'
.
': Making self link'
;
fi
rm
-fr
${
LIB
}
/
${
sym_link
}
>
/dev/null 2>&1
ln
-s
.
${
LIB
}
/
${
sym_link
}
>
/dev/null 2>&1
...
...
@@ -248,7 +267,8 @@ if $LINKS; then
# DOTS is the relative path from ${LIB}/${sym_link} back to ${LIB}.
dots
=
`
echo
"
${
sym_link
}
"
|
sed
-e
's@^./@@'
-e
's@/./@/@g'
-e
's@[^/][^/]*@..@g'
-e
's@..$@@'
`
echo
${
sym_link
}
'->'
$dots$y
': Making local link'
if
test
$VERBOSE
-gt
2
then
echo
${
sym_link
}
'->'
$dots$y
': Making local link'
;
fi
rm
-fr
${
LIB
}
/
${
sym_link
}
>
/dev/null 2>&1
ln
-s
$dots$y
${
LIB
}
/
${
sym_link
}
>
/dev/null 2>&1
...
...
@@ -258,7 +278,9 @@ if $LINKS; then
# and process $target into ${INPUT}/root$target
# treat this directory as if it actually contained the files.
#
echo
${
sym_link
}
'->'
root
${
full_dest_dir
}
': Making rooted link'
if
test
$VERBOSE
-gt
2
then
echo
${
sym_link
}
'->'
root
${
full_dest_dir
}
': Making rooted link'
fi
if
[
-d
$LIB
/root
${
full_dest_dir
}
]
then
true
else
...
...
@@ -282,7 +304,8 @@ if $LINKS; then
${
sym_link
}
/
*
)
dupdir
=
${
LIB
}
/root
${
full_dest_dir
}
/
`
echo
$file2
|
sed
-n
"s|^
${
sym_link
}
/||p"
`
echo
"Duplicating
${
sym_link
}
's
${
dupdir
}
"
if
test
$VERBOSE
-gt
2
then
echo
"Duplicating
${
sym_link
}
's
${
dupdir
}
"
;
fi
if
[
-d
${
dupdir
}
]
then
true
else
...
...
@@ -337,7 +360,8 @@ while [ $# != 0 ]; do
then continue
;
fi
touch
${
DESTDIR
}
/DONE
echo
Fixing directory
${
SRCDIR
}
into
${
DESTDIR
}
if
test
$VERBOSE
-gt
1
then
echo
Fixing directory
${
SRCDIR
}
into
${
DESTDIR
}
;
fi
# Check files which are symlinks as well as those which are files.
#
...
...
@@ -371,7 +395,8 @@ while [ $# != 0 ]; do
cp
$2
$3
>
/dev/null 2>&1
||
echo
"Can't copy
$2
"
>
&2
chmod +w
$3
2>/dev/null
chmod a+r
$3
2>/dev/null
echo
Copied
$2
if
test
$VERBOSE
-gt
2
then
echo
Copied
$2
;
fi
for
include
in
`
egrep
'^[ ]*#[ ]*include[ ]*"[^/]'
$3
|
sed
-e
's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'
`
do
...
...
@@ -387,17 +412,22 @@ while [ $# != 0 ]; do
shift
done
echo
'Cleaning up DONE files.'
if
test
$VERBOSE
-gt
2
then
echo
'Cleaning up DONE files.'
;
fi
cd
$LIB
find
.
-name
DONE
-exec
rm
-f
'{}'
';'
echo
'Removing unneeded directories:'
if
test
$VERBOSE
-gt
1
then
echo
'Cleaning up unneeded directories:'
;
fi
cd
$LIB
all_dirs
=
`
find
.
-type
d
\!
-name
'.'
-print
| sort
-r
`
for
file
in
$all_dirs
;
do
rmdir
$LIB
/
$file
>
/dev/null 2>&1
done
if
test
$VERBOSE
-gt
0
then
echo
fixincludes is
done
;
fi
# # # # # # # # # # # # # # # # # # # # #
#
# End of for INPUT directories
...
...
gcc/fixinc/fixincl.tpl
View file @
87ad679b
...
...
@@ -125,24 +125,18 @@ tSCC z[=hackname _cap=]FTst[=_eval _index=][] = "[=c_test=]";[=
#define [=hackname _up =]_TEST_CT [=
_IF exesel _exist =][=
_eval exesel _count
bypass _count +
test _count +
c_test _count + =][=
bypass _count +
test _count +
c_test _count +
"ct=%d ; re_ct=`expr $ct + $re_ct` ; echo $ct"
_printf _shell =][=
_ELSE =][=
_eval select _count
bypass _count +
test _count +
c_test _count + =][=
_ENDIF =]
#define [=hackname _up =]_RE_CT [=
_IF exesel _exist =][=
_eval exesel _count bypass _count
"#2$ct=`expr %d + %d` ; re_ct=`expr $ct + $re_ct` ; echo $ct"
_printf _shell =][=
_ELSE =][=
_eval select _count bypass _count
"#2$ct=`expr %d + %d` ; re_ct=`expr $ct + $re_ct` ; echo $ct"
_printf _shell =][=
bypass _count +
test _count +
c_test _count +
"ct=%d ; re_ct=`expr $ct + $re_ct` ; echo $ct"
_printf _shell =][=
_ENDIF =]
tTestDesc a[=hackname _cap=]Tests[] = {[=
...
...
@@ -173,7 +167,6 @@ tTestDesc a[=hackname _cap=]Tests[] = {[=
_ENDIF =] };[=
_ELSE =]
#define [=hackname _up=]_TEST_CT 0
#define [=hackname _up=]_RE_CT 0
#define a[=hackname _cap=]Tests (tTestDesc*)NULL[=
_ENDIF =]
...
...
gcc/fixinc/fixincl.x
View file @
87ad679b
This diff is collapsed.
Click to expand it.
gcc/fixinc/fixlib.c
View file @
87ad679b
...
...
@@ -57,3 +57,74 @@ load_file_data (fp)
return
pz_data
;
}
t_bool
is_cxx_header
(
fname
,
text
)
tCC
*
fname
;
tCC
*
text
;
{
/* First, check to see if the file is in a C++ directory */
for
(;;)
{
switch
(
*
(
fname
++
))
{
case
'C'
:
/* check for "CC/" */
if
((
fname
[
0
]
==
'C'
)
&&
(
fname
[
1
]
==
'/'
))
return
BOOL_TRUE
;
break
;
case
'x'
:
/* check for "xx/" */
if
((
fname
[
0
]
==
'x'
)
&&
(
fname
[
1
]
==
'/'
))
return
BOOL_TRUE
;
break
;
case
'+'
:
/* check for "++" */
if
(
fname
[
0
]
==
'+'
)
return
BOOL_TRUE
;
break
;
case
NUL
:
goto
not_cxx_name
;
}
}
not_cxx_name
:
;
/* Or it might contain the phrase 'extern "C++"' */
for
(;;)
{
tSCC
zExtern
[]
=
"extern"
;
tSCC
zExtCxx
[]
=
"
\"
C++
\"
"
;
tSCC
zTemplate
[]
=
"template"
;
switch
(
*
(
text
++
))
{
case
'e'
:
/* Check for "extern \"C++\"" */
if
(
strncmp
(
text
,
zExtern
+
1
,
sizeof
(
zExtern
)
-
2
)
!=
0
)
break
;
text
+=
sizeof
(
zExtern
)
-
2
;
if
(
!
isspace
(
*
(
text
++
))
)
break
;
while
(
isspace
(
*
text
))
text
++
;
if
(
strncmp
(
text
,
zExtCxx
,
sizeof
(
zExtCxx
)
-
1
)
==
0
)
return
BOOL_TRUE
;
break
;
case
't'
:
/* Check for "template<" */
if
(
strncmp
(
text
,
zTemplate
+
1
,
sizeof
(
zTemplate
)
-
2
)
!=
0
)
break
;
text
+=
sizeof
(
zTemplate
)
-
2
;
while
(
isspace
(
*
text
))
text
++
;
if
(
*
text
==
'<'
)
return
BOOL_TRUE
;
break
;
case
NUL
:
goto
text_done
;
break
;
}
}
text_done
:
;
return
BOOL_FALSE
;
}
gcc/fixinc/fixlib.h
View file @
87ad679b
...
...
@@ -84,6 +84,11 @@ typedef enum
}
t_bool
;
#endif
typedef
int
apply_fix_p_t
;
/* Apply Fix Predicate Type */
#define APPLY_FIX 0
#define SKIP_FIX 1
#define _P_(p) ()
#endif
...
...
@@ -91,5 +96,6 @@ typedef enum
* Exported procedures
*/
char
*
load_file_data
_P_
((
FILE
*
fp
));
t_bool
is_cxx_header
_P_
((
tCC
*
filename
,
tCC
*
filetext
));
#endif
/* FIXINCLUDES_FIXLIB_H */
gcc/fixinc/fixtests.c
View file @
87ad679b
...
...
@@ -48,16 +48,11 @@ Boston, MA 02111-1307, USA. */
#include "fixlib.h"
typedef
int
apply_fix_p_t
;
/* Apply Fix Predicate Type */
#define APPLY_FIX 0
#define SKIP_FIX 1
#define SHOULD_APPLY(afp) ((afp) == APPLY_FIX)
apply_fix_p_t
run_test
();
typedef
struct
{
const
char
*
test_name
;
tCC
*
test_name
;
apply_fix_p_t
(
*
test_proc
)();
}
test_entry_t
;
...
...
@@ -68,8 +63,8 @@ typedef struct {
#define TEST_FOR_FIX_PROC_HEAD( test ) \
static apply_fix_p_t test ( fname, text ) \
const char
* fname; \
const char
* text;
tCC
* fname; \
tCC
* text;
/*
* Skip over a quoted string. Single quote strings may
...
...
@@ -77,7 +72,7 @@ static apply_fix_p_t test ( fname, text ) \
* a backslash. Especially a backslash followed by octal digits.
* We are not doing a correctness syntax check here.
*/
static
const
char
*
tSCC
*
skip_quote
(
q
,
text
)
char
q
;
char
*
text
;
...
...
@@ -106,29 +101,10 @@ skip_quote( q, text )
return
text
;
}
static
apply_fix_p_t
is_cxx_header
(
fname
,
text
)
const
char
*
fname
;
const
char
*
text
;
{
/* First, check to see if the file is in a C++ directory */
if
(
strstr
(
fname
,
"CC/"
)
!=
NULL
)
return
SKIP_FIX
;
if
(
strstr
(
fname
,
"xx/"
)
!=
NULL
)
return
SKIP_FIX
;
if
(
strstr
(
fname
,
"++"
)
!=
NULL
)
return
SKIP_FIX
;
/* Or it might contain the phrase 'extern "C++"' */
if
(
strstr
(
text
,
"extern
\"
C++
\"
"
)
!=
NULL
)
return
SKIP_FIX
;
return
APPLY_FIX
;
}
TEST_FOR_FIX_PROC_HEAD
(
double_slash_test
)
{
if
(
is_cxx_header
(
fname
,
text
)
==
SKIP_FIX
)
if
(
is_cxx_header
(
fname
,
text
))
return
SKIP_FIX
;
/* Now look for the comment markers in the text */
...
...
@@ -173,13 +149,13 @@ TEST_FOR_FIX_PROC_HEAD( double_slash_test )
TEST_FOR_FIX_PROC_HEAD
(
else_endif_label_test
)
{
static
int
compiled
=
0
;
static
const
char
label_pat
[]
=
"^[
\t
]*#[
\t
]*(else|endif)"
;
tSCC
label_pat
[]
=
"^[
\t
]*#[
\t
]*(else|endif)"
;
static
regex_t
label_re
;
char
ch
;
const
char
*
pz_next
=
(
char
*
)
NULL
;
tCC
*
pz_next
=
(
char
*
)
NULL
;
regmatch_t
match
[
2
];
const
char
*
all_text
=
text
;
t_bool
file_is_cxx
=
is_cxx_header
(
fname
,
text
)
;
/*
This routine may be run many times within a single execution.
...
...
@@ -271,25 +247,33 @@ TEST_FOR_FIX_PROC_HEAD( else_endif_label_test )
case
'/'
:
/*
Skip comments. Otherwise, we have a bogon */
if
(
*
pz_next
==
'*'
)
switch
(
*
pz_next
)
{
case
'/'
:
/* IF we found a "//" in a C header, THEN fix it. */
if
(
!
file_is_cxx
)
return
APPLY_FIX
;
/* C++ header. Skip to newline and continue. */
pz_next
=
strchr
(
pz_next
+
1
,
'\n'
);
if
(
pz_next
==
(
char
*
)
NULL
)
return
SKIP_FIX
;
pz_next
++
;
break
;
case
'*'
:
/* A comment for either C++ or C. Skip over it. */
pz_next
=
strstr
(
pz_next
+
1
,
"*/"
);
if
(
pz_next
==
(
char
*
)
NULL
)
return
SKIP_FIX
;
pz_next
+=
2
;
break
;
default
:
/* a '/' followed by other junk. */
return
APPLY_FIX
;
}
else
if
(
*
pz_next
==
'/'
&&
is_cxx_header
(
fname
,
all_text
)
==
SKIP_FIX
)
{
pz_next
=
strchr
(
pz_next
+
1
,
'\n'
);
if
(
pz_next
==
(
char
*
)
NULL
)
return
SKIP_FIX
;
pz_next
++
;
break
;
}
/* FALLTHROUGH */
break
;
/* a C or C++ comment */
default
:
/*
...
...
@@ -311,9 +295,9 @@ TEST_FOR_FIX_PROC_HEAD( else_endif_label_test )
*/
apply_fix_p_t
run_test
(
tname
,
fname
,
text
)
const
char
*
tname
;
const
char
*
fname
;
const
char
*
text
;
tCC
*
tname
;
tCC
*
fname
;
tCC
*
text
;
{
#define _FT_(n,p) { n, p },
static
test_entry_t
test_table
[]
=
{
FIX_TEST_TABLE
{
NULL
,
NULL
}};
...
...
@@ -353,7 +337,6 @@ main( argc, argv )
char
*
fname
=
*++
argv
;
char
*
tname
=
*++
argv
;
char
*
buf
;
size_t
buf_size
=
0
;
if
(
argc
!=
3
)
return
run_test
(
"No test name provided"
,
NULL
,
NULL
,
0
);
...
...
gcc/fixinc/hackshell.tpl
View file @
87ad679b
...
...
@@ -24,7 +24,9 @@
_FOR fix "\n\n" =]
#
# Fix [=_eval _index 1 + #%3d _printf=]: [=hackname _Cap=]
# Fix [=
_IF FIXINC_DEBUG _exist =][=_eval _index 1 + #%3d _printf=]: [=
_ENDIF =][=hackname _Cap=]
#[=
_IF files _exist=]
case "$
{
file
}
" in [=_FOR files " | \\\n\t"=]./[=files=][=/files=] )[=
...
...
@@ -117,12 +119,12 @@ _FOR fix "\n\n" =]
_ELIF replace _exist =][=
_IF replace _len 0 > =]
echo "[=hackname
_down
=] replacing file $
{
file
}
" >
&
2
echo "[=hackname =] replacing file $
{
file
}
" >
&
2
cat > $
{
DESTFILE
}
<
<
'
_EOF_
'
[=
replace=
]
_EOF_
[=
_ELSE =
]
echo
"[=
hackname
_down
=
]
bypassing
file
$
{
file
}
"[=
echo
"[=
hackname =
]
bypassing
file
$
{
file
}
"[=
_ENDIF =
]
continue
[=
...
...
gcc/fixinc/inclhack.def
View file @
87ad679b
...
...
@@ -8,12 +8,17 @@ autogen definitions inclhack;
Define all the fixes we know about for repairing damaged headers.
Please see the README before adding or changing entries in this file.
Now, first: DO NOT DO BROKEN FIXES (empty replacement fixes) */
Set up a debug test so we can make the templates emit special
code while debugging these fixes: */
#ifdef DEBUG
FIXINC_DEBUG = yes;
#endif
/* DO NOT DO BROKEN FIXES (empty replacement fixes) */
/*
* Purge some HP-UX 11 files that are only b
or
ken after they are "fixed".
* Purge some HP-UX 11 files that are only b
ro
ken after they are "fixed".
*/
fix = {
hackname = AAA_ki_iface;
...
...
@@ -24,7 +29,7 @@ fix = {
/*
* Purge some HP-UX 11 files that are only b
or
ken after they are "fixed".
* Purge some HP-UX 11 files that are only b
ro
ken after they are "fixed".
*/
fix = {
hackname = AAA_ki;
...
...
@@ -35,7 +40,7 @@ fix = {
/*
* Purge some HP-UX 11 files that are only b
or
ken after they are "fixed".
* Purge some HP-UX 11 files that are only b
ro
ken after they are "fixed".
*/
fix = {
hackname = AAA_ki_calls;
...
...
@@ -46,7 +51,7 @@ fix = {
/*
* Purge some HP-UX 11 files that are only b
or
ken after they are "fixed".
* Purge some HP-UX 11 files that are only b
ro
ken after they are "fixed".
*/
fix = {
hackname = AAA_ki_defs;
...
...
@@ -71,7 +76,7 @@ fix = {
/*
* Purge some HP-UX 11 files that are only b
or
ken after they are "fixed".
* Purge some HP-UX 11 files that are only b
ro
ken after they are "fixed".
*/
fix = {
hackname = AAA_time;
...
...
gcc/fixinc/inclhack.sh
View file @
87ad679b
This diff is collapsed.
Click to expand it.
gcc/fixinc/inclhack.tpl
View file @
87ad679b
[= autogen template -*- Mode:
k
sh -*-
[= autogen template -*- Mode: sh -*-
sh
#
#
...
...
@@ -25,8 +25,9 @@ sh
# Directory in which to store the results.
# Fail if no arg to specify a directory for the output.
if [ "x$1" = "x" ]
then echo fixincludes: no output directory specified
exit 1
then
echo fixincludes: no output directory specified
exit 1
fi
LIB=$
{
1
}
...
...
@@ -48,6 +49,18 @@ fi
FIXTESTS=$PWD/fixinc/fixtests
FIXFIXES=$PWD/fixinc/fixfixes
[=_ENDIF=]
if test -z "$VERBOSE"
then
VERBOSE=[=
_IF FIXINC_DEBUG _exist =]3[=_ELSE=]2[=_ENDIF=]
export VERBOSE
else
case "$VERBOSE" in
[0-9] ) : ;;
* ) VERBOSE=3 ;;
esac
fi
# Define what target system we're fixing.
#
if test -r ./Makefile; then
...
...
@@ -92,7 +105,8 @@ case $LIB in
;;
esac
echo
Fixing
headers
into
$
{
LIB
}
for
$
{
target_canonical
}
target
if
test
$
VERBOSE
-gt
0
then
echo
Fixing
headers
into
$
{
LIB
}
for
$
{
target_canonical
}
target
;
fi
#
Determine
whether
this
system
has
symbolic
links
.
if
ln
-s
X
$
LIB
/
ShouldNotExist
2
>
/dev/null; then
...
...
@@ -127,7 +141,8 @@ INPUT=`${PWDCMD}`
#
# # # # # # # # # # # # # # # # # # # # #
#
echo Finding directories and links to directories
if test $VERBOSE -gt 1
then echo Finding directories and links to directories ; fi
# Find all directories and all symlinks that point to directories.
# Put the list in $all_dirs.
...
...
@@ -146,7 +161,8 @@ do
newdirs=
for d in $dirs
do
echo " Searching $INPUT/$d"
if test $VERBOSE -gt 1
then echo " Searching $INPUT/$d" ; fi
# Find all directories under $d, relative to $d, excluding $d itself.
# (The /. is needed after $d in case $d is a symlink.)
...
...
@@ -182,8 +198,10 @@ done
# # # # # # # # # # # # # # # # # # # # #
#
dirs=
echo "All directories (including links to directories):"
echo $all_dirs
if test $VERBOSE -gt 2
then echo "All directories (including links to directories):"
echo $all_dirs
fi
for file in $all_dirs; do
rm -rf $LIB/$file
...
...
@@ -201,7 +219,8 @@ mkdir $LIB/root
treetops=". $
{
LIB
}
"
if $LINKS; then
echo 'Making symbolic directory links'
if test $VERBOSE -gt 1
then echo 'Making symbolic directory links' ; fi
cwd=`$
{
PWDCMD
}
`
for sym_link in $search_dirs; do
...
...
@@ -231,7 +250,8 @@ if $LINKS; then
# If a link points to ., make a similar link to .
#
if [ $
{
full_dest_dir
}
= $
{
cinput
}
]; then
echo $
{
sym_link
}
'->' . ': Making self link'
if test $VERBOSE -gt 2
then echo $
{
sym_link
}
'->' . ': Making self link' ; fi
rm -fr $
{
LIB
}
/$
{
sym_link
}
> /dev/null 2>
&
1
ln -s . $
{
LIB
}
/$
{
sym_link
}
> /dev/null 2>
&
1
...
...
@@ -244,7 +264,8 @@ if $LINKS; then
# DOTS is the relative path from $
{
LIB
}
/$
{
sym_link
}
back to $
{
LIB
}
.
dots=`echo "$
{
sym_link
}
" |
sed -e 's@^./@@' -e 's@/./@/@g' -e 's@[^/][^/]*@..@g' -e 's@..$@@'`
echo $
{
sym_link
}
'->' $dots$y ': Making local link'
if test $VERBOSE -gt 2
then echo $
{
sym_link
}
'->' $dots$y ': Making local link' ; fi
rm -fr $
{
LIB
}
/$
{
sym_link
}
> /dev/null 2>
&
1
ln -s $dots$y $
{
LIB
}
/$
{
sym_link
}
> /dev/null 2>
&
1
...
...
@@ -254,7 +275,9 @@ if $LINKS; then
# and process $target into $
{
INPUT
}
/root$target
# treat this directory as if it actually contained the files.
#
echo $
{
sym_link
}
'->' root$
{
full_dest_dir
}
': Making rooted link'
if test $VERBOSE -gt 2
then echo $
{
sym_link
}
'->' root$
{
full_dest_dir
}
': Making rooted link'
fi
if [ -d $LIB/root$
{
full_dest_dir
}
]
then true
else
...
...
@@ -278,7 +301,8 @@ if $LINKS; then
$
{
sym_link
}
/*)
dupdir=$
{
LIB
}
/root$
{
full_dest_dir
}
/`echo $file2 |
sed -n "s|^$
{
sym_link
}
/||p"`
echo "Duplicating $
{
sym_link
}
's $
{
dupdir
}
"
if test $VERBOSE -gt 2
then echo "Duplicating $
{
sym_link
}
's $
{
dupdir
}
" ; fi
if [ -d $
{
dupdir
}
]
then true
else
...
...
@@ -333,7 +357,8 @@ while [ $# != 0 ]; do
then continue ; fi
touch $
{
DESTDIR
}
/DONE
echo Fixing directory $
{
SRCDIR
}
into $
{
DESTDIR
}
if test $VERBOSE -gt 1
then echo Fixing directory $
{
SRCDIR
}
into $
{
DESTDIR
}
; fi
# Check files which are symlinks as well as those which are files.
#
...
...
@@ -384,7 +409,8 @@ while [ $# != 0 ]; do
cp $2 $3 >/dev/null 2>
&
1 || echo "Can't copy $2" >
&
2
chmod +w $3 2>/dev/null
chmod a+r $3 2>/dev/null
echo Copied $2
if test $VERBOSE -gt 2
then echo Copied $2 ; fi
for include in `egrep '^[ ]*#[ ]*include[ ]*"[^/]' $3 |
sed -e 's/^[ ]*#[ ]*include[ ]*"\([^"]*\)".*$/\1/'`
do
...
...
@@ -400,17 +426,22 @@ while [ $# != 0 ]; do
shift
done
echo 'Cleaning up DONE files.'
if test $VERBOSE -gt 2
then echo 'Cleaning up DONE files.' ; fi
cd $LIB
find . -name DONE -exec rm -f '{}' ';'
echo 'Removing unneeded directories:'
if test $VERBOSE -gt 1
then echo 'Cleaning up unneeded directories:' ; fi
cd $LIB
all_dirs=`find . -type d \! -name '.' -print | sort -r`
for file in $all_dirs; do
rmdir $LIB/$file > /dev/null 2>
&
1
done
if test $VERBOSE -gt 0
then echo fixincludes is done ; fi
# # # # # # # # # # # # # # # # # # # # #
#
# End of for INPUT directories
...
...
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