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
2aa7ec37
Commit
2aa7ec37
authored
Mar 14, 1992
by
Richard Stallman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
*** empty log message ***
From-SVN: r482
parent
64a184e9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
62 additions
and
24 deletions
+62
-24
gcc/cccp.c
+62
-24
No files found.
gcc/cccp.c
View file @
2aa7ec37
...
@@ -377,6 +377,10 @@ static int warn_stringify;
...
@@ -377,6 +377,10 @@ static int warn_stringify;
static
int
warn_trigraphs
;
static
int
warn_trigraphs
;
/* Nonzero means warn if #import is used. */
static
int
warn_import
=
1
;
/* Nonzero means turn warnings into errors. */
/* Nonzero means turn warnings into errors. */
static
int
warnings_are_errors
;
static
int
warnings_are_errors
;
...
@@ -1081,6 +1085,10 @@ main (argc, argv)
...
@@ -1081,6 +1085,10 @@ main (argc, argv)
warn_stringify
=
1
;
warn_stringify
=
1
;
else
if
(
!
strcmp
(
argv
[
i
],
"-Wno-traditional"
))
else
if
(
!
strcmp
(
argv
[
i
],
"-Wno-traditional"
))
warn_stringify
=
0
;
warn_stringify
=
0
;
else
if
(
!
strcmp
(
argv
[
i
],
"-Wimport"
))
warn_import
=
1
;
else
if
(
!
strcmp
(
argv
[
i
],
"-Wno-import"
))
warn_import
=
0
;
else
if
(
!
strcmp
(
argv
[
i
],
"-Werror"
))
else
if
(
!
strcmp
(
argv
[
i
],
"-Werror"
))
warnings_are_errors
=
1
;
warnings_are_errors
=
1
;
else
if
(
!
strcmp
(
argv
[
i
],
"-Wno-error"
))
else
if
(
!
strcmp
(
argv
[
i
],
"-Wno-error"
))
...
@@ -1446,7 +1454,13 @@ main (argc, argv)
...
@@ -1446,7 +1454,13 @@ main (argc, argv)
startp
=
endp
=
epath
;
startp
=
endp
=
epath
;
num_dirs
=
0
;
num_dirs
=
0
;
while
(
1
)
{
while
(
1
)
{
if
((
*
endp
==
':'
)
||
(
*
endp
==
'\0'
))
{
/* Handle cases like c:/usr/lib:d:/gcc/lib */
if
((
*
endp
==
':'
#ifdef __MSDOS__
&&
(
endp
-
startp
!=
1
||
!
isalpha
(
*
startp
)))
#endif
)
||
(
*
endp
==
0
))
{
strncpy
(
nstore
,
startp
,
endp
-
startp
);
strncpy
(
nstore
,
startp
,
endp
-
startp
);
if
(
endp
==
startp
)
if
(
endp
==
startp
)
strcpy
(
nstore
,
"."
);
strcpy
(
nstore
,
"."
);
...
@@ -1813,7 +1827,12 @@ path_include (path)
...
@@ -1813,7 +1827,12 @@ path_include (path)
struct
file_name_list
*
dirtmp
;
struct
file_name_list
*
dirtmp
;
/* Find the end of this name. */
/* Find the end of this name. */
#ifdef __MSDOS__
/* Handle cases like c:/usr/lib:d:/gcc/lib */
while
(
*
q
!=
0
&&
(
*
q
!=
':'
||
(
q
-
p
==
1
&&
isalpha
(
*
p
))))
q
++
;
#else
while
(
*
q
!=
0
&&
*
q
!=
':'
)
q
++
;
while
(
*
q
!=
0
&&
*
q
!=
':'
)
q
++
;
#endif
if
(
p
==
q
)
{
if
(
p
==
q
)
{
/* An empty name in the path stands for the current directory. */
/* An empty name in the path stands for the current directory. */
name
=
(
char
*
)
xmalloc
(
2
);
name
=
(
char
*
)
xmalloc
(
2
);
...
@@ -1924,7 +1943,7 @@ trigraph_pcp (buf)
...
@@ -1924,7 +1943,7 @@ trigraph_pcp (buf)
/* Move all backslash-newline pairs out of embarrassing places.
/* Move all backslash-newline pairs out of embarrassing places.
Exchange all such pairs following BP
Exchange all such pairs following BP
with any potentially-embarrasing characters that follow them.
with any potentially-embarras
s
ing characters that follow them.
Potentially-embarrassing characters are / and *
Potentially-embarrassing characters are / and *
(because a backslash-newline inside a comment delimiter
(because a backslash-newline inside a comment delimiter
would cause it not to be recognized). */
would cause it not to be recognized). */
...
@@ -3042,7 +3061,7 @@ handle_directive (ip, op)
...
@@ -3042,7 +3061,7 @@ handle_directive (ip, op)
bp
++
;
bp
++
;
}
else
if
(
*
bp
==
'/'
&&
bp
[
1
]
==
'*'
)
{
}
else
if
(
*
bp
==
'/'
&&
bp
[
1
]
==
'*'
)
{
ip
->
bufp
=
bp
;
ip
->
bufp
=
bp
;
skip_to_end_of_comment
(
ip
,
&
ip
->
lineno
);
skip_to_end_of_comment
(
ip
,
&
ip
->
lineno
,
0
);
bp
=
ip
->
bufp
;
bp
=
ip
->
bufp
;
}
else
if
(
*
bp
==
'\\'
&&
bp
[
1
]
==
'\n'
)
{
}
else
if
(
*
bp
==
'\\'
&&
bp
[
1
]
==
'\n'
)
{
bp
+=
2
;
ip
->
lineno
++
;
bp
+=
2
;
ip
->
lineno
++
;
...
@@ -3186,7 +3205,7 @@ handle_directive (ip, op)
...
@@ -3186,7 +3205,7 @@ handle_directive (ip, op)
||
((
cplusplus
||
objc
)
&&
*
bp
==
'/'
))
{
||
((
cplusplus
||
objc
)
&&
*
bp
==
'/'
))
{
U_CHAR
*
obp
=
bp
-
1
;
U_CHAR
*
obp
=
bp
-
1
;
ip
->
bufp
=
bp
+
1
;
ip
->
bufp
=
bp
+
1
;
skip_to_end_of_comment
(
ip
,
&
ip
->
lineno
);
skip_to_end_of_comment
(
ip
,
&
ip
->
lineno
,
0
);
bp
=
ip
->
bufp
;
bp
=
ip
->
bufp
;
/* No need to copy the command because of a comment at the end;
/* No need to copy the command because of a comment at the end;
just don't include the comment in the directive. */
just don't include the comment in the directive. */
...
@@ -3320,7 +3339,7 @@ handle_directive (ip, op)
...
@@ -3320,7 +3339,7 @@ handle_directive (ip, op)
ip
->
bufp
=
xp
+
1
;
ip
->
bufp
=
xp
+
1
;
/* If we already copied the command through,
/* If we already copied the command through,
already_output != 0 prevents outputting comment now. */
already_output != 0 prevents outputting comment now. */
skip_to_end_of_comment
(
ip
,
already_output
);
skip_to_end_of_comment
(
ip
,
already_output
,
0
);
if
(
keep_comments
)
if
(
keep_comments
)
while
(
xp
!=
ip
->
bufp
)
while
(
xp
!=
ip
->
bufp
)
*
cp
++
=
*
xp
++
;
*
cp
++
=
*
xp
++
;
...
@@ -3588,7 +3607,8 @@ do_include (buf, limit, op, keyword)
...
@@ -3588,7 +3607,8 @@ do_include (buf, limit, op, keyword)
int
pcfnum
;
int
pcfnum
;
f
=
-
1
;
/* JF we iz paranoid! */
f
=
-
1
;
/* JF we iz paranoid! */
if
(
importing
&&
!
instack
[
indepth
].
system_header_p
&&
!
import_warning
)
{
if
(
importing
&&
warn_import
&&
!
instack
[
indepth
].
system_header_p
&&
!
import_warning
)
{
import_warning
=
1
;
import_warning
=
1
;
warning
(
"using `#import' is not recommended"
);
warning
(
"using `#import' is not recommended"
);
fprintf
(
stderr
,
"The fact that a certain header file need not be processed more than once
\n
"
);
fprintf
(
stderr
,
"The fact that a certain header file need not be processed more than once
\n
"
);
...
@@ -4336,7 +4356,7 @@ pcfinclude (buf, limit, name, op)
...
@@ -4336,7 +4356,7 @@ pcfinclude (buf, limit, name, op)
if
(
nkeys
==
-
1
)
if
(
nkeys
==
-
1
)
str
->
writeflag
=
1
;
str
->
writeflag
=
1
;
else
else
/* Otherwis
t
, for each key, */
/* Otherwis
e
, for each key, */
for
(;
nkeys
--
;
free
(
tmpbuf
.
buf
),
cp
=
endofthiskey
+
1
)
{
for
(;
nkeys
--
;
free
(
tmpbuf
.
buf
),
cp
=
endofthiskey
+
1
)
{
KEYDEF
*
kp
=
(
KEYDEF
*
)
cp
;
KEYDEF
*
kp
=
(
KEYDEF
*
)
cp
;
HASHNODE
*
hp
;
HASHNODE
*
hp
;
...
@@ -4441,7 +4461,7 @@ write_output ()
...
@@ -4441,7 +4461,7 @@ write_output ()
}
}
/* Pass a directive through to the output file.
/* Pass a directive through to the output file.
BUF points to the contents of the directive, as a conti
n
guous string.
BUF points to the contents of the directive, as a contiguous string.
LIMIT points to the first character past the end of the directive.
LIMIT points to the first character past the end of the directive.
KEYWORD is the keyword-table entry for the directive. */
KEYWORD is the keyword-table entry for the directive. */
...
@@ -4618,7 +4638,7 @@ create_definition (buf, limit, op)
...
@@ -4618,7 +4638,7 @@ create_definition (buf, limit, op)
}
}
/* Process a #define command.
/* Process a #define command.
BUF points to the contents of the #define command, as a conti
n
guous string.
BUF points to the contents of the #define command, as a contiguous string.
LIMIT points to the first character past the end of the definition.
LIMIT points to the first character past the end of the definition.
KEYWORD is the keyword-table entry for #define. */
KEYWORD is the keyword-table entry for #define. */
...
@@ -5558,6 +5578,8 @@ do_line (buf, limit, op, keyword)
...
@@ -5558,6 +5578,8 @@ do_line (buf, limit, op, keyword)
file_change
=
enter_file
;
file_change
=
enter_file
;
else
if
(
*
bp
==
'2'
)
else
if
(
*
bp
==
'2'
)
file_change
=
leave_file
;
file_change
=
leave_file
;
else
if
(
*
bp
==
'3'
)
ip
->
system_header_p
=
1
;
else
{
else
{
error
(
"invalid format `#line' command"
);
error
(
"invalid format `#line' command"
);
return
0
;
return
0
;
...
@@ -5565,6 +5587,11 @@ do_line (buf, limit, op, keyword)
...
@@ -5565,6 +5587,11 @@ do_line (buf, limit, op, keyword)
bp
++
;
bp
++
;
SKIP_WHITE_SPACE
(
bp
);
SKIP_WHITE_SPACE
(
bp
);
if
(
*
bp
==
'3'
)
{
ip
->
system_header_p
=
1
;
bp
++
;
SKIP_WHITE_SPACE
(
bp
);
}
if
(
*
bp
)
{
if
(
*
bp
)
{
error
(
"invalid format `#line' command"
);
error
(
"invalid format `#line' command"
);
return
0
;
return
0
;
...
@@ -5908,7 +5935,7 @@ do_xifdef (buf, limit, op, keyword)
...
@@ -5908,7 +5935,7 @@ do_xifdef (buf, limit, op, keyword)
int
junk
;
int
junk
;
U_CHAR
*
save_bufp
=
ip
->
bufp
;
U_CHAR
*
save_bufp
=
ip
->
bufp
;
ip
->
bufp
=
p
+
1
;
ip
->
bufp
=
p
+
1
;
p
=
skip_to_end_of_comment
(
ip
,
&
junk
);
p
=
skip_to_end_of_comment
(
ip
,
&
junk
,
1
);
ip
->
bufp
=
save_bufp
;
ip
->
bufp
=
save_bufp
;
}
}
break
;
break
;
...
@@ -6027,7 +6054,7 @@ skip_if_group (ip, any)
...
@@ -6027,7 +6054,7 @@ skip_if_group (ip, any)
if
(
*
bp
==
'*'
if
(
*
bp
==
'*'
||
((
cplusplus
||
objc
)
&&
*
bp
==
'/'
))
{
||
((
cplusplus
||
objc
)
&&
*
bp
==
'/'
))
{
ip
->
bufp
=
++
bp
;
ip
->
bufp
=
++
bp
;
bp
=
skip_to_end_of_comment
(
ip
,
&
ip
->
lineno
);
bp
=
skip_to_end_of_comment
(
ip
,
&
ip
->
lineno
,
0
);
}
}
break
;
break
;
case
'\"'
:
case
'\"'
:
...
@@ -6302,7 +6329,7 @@ do_endif (buf, limit, op, keyword)
...
@@ -6302,7 +6329,7 @@ do_endif (buf, limit, op, keyword)
int
junk
;
int
junk
;
U_CHAR
*
save_bufp
=
ip
->
bufp
;
U_CHAR
*
save_bufp
=
ip
->
bufp
;
ip
->
bufp
=
p
+
1
;
ip
->
bufp
=
p
+
1
;
p
=
skip_to_end_of_comment
(
ip
,
&
junk
);
p
=
skip_to_end_of_comment
(
ip
,
&
junk
,
1
);
ip
->
bufp
=
save_bufp
;
ip
->
bufp
=
save_bufp
;
}
}
break
;
break
;
...
@@ -6365,17 +6392,21 @@ validate_else (p)
...
@@ -6365,17 +6392,21 @@ validate_else (p)
pedwarn
(
"text following `#else' or `#endif' violates ANSI standard"
);
pedwarn
(
"text following `#else' or `#endif' violates ANSI standard"
);
}
}
/*
/* Skip a comment, assuming the input ptr immediately follows the
* Skip a comment, assuming the input ptr immediately follows the
initial slash-star. Bump *LINE_COUNTER for each newline.
* initial slash-star. Bump line counter as necessary.
(The canonical line counter is &ip->lineno.)
* (The canonical line counter is &ip->lineno).
Don't use this routine (or the next one) if bumping the line
* Don't use this routine (or the next one) if bumping the line
counter is not sufficient to deal with newlines in the string.
* counter is not sufficient to deal with newlines in the string.
*/
If NOWARN is nonzero, don't warn about slash-star inside a comment.
This feature is useful when processing a comment that is going to be
processed or was processed at another point in the preprocessor,
to avoid a duplicate warning. */
static
U_CHAR
*
static
U_CHAR
*
skip_to_end_of_comment
(
ip
,
line_counter
)
skip_to_end_of_comment
(
ip
,
line_counter
,
nowarn
)
register
FILE_BUF
*
ip
;
register
FILE_BUF
*
ip
;
int
*
line_counter
;
/* place to remember newlines, or NULL */
int
*
line_counter
;
/* place to remember newlines, or NULL */
int
nowarn
;
{
{
register
U_CHAR
*
limit
=
ip
->
buf
+
ip
->
length
;
register
U_CHAR
*
limit
=
ip
->
buf
+
ip
->
length
;
register
U_CHAR
*
bp
=
ip
->
bufp
;
register
U_CHAR
*
bp
=
ip
->
bufp
;
...
@@ -6415,7 +6446,7 @@ skip_to_end_of_comment (ip, line_counter)
...
@@ -6415,7 +6446,7 @@ skip_to_end_of_comment (ip, line_counter)
*
op
->
bufp
++
=
*
bp
;
*
op
->
bufp
++
=
*
bp
;
switch
(
*
bp
++
)
{
switch
(
*
bp
++
)
{
case
'/'
:
case
'/'
:
if
(
warn_comments
&&
bp
<
limit
&&
*
bp
==
'*'
)
if
(
warn_comments
&&
!
nowarn
&&
bp
<
limit
&&
*
bp
==
'*'
)
warning
(
"`/*' within comment"
);
warning
(
"`/*' within comment"
);
break
;
break
;
case
'\n'
:
case
'\n'
:
...
@@ -6525,7 +6556,7 @@ skip_quoted_string (bp, limit, start_line, count_newlines, backslash_newlines_p,
...
@@ -6525,7 +6556,7 @@ skip_quoted_string (bp, limit, start_line, count_newlines, backslash_newlines_p,
IP->bufp is updated. Use this with IP->bufp pointing at an open-paren.
IP->bufp is updated. Use this with IP->bufp pointing at an open-paren.
This does not handle newlines, because it's used for the arg of #if,
This does not handle newlines, because it's used for the arg of #if,
where there aren't any newlines. Also, bacslash-newline can't appear. */
where there aren't any newlines. Also, bac
k
slash-newline can't appear. */
static
U_CHAR
*
static
U_CHAR
*
skip_paren_group
(
ip
)
skip_paren_group
(
ip
)
...
@@ -6552,7 +6583,7 @@ skip_paren_group (ip)
...
@@ -6552,7 +6583,7 @@ skip_paren_group (ip)
case
'/'
:
case
'/'
:
if
(
*
p
==
'*'
)
{
if
(
*
p
==
'*'
)
{
ip
->
bufp
=
p
;
ip
->
bufp
=
p
;
p
=
skip_to_end_of_comment
(
ip
,
&
lines_dummy
);
p
=
skip_to_end_of_comment
(
ip
,
&
lines_dummy
,
0
);
p
=
ip
->
bufp
;
p
=
ip
->
bufp
;
}
}
...
@@ -6612,6 +6643,13 @@ output_line_command (ip, op, conditional, file_change)
...
@@ -6612,6 +6643,13 @@ output_line_command (ip, op, conditional, file_change)
}
}
}
}
/* Don't output a line number of 0 if we can help it. */
if
(
ip
->
lineno
==
0
&&
ip
->
bufp
-
ip
->
buf
<
ip
->
length
&&
*
ip
->
bufp
==
'\n'
)
{
ip
->
lineno
++
;
ip
->
bufp
++
;
}
#ifdef OUTPUT_LINE_COMMANDS
#ifdef OUTPUT_LINE_COMMANDS
sprintf
(
line_cmd_buf
,
"#line %d
\"
%s
\"
"
,
ip
->
lineno
,
ip
->
nominal_fname
);
sprintf
(
line_cmd_buf
,
"#line %d
\"
%s
\"
"
,
ip
->
lineno
,
ip
->
nominal_fname
);
#else
#else
...
@@ -8455,7 +8493,7 @@ hack_vms_include_specification (fname)
...
@@ -8455,7 +8493,7 @@ hack_vms_include_specification (fname)
if
(((
cp
-
fname
)
>
1
)
&&
((
cp
[
-
1
]
==
']'
)
||
(
cp
[
-
1
]
==
'>'
)))
{
if
(((
cp
-
fname
)
>
1
)
&&
((
cp
[
-
1
]
==
']'
)
||
(
cp
[
-
1
]
==
'>'
)))
{
if
(
cp
[
-
2
]
!=
'.'
)
{
if
(
cp
[
-
2
]
!=
'.'
)
{
/*
/*
* The VMS part ends in a `]', and the prece
e
ding character is not a `.'.
* The VMS part ends in a `]', and the preceding character is not a `.'.
* We strip the `]', and then splice the two parts of the name in the
* We strip the `]', and then splice the two parts of the name in the
* usual way. Given the default locations for include files in cccp.c,
* usual way. Given the default locations for include files in cccp.c,
* we will only use this code if the user specifies alternate locations
* we will only use this code if the user specifies alternate locations
...
...
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