aboutsummaryrefslogtreecommitdiff
path: root/gcc/cppinit.c
diff options
context:
space:
mode:
authorZack Weinberg <zack@wolery.cumb.org>2000-07-15 19:29:14 +0000
committerZack Weinberg <zack@gcc.gnu.org>2000-07-15 19:29:14 +0000
commit2c0accc920f19896d91fc0afb8cb8825a5147dbe (patch)
tree13e7a6035db05f91cea3851df746122575c0e6a7 /gcc/cppinit.c
parenta8c12308a05ef399cf985d3c9382207a801c310c (diff)
downloadgcc-2c0accc920f19896d91fc0afb8cb8825a5147dbe.zip
gcc-2c0accc920f19896d91fc0afb8cb8825a5147dbe.tar.gz
gcc-2c0accc920f19896d91fc0afb8cb8825a5147dbe.tar.bz2
cpphash.c (save_expansion): Clear PREV_WHITE on tokens immediately following a paste operator.
* cpphash.c (save_expansion): Clear PREV_WHITE on tokens immediately following a paste operator. * cppinit.c (sort_options): New function (only for HOST_EBCDIC). (cpp_reader_init): Call it, if HOST_EBCDIC. (cpp_handle_options): Do not sort option list here. (handle_option): Rename to cpp_handle_option and export. * cpplex.c (cpp_scan_buffer_nooutput, cpp_scan_buffer): Use _cpp_get_token directly. (cpp_scan_line): Return 0 at EOF, 1 otherwise. * cpplib.c (cpp_push_buffer): Don't set new->lineno to 1. * cpplib.h: Prototype cpp_handle_option. Update prototype of cpp_scan_line. From-SVN: r35052
Diffstat (limited to 'gcc/cppinit.c')
-rw-r--r--gcc/cppinit.c41
1 files changed, 25 insertions, 16 deletions
diff --git a/gcc/cppinit.c b/gcc/cppinit.c
index 476d396..c31b2fd 100644
--- a/gcc/cppinit.c
+++ b/gcc/cppinit.c
@@ -106,14 +106,14 @@ static void merge_include_chains PARAMS ((cpp_reader *));
static void initialize_dependency_output PARAMS ((cpp_reader *));
static void initialize_standard_includes PARAMS ((cpp_reader *));
-static void new_pending_directive PARAMS ((struct cpp_pending *,
+static void new_pending_directive PARAMS ((struct cpp_pending *,
const char *,
cl_directive_handler));
#ifdef HOST_EBCDIC
static int opt_comp PARAMS ((const void *, const void *));
+static void sort_options PARAMS ((void));
#endif
static int parse_option PARAMS ((const char *));
-static int handle_option PARAMS ((cpp_reader *, int, char **));
/* Fourth argument to append_include_chain: chain to use */
enum { QUOTE = 0, BRACKET, SYSTEM, AFTER };
@@ -408,6 +408,10 @@ void
cpp_reader_init (pfile)
cpp_reader *pfile;
{
+#ifdef HOST_EBCDIC
+ sort_options ();
+#endif
+
memset ((char *) pfile, 0, sizeof (cpp_reader));
pfile->token_buffer_size = 200;
@@ -1063,6 +1067,22 @@ static const struct cl_option cl_options[] =
#undef DEF_OPT
#undef COMMAND_LINE_OPTIONS
+#ifdef HOST_EBCDIC
+static void
+sort_options (void)
+{
+ static int opts_sorted = 0;
+
+ if (!opts_sorted)
+ {
+ opts_sorted = 1;
+ /* For non-ASCII hosts, the array needs to be sorted at runtime */
+ qsort (cl_options, N_OPTS, sizeof (struct cl_option), opt_comp);
+ }
+}
+#endif
+
+
/* Perform a binary search to find which, if any, option the given
command-line matches. Returns its index in the option array,
negative on failure. Complications arise since some options can be
@@ -1131,8 +1151,8 @@ parse_option (input)
Can be called multiple times, to handle multiple sets of options.
Returns number of strings consumed. */
-static int
-handle_option (pfile, argc, argv)
+int
+cpp_handle_option (pfile, argc, argv)
cpp_reader *pfile;
int argc;
char **argv;
@@ -1637,20 +1657,9 @@ cpp_handle_options (pfile, argc, argv)
int i;
int strings_processed;
-#ifdef HOST_EBCDIC
- static int opts_sorted = 0;
-
- if (!opts_sorted)
- {
- opts_sorted = 1;
- /* For non-ASCII hosts, the array needs to be sorted at runtime */
- qsort (cl_options, N_OPTS, sizeof (struct cl_option), opt_comp);
- }
-#endif
-
for (i = 0; i < argc; i += strings_processed)
{
- strings_processed = handle_option (pfile, argc - i, argv + i);
+ strings_processed = cpp_handle_option (pfile, argc - i, argv + i);
if (strings_processed == 0)
break;
}