Commit e174accc by Richard Stallman

(scan_decls): When reading parameter list,

handle whitespace differently, and keep track of line number.

From-SVN: r5890
parent 13ac10d7
...@@ -77,7 +77,7 @@ scan_decls (fp) ...@@ -77,7 +77,7 @@ scan_decls (fp)
saw_inline = 0; saw_inline = 0;
if (c == '}') if (c == '}')
{ {
/* pop an 'extern "C"' nesting level, if appropriate */ /* Pop an 'extern "C"' nesting level, if appropriate. */
if (extern_C_braces_length if (extern_C_braces_length
&& extern_C_braces[extern_C_braces_length - 1] == brace_nesting) && extern_C_braces[extern_C_braces_length - 1] == brace_nesting)
extern_C_braces_length--; extern_C_braces_length--;
...@@ -134,7 +134,7 @@ scan_decls (fp) ...@@ -134,7 +134,7 @@ scan_decls (fp)
{ {
int followingc = getc (fp); /* char following token in buf */ int followingc = getc (fp); /* char following token in buf */
MAKE_SSTRING_SPACE(&rtype, 1); MAKE_SSTRING_SPACE (&rtype, 1);
*rtype.ptr = 0; *rtype.ptr = 0;
if (c == IDENTIFIER_TOKEN) if (c == IDENTIFIER_TOKEN)
...@@ -143,11 +143,13 @@ scan_decls (fp) ...@@ -143,11 +143,13 @@ scan_decls (fp)
if (nextc == '(') if (nextc == '(')
{ {
int nesting = 1; int nesting = 1;
int func_lineno = source_lineno;
char *args;
arg_list.ptr = arg_list.base; arg_list.ptr = arg_list.base;
c = skip_spaces (fp, ' ');
for (;;) for (;;)
{ {
c = getc (fp);
if (c == '(') if (c == '(')
nesting++; nesting++;
else if (c == ')') else if (c == ')')
...@@ -156,17 +158,23 @@ scan_decls (fp) ...@@ -156,17 +158,23 @@ scan_decls (fp)
if (c == EOF) if (c == EOF)
break; break;
if (c == '\n') if (c == '\n')
{
c = ' '; c = ' ';
SSTRING_PUT(&arg_list, c); source_lineno++;
c = getc (fp); lineno++;
}
SSTRING_PUT (&arg_list, c);
} }
SSTRING_PUT(&arg_list, '\0'); SSTRING_PUT (&arg_list, '\0');
args = arg_list.base;
while (*args == ' ')
args++;
recognized_function (buf.base, recognized_function (buf.base,
saw_inline ? 'I' (saw_inline ? 'I'
: in_extern_C_brace || current_extern_C : in_extern_C_brace || current_extern_C
? 'F' : 'f', ? 'F' : 'f'),
rtype.base, arg_list.base, rtype.base, args,
source_filename.base, source_lineno); source_filename.base, func_lineno);
c = get_token (fp, &buf); c = get_token (fp, &buf);
if (c == '{') if (c == '{')
{ {
...@@ -190,7 +198,7 @@ scan_decls (fp) ...@@ -190,7 +198,7 @@ scan_decls (fp)
goto handle_statement; goto handle_statement;
sstring_append (&rtype, &buf); sstring_append (&rtype, &buf);
if (followingc == ' ' || followingc == '\t' || followingc == '\n') if (followingc == ' ' || followingc == '\t' || followingc == '\n')
SSTRING_PUT(&rtype, ' '); SSTRING_PUT (&rtype, ' ');
c = get_token (fp, &buf); c = get_token (fp, &buf);
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment