From: Richard Stallman Date: Tue, 26 Oct 1993 02:56:57 +0000 (+0000) Subject: (scan_decls): When reading parameter list, X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e174accc45d14735a11d8c7abd37c674b2f4f431;p=gcc.git (scan_decls): When reading parameter list, handle whitespace differently, and keep track of line number. From-SVN: r5890 --- diff --git a/gcc/scan-decls.c b/gcc/scan-decls.c index 860e68d48a4..a27c1a5dd6f 100644 --- a/gcc/scan-decls.c +++ b/gcc/scan-decls.c @@ -32,13 +32,13 @@ int brace_nesting = 0; /* The first extern_C_braces_length elements of extern_C_braces indicate the (brace nesting levels of) left braces that were - prefixed by extern "C". */ + prefixed by extern "C". */ int extern_C_braces_length = 0; char extern_C_braces[20]; #define in_extern_C_brace (extern_C_braces_length>0) /* True if the function declaration currently being scanned is - prefixed by extern "C". */ + prefixed by extern "C". */ int current_extern_C = 0; static void @@ -77,7 +77,7 @@ scan_decls (fp) saw_inline = 0; if (c == '}') { - /* pop an 'extern "C"' nesting level, if appropriate */ + /* Pop an 'extern "C"' nesting level, if appropriate. */ if (extern_C_braces_length && extern_C_braces[extern_C_braces_length - 1] == brace_nesting) extern_C_braces_length--; @@ -100,11 +100,11 @@ scan_decls (fp) && strncmp (buf.base, "__DEFINED_MACRO_", 16) == 0) { /* For certain interesting macro names, fixproto puts - #ifdef FOO - __DEFINED_MACRO_FOO - #endif + #ifdef FOO + __DEFINED_MACRO_FOO + #endif into the file to be pre-processed. So if we see __DEFINED_MACRO_FOO, - it means FOO was defined, which we may want to make a note of. */ + it means FOO was defined, which we may want to make a note of. */ recognized_macro (buf.base+16); goto new_statement; } @@ -134,7 +134,7 @@ scan_decls (fp) { int followingc = getc (fp); /* char following token in buf */ - MAKE_SSTRING_SPACE(&rtype, 1); + MAKE_SSTRING_SPACE (&rtype, 1); *rtype.ptr = 0; if (c == IDENTIFIER_TOKEN) @@ -143,11 +143,13 @@ scan_decls (fp) if (nextc == '(') { int nesting = 1; + int func_lineno = source_lineno; + char *args; arg_list.ptr = arg_list.base; - c = skip_spaces (fp, ' '); for (;;) { + c = getc (fp); if (c == '(') nesting++; else if (c == ')') @@ -156,17 +158,23 @@ scan_decls (fp) if (c == EOF) break; if (c == '\n') - c = ' '; - SSTRING_PUT(&arg_list, c); - c = getc (fp); + { + c = ' '; + source_lineno++; + 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, - saw_inline ? 'I' - : in_extern_C_brace || current_extern_C - ? 'F' : 'f', - rtype.base, arg_list.base, - source_filename.base, source_lineno); + (saw_inline ? 'I' + : in_extern_C_brace || current_extern_C + ? 'F' : 'f'), + rtype.base, args, + source_filename.base, func_lineno); c = get_token (fp, &buf); if (c == '{') { @@ -190,7 +198,7 @@ scan_decls (fp) goto handle_statement; sstring_append (&rtype, &buf); if (followingc == ' ' || followingc == '\t' || followingc == '\n') - SSTRING_PUT(&rtype, ' '); + SSTRING_PUT (&rtype, ' '); c = get_token (fp, &buf); } }