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
e9cd0b25
Commit
e9cd0b25
authored
Aug 09, 1993
by
Per Bothner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge. See ChangeLog.
From-SVN: r5125
parent
690ddf3e
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
66 additions
and
25 deletions
+66
-25
gcc/fix-header.c
+26
-17
gcc/fixproto
+0
-0
gcc/scan-decls.c
+40
-8
No files found.
gcc/fix-header.c
View file @
e9cd0b25
...
...
@@ -198,7 +198,7 @@ read_scan_file (scan_file)
struct
partial_proto
*
partial
;
struct
fn_decl
*
fn
;
int
ch
;
char
*
ptr
,
*
fname
,
*
extern_C
,
*
rtype
,
*
args
,
*
file_seen
,
*
line_seen
;
char
*
ptr
,
*
fname
,
*
kind
,
*
rtype
,
*
args
,
*
file_seen
,
*
line_seen
;
line
.
ptr
=
line
.
base
;
ch
=
read_upto
(
scan_file
,
&
line
,
'\n'
);
if
(
ch
==
EOF
)
...
...
@@ -207,11 +207,11 @@ read_scan_file (scan_file)
fname
=
line
.
base
;
for
(
ptr
=
fname
;
*
ptr
!=
';'
;
)
ptr
++
;
*
ptr
=
0
;
extern_C
=
ptr
+
1
;
for
(
ptr
=
extern_C
;
*
ptr
!=
';'
;
)
ptr
++
;
kind
=
ptr
+
1
;
for
(
ptr
=
kind
;
*
ptr
!=
';'
;
)
ptr
++
;
*
ptr
=
0
;
if
(
*
extern_C
==
'X'
)
if
(
*
kind
==
'X'
)
{
switch
(
special_file_handling
)
{
...
...
@@ -222,7 +222,7 @@ read_scan_file (scan_file)
continue
;
}
if
(
*
extern_C
==
'M'
)
if
(
*
kind
==
'M'
)
{
/* The original include file defines fname as a macro. */
fn
=
lookup_std_proto
(
fname
);
...
...
@@ -273,7 +273,7 @@ read_scan_file (scan_file)
for
(
ptr
=
line_seen
;
*
ptr
!=
';'
;
)
ptr
++
;
*
ptr
=
0
;
if
(
extern_C
[
0
]
==
'f'
)
if
(
kind
[
0
]
==
'f'
)
missing_extern_C_count
++
;
fn
=
lookup_std_proto
(
fname
);
...
...
@@ -289,6 +289,9 @@ read_scan_file (scan_file)
if
(
args
[
0
]
!=
'\0'
)
continue
;
if
(
kind
[
0
]
==
'I'
)
/* don't edit inline function */
continue
;
/* If the partial prototype was included from some other file,
we don't need to patch it up (in this run). */
i
=
strlen
(
file_seen
);
...
...
@@ -298,7 +301,7 @@ read_scan_file (scan_file)
if
(
fn
==
NULL
)
continue
;
if
(
fn
->
fname
[
0
]
==
'\0'
||
strcmp
(
fn
->
fname
,
"void"
)
==
0
)
if
(
fn
->
params
[
0
]
==
'\0'
||
strcmp
(
fn
->
params
,
"void"
)
==
0
)
continue
;
/* We only have a partial function declaration,
...
...
@@ -329,15 +332,21 @@ read_scan_file (scan_file)
fprintf
(
stderr
,
"%s: OK, nothing needs to be done.
\n
"
,
inc_filename
);
exit
(
0
);
}
if
(
required_unseen_count
)
fprintf
(
stderr
,
"%s: %d missing function declarations.
\n
"
,
inc_filename
,
required_unseen_count
);
if
(
partial_count
)
fprintf
(
stderr
,
"%s: %d non-prototype function declarations.
\n
"
,
inc_filename
,
partial_count
);
if
(
missing_extern_C_count
)
fprintf
(
stderr
,
"%s: %d declarations not protected by extern
\"
C
\"
.
\n
"
,
inc_filename
,
missing_extern_C_count
);
if
(
!
verbose
)
fprintf
(
stderr
,
"%s: fixing %s
\n
"
,
progname
,
inc_filename
);
else
{
if
(
required_unseen_count
)
fprintf
(
stderr
,
"%s: %d missing function declarations.
\n
"
,
inc_filename
,
required_unseen_count
);
if
(
partial_count
)
fprintf
(
stderr
,
"%s: %d non-prototype function declarations.
\n
"
,
inc_filename
,
partial_count
);
if
(
missing_extern_C_count
)
fprintf
(
stderr
,
"%s: %d declarations not protected by extern
\"
C
\"
.
\n
"
,
inc_filename
,
missing_extern_C_count
);
}
}
write_rbrac
()
...
...
@@ -652,7 +661,7 @@ main(argc, argv)
}
}
else
putc
(
c
,
outf
);
fprintf
(
outf
,
" %c"
,
c
);
}
}
else
...
...
gcc/fixproto
View file @
e9cd0b25
This diff is collapsed.
Click to expand it.
gcc/scan-decls.c
View file @
e9cd0b25
...
...
@@ -21,8 +21,8 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
NAME;C;RTYPE;ARGS;FILENAME;LINENO;
NAME is the function's name.
C is "
F" if the declaration is nested inside 'extern "C"' braces;
otherwise "f".
C is "
I" if the function is declared as inline; "F" if the
declaration is nested inside 'extern "C"' braces;
otherwise "f".
RTYPE is the function's return type.
ARGS is the function's argument list.
FILENAME and LINENO is where the declarations was seen
...
...
@@ -58,18 +58,36 @@ char extern_C_braces[20];
prefixed by extern "C". */
int
current_extern_C
=
0
;
static
void
skip_to_closing_brace
(
fp
)
FILE
*
fp
;
{
int
nesting
=
1
;
for
(;;)
{
int
c
=
get_token
(
fp
,
&
buf
);
if
(
c
==
EOF
)
break
;
if
(
c
==
'{'
)
nesting
++
;
if
(
c
==
'}'
&&
--
nesting
==
0
)
break
;
}
}
int
main
()
{
FILE
*
fp
=
stdin
;
int
c
;
int
saw_extern
;
int
saw_extern
,
saw_inline
;
new_statement
:
c
=
get_token
(
fp
,
&
buf
);
handle_statement
:
current_extern_C
=
0
;
saw_extern
=
0
;
saw_inline
=
0
;
if
(
c
==
'}'
)
{
/* pop an 'extern "C"' nesting level, if appropriate */
...
...
@@ -97,6 +115,11 @@ main ()
fprintf
(
stdout
,
"%s;M;
\n
"
,
buf
.
base
+
16
);
goto
new_statement
;
}
if
(
strcmp
(
buf
.
base
,
"inline"
)
==
0
)
{
saw_inline
=
1
;
c
=
get_token
(
fp
,
&
buf
);
}
if
(
strcmp
(
buf
.
base
,
"extern"
)
==
0
)
{
saw_extern
=
1
;
...
...
@@ -117,6 +140,10 @@ main ()
for
(;;)
{
int
followingc
=
getc
(
fp
);
/* char following token in buf */
MAKE_SSTRING_SPACE
(
&
rtype
,
1
);
*
rtype
.
ptr
=
0
;
if
(
c
==
IDENTIFIER_TOKEN
)
{
int
nextc
=
skip_spaces
(
fp
,
followingc
);
...
...
@@ -124,12 +151,10 @@ main ()
{
int
nesting
=
1
;
MAKE_SSTRING_SPACE
(
&
rtype
,
1
);
*
rtype
.
ptr
=
0
;
fprintf
(
stdout
,
"%s;%s;%s;"
,
buf
.
base
,
in_extern_C_brace
||
current_extern_C
?
"F"
:
"f"
,
saw_inline
?
"I"
:
in_extern_C_brace
||
current_extern_C
?
"F"
:
"f"
,
rtype
.
base
);
c
=
skip_spaces
(
fp
,
' '
);
for
(;;)
...
...
@@ -148,7 +173,14 @@ main ()
}
fprintf
(
stdout
,
";%s;%d;
\n
"
,
source_filename
.
base
,
source_lineno
);
goto
new_statement
;
c
=
get_token
(
fp
,
&
buf
);
if
(
c
==
'{'
)
{
/* skip body of (normally) inline function */
skip_to_closing_brace
(
fp
);
goto
new_statement
;
}
goto
handle_statement
;
}
else
if
(
nextc
==
';'
&&
saw_extern
)
{
...
...
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