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
d7943819
Commit
d7943819
authored
Oct 12, 1993
by
Per Bothner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Re-write. New logic, assuming implicit extern "C" from cpp.
From-SVN: r5762
parent
d7c824c3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
93 additions
and
47 deletions
+93
-47
gcc/fixproto
+93
-47
No files found.
gcc/fixproto
View file @
d7943819
#!/bin/sh
#!/bin/sh
#
#
# SYNOPSIS
# SYNOPSIS
# fixproto TARGET-DIR
[ SOURCE-DIR ... ]
# fixproto TARGET-DIR
SOURCE-DIR-ALL SOURCE-DIR-STD
#
#
# COPYRIGHT
# COPYRIGHT
# Copyright (C) 1993 Free Software Foundation, Inc.
# Copyright (C) 1993 Free Software Foundation, Inc.
...
@@ -25,7 +25,9 @@
...
@@ -25,7 +25,9 @@
# Adjunct script for GNU CC to populate a directory with ANSI,
# Adjunct script for GNU CC to populate a directory with ANSI,
# Posix.1, and C++ compatible header files.
# Posix.1, and C++ compatible header files.
#
#
# Each file found under each SOURCE-DIR is analized and "fixed."
# Each file found under SOURCE-DIR-ALL is analyzed and "fixed."
# Only standard ANSI/POSIX files found under SOURCE-DIR-STD
# are analyzed and "fixed."
# The SOURCE-DIRs are searched in order; a file found
# The SOURCE-DIRs are searched in order; a file found
# under multiple SOURCE-DIRs is only handled for the first one.
# under multiple SOURCE-DIRs is only handled for the first one.
#
#
...
@@ -60,8 +62,16 @@ if [ `echo $1 | wc -w` = 0 ] ; then
...
@@ -60,8 +62,16 @@ if [ `echo $1 | wc -w` = 0 ] ; then
echo
$progname
\:
usage
\:
$progname
target-dir
\[
source-dir
\.\.\.
\]
echo
$progname
\:
usage
\:
$progname
target-dir
\[
source-dir
\.\.\.
\]
exit
1
exit
1
fi
fi
std_files
=
"ctype.h dirent.h errno.h curses.h fcntl.h grp.h locale.h math.h pwd.h setjmp.h signal.h stdio.h stdlib.h string.h sys/stat.h sys/times.h sys/resource.h sys/utsname.h sys/wait.h tar.h termios.h time.h unistd.h"
rel_target_dir
=
$1
rel_target_dir
=
$1
shift
# All files in $src_dir_all (normally same as $rel_target_dir) are
# processed.
src_dir_all
=
$2
# In $src_dir_std (normally same as /usr/include), only the
# "standard" ANSI/POSIX files listed in $std_files are processed.
src_dir_std
=
$3
if
[
`
expr
$rel_target_dir
:
'\(.\)'
`
!=
'/'
]
;
then
if
[
`
expr
$rel_target_dir
:
'\(.\)'
`
!=
'/'
]
;
then
abs_target_dir
=
$original_dir
/
$rel_target_dir
abs_target_dir
=
$original_dir
/
$rel_target_dir
...
@@ -90,7 +100,7 @@ echo $progname\: populating \`$rel_target_dir\'
...
@@ -90,7 +100,7 @@ echo $progname\: populating \`$rel_target_dir\'
include_path
=
""
include_path
=
""
if
[
`
echo
$*
| wc
-w
`
!=
0
]
;
then
if
[
`
echo
$*
| wc
-w
`
!=
0
]
;
then
for
rel_source_dir
in
$
*
;
do
for
rel_source_dir
in
$
src_dir_all
$src_dir_std
;
do
if
[
`
expr
$rel_source_dir
:
'\(.\)'
`
!=
'/'
]
;
then
if
[
`
expr
$rel_source_dir
:
'\(.\)'
`
!=
'/'
]
;
then
abs_source_dir
=
$original_dir
/
$rel_source_dir
abs_source_dir
=
$original_dir
/
$rel_source_dir
else
else
...
@@ -109,43 +119,53 @@ required_unistd_h="_exit access alarm chdir chown close ctermid cuserid dup dup2
...
@@ -109,43 +119,53 @@ required_unistd_h="_exit access alarm chdir chown close ctermid cuserid dup dup2
done_dirs
=
""
done_dirs
=
""
echo
""
>
fixproto.list
echo
""
>
fixproto.list
if
[
`
echo
$*
| wc
-w
`
!=
0
]
;
then
for
code
in
ALL STD
;
do
for
rel_source_dir
in
$*
;
do
if
[
`
expr
$rel_source_dir
:
'\(.\)'
`
!=
'/'
]
;
then
subdirs
=
"."
abs_source_dir
=
$original_dir
/
$rel_source_dir
else
case
$code
in
abs_source_dir
=
$rel_source_dir
ALL
)
fi
rel_source_dir
=
$src_dir_all
if
[
\!
-d
$abs_source_dir
]
;
then
echo
$progname
\:
warning
\:
no such directory
\:
\`
$rel_source_dir
\'
continue
fi
dirs
=
"."
dirs
=
"."
levels
=
2
levels
=
2
subdirs
=
"."
while
$LINKS
&&
test
-n
"
$dirs
"
-a
$levels
-gt
0
while
$LINKS
&&
test
-n
"
$dirs
"
-a
$levels
-gt
0
do
do
levels
=
`
expr
$levels
- 1
`
levels
=
`
expr
$levels
- 1
`
newdirs
=
newdirs
=
for
d
in
$dirs
;
do
for
d
in
$dirs
;
do
# Find all directories under $d, relative to $d, excluding $d itself.
# Find all directories under $d, relative to $d, excluding $d itself.
subdirs
=
"
$subdirs
"
`
cd
$rel_source_dir
/
$d
;
find
.
-type
d
-print
|
\
subdirs
=
"
$subdirs
"
`
cd
$abs_source_dir
/
$d
;
find
.
-type
d
-print
|
\
sed
-e
'/^\.$/d'
-e
"s|^
\.
/|
${
d
}
/|"
-e
's|^\./||'
`
sed
-e
'/^\.$/d'
-e
"s|^
\.
/|
${
d
}
/|"
-e
's|^\./||'
`
links
=
links
=
links
=
`
cd
$rel_source_dir
;
find
$d
/.
-type
l
-print
|
\
links
=
`
cd
$abs_source_dir
;
find
$d
/.
-type
l
-print
|
\
sed
-e
"s|
$d
/./|
$d
/|"
-e
's|^\./||'
`
sed
-e
"s|
$d
/./|
$d
/|"
-e
's|^\./||'
`
for
link
in
$links
--dummy--
;
do
for
link
in
$links
--dummy--
;
do
if
test
-d
$abs_source_dir
/
$link
/.
;
then
test
-d
$rel_source_dir
/
$link
/.
&&
newdirs
=
"
$newdirs
$link
"
newdirs
=
"
$newdirs
$link
"
done
fi
done
done
dirs
=
"
$newdirs
"
subdirs
=
"
$subdirs
$newdirs
"
done
done
dirs
=
"
$newdirs
"
;;
subdirs
=
"
$subdirs
$newdirs
"
STD
)
done
rel_source_dir
=
$src_dir_std
;;
esac
if
[
`
expr
$rel_source_dir
:
'\(.\)'
`
!=
'/'
]
;
then
abs_source_dir
=
$original_dir
/
$rel_source_dir
else
abs_source_dir
=
$rel_source_dir
fi
if
[
\!
-d
$abs_source_dir
]
;
then
echo
$progname
\:
warning
\:
no such directory
\:
\`
$rel_source_dir
\'
continue
fi
for
rel_source_subdir
in
$subdirs
;
do
for
rel_source_subdir
in
$subdirs
;
do
abs_target_subdir
=
${
abs_target_dir
}
/
${
rel_source_subdir
}
abs_target_subdir
=
${
abs_target_dir
}
/
${
rel_source_subdir
}
if
[
\!
-d
$abs_target_subdir
]
;
then
if
[
\!
-d
$abs_target_subdir
]
;
then
mkdir
$abs_target_subdir
mkdir
$abs_target_subdir
...
@@ -153,9 +173,41 @@ if [ `echo $* | wc -w` != 0 ] ; then
...
@@ -153,9 +173,41 @@ if [ `echo $* | wc -w` != 0 ] ; then
# Append "/"; remove initial "./". Hence "." -> "" and "sys" -> "sys/".
# Append "/"; remove initial "./". Hence "." -> "" and "sys" -> "sys/".
rel_source_prefix
=
`
echo
$rel_source_subdir
| sed
-e
's|$|/|'
-e
's|^./||'
`
rel_source_prefix
=
`
echo
$rel_source_subdir
| sed
-e
's|$|/|'
-e
's|^./||'
`
# The 'sed' is in case the *.h matches nothing, which yields "*.h"
case
$code
in
# which would then get re-globbed in the current directory. Sigh.
ALL
)
rel_source_files
=
`
cd
${
abs_source_dir
}
/
${
rel_source_subdir
}
;
echo
*
.h | sed
-e
's|[*].h|NONE|'
`
# The 'sed' is in case the *.h matches nothing, which yields "*.h"
# which would then get re-globbed in the current directory. Sigh.
rel_source_files
=
`
cd
${
abs_source_dir
}
/
${
rel_source_subdir
}
;
echo
*
.h | sed
-e
's|[*].h|NONE|'
`
;;
STD
)
files_to_check
=
"
$std_files
"
rel_source_files
=
""
# Also process files #included by the $std_files.
while
[
-n
"
${
files_to_check
}
"
]
do
new_files_to_check
=
""
for
file
in
$files_to_check
;
do
case
"
$rel_source_files
"
in
*
"
${
file
}
"
*
)
# Already seen $file; nothing to do
;;
*
)
new_files_to_check
=
"
$new_files_to_check
`
sed
-n
\
-e
's@ @ @g'
\
-e
's@^ *# *include *<\([^>]*\)>.*$@\1@p'
\
-e
's@^ *# *include *\"\([^\"]*\)\".*$@\1@p'
\
<
$src_dir_std
/
$file
`
"
rel_source_files
=
"
$rel_source_files
$file
"
;;
esac
done
files_to_check
=
"
$new_files_to_check
"
done
rel_source_files
=
"
$rel_source_files
"
;;
esac
for
filename
in
$rel_source_files
;
do
for
filename
in
$rel_source_files
;
do
rel_source_file
=
${
rel_source_prefix
}${
filename
}
rel_source_file
=
${
rel_source_prefix
}${
filename
}
...
@@ -169,7 +221,6 @@ if [ `echo $* | wc -w` != 0 ] ; then
...
@@ -169,7 +221,6 @@ if [ `echo $* | wc -w` != 0 ] ; then
elif
test
-f
$abs_target_file
-a
-n
"
$done_dirs
"
\
elif
test
-f
$abs_target_file
-a
-n
"
$done_dirs
"
\
&&
grep
"
$rel_source_file
"
fixproto.list
>
/dev/null
&&
grep
"
$rel_source_file
"
fixproto.list
>
/dev/null
then
true
then
true
# echo $abs_target_file exists, $abs_source_file is ignored
else
else
# echo doing $rel_source_file from $abs_source_dir
# echo doing $rel_source_file from $abs_source_dir
required_list
=
required_list
=
...
@@ -246,11 +297,7 @@ if [ `echo $* | wc -w` != 0 ] ; then
...
@@ -246,11 +297,7 @@ if [ `echo $* | wc -w` != 0 ] ; then
done
done
if
${
CPP
}
-D__STDC__
-D__cplusplus
-D_POSIX_SOURCE
$include_path
fixtmp.c
>
fixtmp.i 2>/dev/null
if
${
CPP
}
-D__STDC__
-D__cplusplus
-D_POSIX_SOURCE
$include_path
fixtmp.c
>
fixtmp.i 2>/dev/null
then
then
cat
$abs_source_file
>
fixtmp.c
$original_dir
/patch-header
$rel_source_file
$abs_source_file
$abs_target_file
"
$required_list
"
<fixtmp.i
# echo Doing: "$original_dir/scan-decls <fixtmp.i | $original_dir/patch-header $rel_source_file fixtmp.c $abs_target_file \"$required_list\""
$original_dir
/scan-decls <fixtmp.i |
\
$original_dir
/patch-header
$rel_source_file
fixtmp.c
$abs_target_file
"
$required_list
"
else
else
echo
"
${
progname
}
: cpp could not parse
${
abs_source_file
}
(ignored)"
echo
"
${
progname
}
: cpp could not parse
${
abs_source_file
}
(ignored)"
fi
fi
...
@@ -272,8 +319,7 @@ if [ `echo $* | wc -w` != 0 ] ; then
...
@@ -272,8 +319,7 @@ if [ `echo $* | wc -w` != 0 ] ; then
fi
fi
fi
fi
done_dirs
=
"
$done_dir
$rel_source_dir
"
done_dirs
=
"
$done_dir
$rel_source_dir
"
done
done
fi
# This might be more cleanly moved into the main loop, by adding
# This might be more cleanly moved into the main loop, by adding
# a <dummy> source directory at the end. FIXME!
# a <dummy> source directory at the end. FIXME!
...
...
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