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
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 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 @@
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 @@
#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 @@
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 @@
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;
}