summaryrefslogtreecommitdiff
path: root/gcc/opts.c
diff options
context:
space:
mode:
authorhjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4>2006-05-16 14:27:18 +0000
committerhjl <hjl@138bc75d-0d04-0410-961f-82ee72b054a4>2006-05-16 14:27:18 +0000
commita1baa5f1549a32cb8d6a639977b8cb6d0b90afae (patch)
treef010ca26f2ca6b7e3f6a1baeeac28d996a541357 /gcc/opts.c
parent3480139d95efcff73b729e0007797dddbd462b4f (diff)
downloadgcc-a1baa5f1549a32cb8d6a639977b8cb6d0b90afae.tar.gz
gcc/
2006-05-16 H.J. Lu <hongjiu.lu@intel.com> PR driver/26885 * Makefile.in (GCC_OBJS): New. (OBJS-common): Add opts-common.o. (xgcc$(exeext)): Replace gcc.o with $(GCC_OBJS). (cpp$(exeext)): Likewise. (gcc.o): Also depend on opts.h. (opts-common.o): New. * common.opt (gcoff): Add Negative(gdwarf-2). (gdwarf-2): Add Negative(gstabs). (gstabs): Add Negative(gstabs+). (gstabs+): Add Negative(gvms). (gvms): Add Negative(gxcoff). (gxcoff): Add Negative(gxcoff+). (gxcoff+): Add Negative(gcoff). * config/i386/i386.opt (m32): Add Negative(m64). (m64): Add Negative(m32). * doc/options.texi: Document the Negative option. * gcc.c: Include "opts.h". (main): Call prune_options after expandargv. * optc-gen.awk: Generate common declarations for all flag variables in options.c. Output the neg_index field. * opts.c (find_opt): Moved to ... * opts-common.c: Here. New file. * opts.h (cl_option): Add a neg_index field. (find_opt): New. (prune_options): Likewise. gcc/cp/ 2006-05-16 H.J. Lu <hongjiu.lu@intel.com> PR driver/26885 * Make-lang.in (GXX_OBJS): Replace gcc.o with $(GCC_OBJS). gcc/fortran/ 2006-05-16 H.J. Lu <hongjiu.lu@intel.com> PR driver/26885 * Make-lang.in (GFORTRAN_D_OBJS): Replace gcc.o with $(GCC_OBJS). gcc/java/ 2006-05-16 H.J. Lu <hongjiu.lu@intel.com> PR driver/26885 * Make-lang.in ($(GCJ)$(exeext)): Replace gcc.o with $(GCC_OBJS). gcc/treelang/ 2006-05-16 H.J. Lu <hongjiu.lu@intel.com> PR driver/26885 * Make-lang.in (gtreelang$(exeext)): Replace gcc.o with $(GCC_OBJS). git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@113824 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/opts.c')
-rw-r--r--gcc/opts.c85
1 files changed, 0 insertions, 85 deletions
diff --git a/gcc/opts.c b/gcc/opts.c
index 00b9716a607..01ec30d6ceb 100644
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -105,7 +105,6 @@ static bool flag_peel_loops_set, flag_branch_probabilities_set;
const char **in_fnames;
unsigned num_in_fnames;
-static size_t find_opt (const char *, int);
static int common_handle_option (size_t scode, const char *arg, int value,
unsigned int lang_mask);
static void handle_param (const char *);
@@ -124,90 +123,6 @@ static unsigned int print_switch (const char *text, unsigned int indent);
static void set_debug_level (enum debug_info_type type, int extended,
const char *arg);
-/* Perform a binary search to find which option the command-line INPUT
- matches. Returns its index in the option array, and N_OPTS
- (cl_options_count) on failure.
-
- This routine is quite subtle. A normal binary search is not good
- enough because some options can be suffixed with an argument, and
- multiple sub-matches can occur, e.g. input of "-pedantic" matching
- the initial substring of "-pedantic-errors".
-
- A more complicated example is -gstabs. It should match "-g" with
- an argument of "stabs". Suppose, however, that the number and list
- of switches are such that the binary search tests "-gen-decls"
- before having tested "-g". This doesn't match, and as "-gen-decls"
- is less than "-gstabs", it will become the lower bound of the
- binary search range, and "-g" will never be seen. To resolve this
- issue, opts.sh makes "-gen-decls" point, via the back_chain member,
- to "-g" so that failed searches that end between "-gen-decls" and
- the lexicographically subsequent switch know to go back and see if
- "-g" causes a match (which it does in this example).
-
- This search is done in such a way that the longest match for the
- front end in question wins. If there is no match for the current
- front end, the longest match for a different front end is returned
- (or N_OPTS if none) and the caller emits an error message. */
-static size_t
-find_opt (const char *input, int lang_mask)
-{
- size_t mn, mx, md, opt_len;
- size_t match_wrong_lang;
- int comp;
-
- mn = 0;
- mx = cl_options_count;
-
- /* Find mn such this lexicographical inequality holds:
- cl_options[mn] <= input < cl_options[mn + 1]. */
- while (mx - mn > 1)
- {
- md = (mn + mx) / 2;
- opt_len = cl_options[md].opt_len;
- comp = strncmp (input, cl_options[md].opt_text + 1, opt_len);
-
- if (comp < 0)
- mx = md;
- else
- mn = md;
- }
-
- /* This is the switch that is the best match but for a different
- front end, or cl_options_count if there is no match at all. */
- match_wrong_lang = cl_options_count;
-
- /* Backtrace the chain of possible matches, returning the longest
- one, if any, that fits best. With current GCC switches, this
- loop executes at most twice. */
- do
- {
- const struct cl_option *opt = &cl_options[mn];
-
- /* Is the input either an exact match or a prefix that takes a
- joined argument? */
- if (!strncmp (input, opt->opt_text + 1, opt->opt_len)
- && (input[opt->opt_len] == '\0' || (opt->flags & CL_JOINED)))
- {
- /* If language is OK, return it. */
- if (opt->flags & lang_mask)
- return mn;
-
- /* If we haven't remembered a prior match, remember this
- one. Any prior match is necessarily better. */
- if (match_wrong_lang == cl_options_count)
- match_wrong_lang = mn;
- }
-
- /* Try the next possibility. This is cl_options_count if there
- are no more. */
- mn = opt->back_chain;
- }
- while (mn != cl_options_count);
-
- /* Return the best wrong match, or cl_options_count if none. */
- return match_wrong_lang;
-}
-
/* If ARG is a non-negative integer made up solely of digits, return its
value, otherwise return -1. */
static int