Commit ebc27362 by Per Bothner

fix-header.c (main): Fix loop over required_functions_list

* fix-header.c (main):  Fix loop over required_functions_list
(fatal):  Also print inc_filename.

From-SVN: r9364
parent df87c8b7
...@@ -936,7 +936,7 @@ main (argc, argv) ...@@ -936,7 +936,7 @@ main (argc, argv)
struct stat sbuf; struct stat sbuf;
int c; int c;
int i, done; int i, done;
const char *cptr0, *cptr, **pptr; const char *cptr, **pptr;
int ifndef_line; int ifndef_line;
int endif_line; int endif_line;
long to_read; long to_read;
...@@ -996,25 +996,16 @@ main (argc, argv) ...@@ -996,25 +996,16 @@ main (argc, argv)
required_functions_list = include_entry->required; required_functions_list = include_entry->required;
/* Count and mark the prototypes required for this include file. */ /* Count and mark the prototypes required for this include file. */
for (cptr = required_functions_list, cptr0 = cptr, done = 0; for (cptr = required_functions_list; *cptr!= '\0'; )
!done; cptr++)
{
if (*cptr == '\0')
{
if (cptr[1] == 0)
break;
else
{ {
struct fn_decl *fn = lookup_std_proto (cptr0, strlen (cptr0)); int name_len = strlen (cptr);
struct fn_decl *fn = lookup_std_proto (cptr, name_len);
required_unseen_count++; required_unseen_count++;
if (fn == NULL) if (fn == NULL)
fprintf (stderr, "Internal error: No prototype for %s\n", fprintf (stderr, "Internal error: No prototype for %s\n", cptr);
cptr0);
else else
SET_REQUIRED (fn); SET_REQUIRED (fn);
} cptr += name_len + 1;
cptr0 = cptr + 1;
}
} }
read_scan_file (argv[2], argc - 4, argv + 4); read_scan_file (argv[2], argc - 4, argv + 4);
...@@ -1197,7 +1188,7 @@ void ...@@ -1197,7 +1188,7 @@ void
fatal (str, arg) fatal (str, arg)
char *str, *arg; char *str, *arg;
{ {
fprintf (stderr, "%s: ", progname); fprintf (stderr, "%s: %s: ", progname, inc_filename);
fprintf (stderr, str, arg); fprintf (stderr, str, arg);
fprintf (stderr, "\n"); fprintf (stderr, "\n");
exit (FAILURE_EXIT_CODE); exit (FAILURE_EXIT_CODE);
......
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