Commit e33f6253 by Neil Booth Committed by Neil Booth

cppinit.c (path_include, [...]): Remove 2nd parameter (struct cpp_pending *).

	* cppinit.c (path_include, append_include_chain):
	Remove 2nd parameter (struct cpp_pending *).
	(path_include, initialize_standard_includes, cpp_handle_option):
	Update callers appropriately.
	(cpp_handle_option): Use pend.

From-SVN: r35764
parent c154ba66
2000-08-17 Neil Booth <NeilB@earthling.net> 2000-08-17 Neil Booth <NeilB@earthling.net>
* cppinit.c (path_include, append_include_chain):
Remove 2nd parameter (struct cpp_pending *).
(path_include, initialize_standard_includes, cpp_handle_option):
Update callers appropriately.
(cpp_handle_option): Use pend.
2000-08-17 Neil Booth <NeilB@earthling.net>
* cppinit.c (sort_options): Remove, put functionality in * cppinit.c (sort_options): Remove, put functionality in
cpp_init. cpp_init.
(cpp_init): New. (cpp_init): New.
......
...@@ -96,11 +96,9 @@ struct cpp_pending ...@@ -96,11 +96,9 @@ struct cpp_pending
static void print_help PARAMS ((void)); static void print_help PARAMS ((void));
static void path_include PARAMS ((cpp_reader *, static void path_include PARAMS ((cpp_reader *,
struct cpp_pending *,
char *, int)); char *, int));
static void initialize_builtins PARAMS ((cpp_reader *)); static void initialize_builtins PARAMS ((cpp_reader *));
static void append_include_chain PARAMS ((cpp_reader *, static void append_include_chain PARAMS ((cpp_reader *,
struct cpp_pending *,
char *, int, int)); char *, int, int));
static void merge_include_chains PARAMS ((cpp_reader *)); static void merge_include_chains PARAMS ((cpp_reader *));
...@@ -173,9 +171,8 @@ END ...@@ -173,9 +171,8 @@ END
add all the names to the search path for include files. */ add all the names to the search path for include files. */
static void static void
path_include (pfile, pend, list, path) path_include (pfile, list, path)
cpp_reader *pfile; cpp_reader *pfile;
struct cpp_pending *pend;
char *list; char *list;
int path; int path;
{ {
...@@ -203,7 +200,7 @@ path_include (pfile, pend, list, path) ...@@ -203,7 +200,7 @@ path_include (pfile, pend, list, path)
name[q - p] = 0; name[q - p] = 0;
} }
append_include_chain (pfile, pend, name, path, 0); append_include_chain (pfile, name, path, 0);
/* Advance past this name. */ /* Advance past this name. */
if (*q == 0) if (*q == 0)
...@@ -216,13 +213,13 @@ path_include (pfile, pend, list, path) ...@@ -216,13 +213,13 @@ path_include (pfile, pend, list, path)
/* Append DIR to include path PATH. DIR must be permanently allocated /* Append DIR to include path PATH. DIR must be permanently allocated
and writable. */ and writable. */
static void static void
append_include_chain (pfile, pend, dir, path, cxx_aware) append_include_chain (pfile, dir, path, cxx_aware)
cpp_reader *pfile; cpp_reader *pfile;
struct cpp_pending *pend;
char *dir; char *dir;
int path; int path;
int cxx_aware; int cxx_aware;
{ {
struct cpp_pending *pend = CPP_OPTION (pfile, pending);
struct file_name_list *new; struct file_name_list *new;
struct stat st; struct stat st;
unsigned int len; unsigned int len;
...@@ -693,7 +690,7 @@ initialize_standard_includes (pfile) ...@@ -693,7 +690,7 @@ initialize_standard_includes (pfile)
GET_ENV_PATH_LIST (path, "CPATH"); GET_ENV_PATH_LIST (path, "CPATH");
if (path != 0 && *path != 0) if (path != 0 && *path != 0)
path_include (pfile, CPP_OPTION (pfile, pending), path, BRACKET); path_include (pfile, path, BRACKET);
switch ((CPP_OPTION (pfile, objc) << 1) + CPP_OPTION (pfile, cplusplus)) switch ((CPP_OPTION (pfile, objc) << 1) + CPP_OPTION (pfile, cplusplus))
{ {
...@@ -711,7 +708,7 @@ initialize_standard_includes (pfile) ...@@ -711,7 +708,7 @@ initialize_standard_includes (pfile)
break; break;
} }
if (path != 0 && *path != 0) if (path != 0 && *path != 0)
path_include (pfile, CPP_OPTION (pfile, pending), path, SYSTEM); path_include (pfile, path, SYSTEM);
/* Search "translated" versions of GNU directories. /* Search "translated" versions of GNU directories.
These have /usr/local/lib/gcc... replaced by specd_prefix. */ These have /usr/local/lib/gcc... replaced by specd_prefix. */
...@@ -745,8 +742,7 @@ initialize_standard_includes (pfile) ...@@ -745,8 +742,7 @@ initialize_standard_includes (pfile)
p->fname + default_len, p->fname + default_len,
flen - default_len + 1); flen - default_len + 1);
append_include_chain (pfile, CPP_OPTION (pfile, pending), append_include_chain (pfile, str, SYSTEM, p->cxx_aware);
str, SYSTEM, p->cxx_aware);
} }
} }
} }
...@@ -762,8 +758,7 @@ initialize_standard_includes (pfile) ...@@ -762,8 +758,7 @@ initialize_standard_includes (pfile)
{ {
/* XXX Potential memory leak! */ /* XXX Potential memory leak! */
char *str = xstrdup (update_path (p->fname, p->component)); char *str = xstrdup (update_path (p->fname, p->component));
append_include_chain (pfile, CPP_OPTION (pfile, pending), append_include_chain (pfile, str, SYSTEM, p->cxx_aware);
str, SYSTEM, p->cxx_aware);
} }
} }
} }
...@@ -1337,12 +1332,10 @@ cpp_handle_option (pfile, argc, argv) ...@@ -1337,12 +1332,10 @@ cpp_handle_option (pfile, argc, argv)
CPP_OPTION (pfile, c99) = 1; CPP_OPTION (pfile, c99) = 1;
CPP_OPTION (pfile, digraphs) = 1; CPP_OPTION (pfile, digraphs) = 1;
CPP_OPTION (pfile, objc) = 0; CPP_OPTION (pfile, objc) = 0;
new_pending_directive (CPP_OPTION (pfile, pending), new_pending_directive (pend, "__STDC_VERSION__=199901L", cpp_define);
"__STDC_VERSION__=199901L", cpp_define);
break; break;
case OPT_std_iso9899_199409: case OPT_std_iso9899_199409:
new_pending_directive (CPP_OPTION (pfile, pending), new_pending_directive (pend, "__STDC_VERSION__=199409L", cpp_define);
"__STDC_VERSION__=199409L", cpp_define);
/* Fall through */ /* Fall through */
case OPT_std_iso9899_1990: case OPT_std_iso9899_1990:
case OPT_std_c89: case OPT_std_c89:
...@@ -1367,10 +1360,8 @@ cpp_handle_option (pfile, argc, argv) ...@@ -1367,10 +1360,8 @@ cpp_handle_option (pfile, argc, argv)
CPP_OPTION (pfile, objc) = 0; CPP_OPTION (pfile, objc) = 0;
CPP_OPTION (pfile, digraphs) = 1; CPP_OPTION (pfile, digraphs) = 1;
CPP_OPTION (pfile, trigraphs) = 1; CPP_OPTION (pfile, trigraphs) = 1;
new_pending_directive (CPP_OPTION (pfile, pending), new_pending_directive (pend, "__STRICT_ANSI__", cpp_define);
"__STRICT_ANSI__", cpp_define); new_pending_directive (pend, "__STDC_VERSION__=199901L", cpp_define);
new_pending_directive (CPP_OPTION (pfile, pending),
"__STDC_VERSION__=199901L", cpp_define);
break; break;
case OPT_o: case OPT_o:
if (CPP_OPTION (pfile, out_fname) != NULL) if (CPP_OPTION (pfile, out_fname) != NULL)
...@@ -1470,26 +1461,24 @@ cpp_handle_option (pfile, argc, argv) ...@@ -1470,26 +1461,24 @@ cpp_handle_option (pfile, argc, argv)
{ {
struct pending_option *o1, *o2; struct pending_option *o1, *o2;
o1 = CPP_OPTION (pfile, pending)->directive_head; o1 = pend->directive_head;
while (o1) while (o1)
{ {
o2 = o1->next; o2 = o1->next;
free (o1); free (o1);
o1 = o2; o1 = o2;
} }
CPP_OPTION (pfile, pending)->directive_head = NULL; pend->directive_head = NULL;
CPP_OPTION (pfile, pending)->directive_tail = NULL; pend->directive_tail = NULL;
} }
else else
new_pending_directive (CPP_OPTION (pfile, pending), new_pending_directive (pend, arg + 1, cpp_unassert);
arg + 1, cpp_unassert);
} }
else else
new_pending_directive (CPP_OPTION (pfile, pending), new_pending_directive (pend, arg, cpp_assert);
arg, cpp_assert);
break; break;
case OPT_U: case OPT_U:
new_pending_directive (CPP_OPTION (pfile, pending), arg, cpp_undef); new_pending_directive (pend, arg, cpp_undef);
break; break;
case OPT_I: /* Add directory to path for includes. */ case OPT_I: /* Add directory to path for includes. */
if (!strcmp (arg, "-")) if (!strcmp (arg, "-"))
...@@ -1502,7 +1491,6 @@ cpp_handle_option (pfile, argc, argv) ...@@ -1502,7 +1491,6 @@ cpp_handle_option (pfile, argc, argv)
the default setup; -I. uses the compiler's working dir.) */ the default setup; -I. uses the compiler's working dir.) */
if (! CPP_OPTION (pfile, ignore_srcdir)) if (! CPP_OPTION (pfile, ignore_srcdir))
{ {
struct cpp_pending *pend = CPP_OPTION (pfile, pending);
pend->quote_head = pend->brack_head; pend->quote_head = pend->brack_head;
pend->quote_tail = pend->brack_tail; pend->quote_tail = pend->brack_tail;
pend->brack_head = 0; pend->brack_head = 0;
...@@ -1516,14 +1504,12 @@ cpp_handle_option (pfile, argc, argv) ...@@ -1516,14 +1504,12 @@ cpp_handle_option (pfile, argc, argv)
} }
} }
else else
append_include_chain (pfile, CPP_OPTION (pfile, pending), append_include_chain (pfile, xstrdup (arg), BRACKET, 0);
xstrdup (arg), BRACKET, 0);
break; break;
case OPT_isystem: case OPT_isystem:
/* Add directory to beginning of system include path, as a system /* Add directory to beginning of system include path, as a system
include directory. */ include directory. */
append_include_chain (pfile, CPP_OPTION (pfile, pending), append_include_chain (pfile, xstrdup (arg), SYSTEM, 0);
xstrdup (arg), SYSTEM, 0);
break; break;
case OPT_include: case OPT_include:
{ {
...@@ -1534,8 +1520,8 @@ cpp_handle_option (pfile, argc, argv) ...@@ -1534,8 +1520,8 @@ cpp_handle_option (pfile, argc, argv)
/* This list has to be built in reverse order so that /* This list has to be built in reverse order so that
when cpp_start_read pushes all the -include files onto when cpp_start_read pushes all the -include files onto
the buffer stack, they will be scanned in forward order. */ the buffer stack, they will be scanned in forward order. */
o->next = CPP_OPTION (pfile, pending)->include_head; o->next = pend->include_head;
CPP_OPTION (pfile, pending)->include_head = o; pend->include_head = o;
} }
break; break;
case OPT_imacros: case OPT_imacros:
...@@ -1545,7 +1531,7 @@ cpp_handle_option (pfile, argc, argv) ...@@ -1545,7 +1531,7 @@ cpp_handle_option (pfile, argc, argv)
o->arg = arg; o->arg = arg;
o->next = NULL; o->next = NULL;
APPEND (CPP_OPTION (pfile, pending), imacros, o); APPEND (pend, imacros, o);
} }
break; break;
case OPT_iwithprefix: case OPT_iwithprefix:
...@@ -1577,14 +1563,13 @@ cpp_handle_option (pfile, argc, argv) ...@@ -1577,14 +1563,13 @@ cpp_handle_option (pfile, argc, argv)
else else
fname = xstrdup (arg); fname = xstrdup (arg);
append_include_chain (pfile, CPP_OPTION (pfile, pending), fname, append_include_chain (pfile, fname,
opt_code == OPT_iwithprefix ? SYSTEM: BRACKET, 0); opt_code == OPT_iwithprefix ? SYSTEM: BRACKET, 0);
} }
break; break;
case OPT_idirafter: case OPT_idirafter:
/* Add directory to end of path for includes. */ /* Add directory to end of path for includes. */
append_include_chain (pfile, CPP_OPTION (pfile, pending), append_include_chain (pfile, xstrdup (arg), AFTER, 0);
xstrdup (arg), AFTER, 0);
break; break;
case OPT_W: case OPT_W:
/* Silently ignore unrecognised options */ /* Silently ignore unrecognised options */
......
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