Commit 6f5ef761 by Gabriel Dos Reis Committed by Gabriel Dos Reis

toplev.h (skip_leading_substring): New macro.

2000-05-28  Gabriel Dos Reis  <gdr@codesourcery.com>

        * toplev.h (skip_leading_substring): New macro.
        * toplev.c (decode_f_option): Use skip_leading_substring instead
        of strncmp.
        (decode_W_option): Likewise.

cp/

2000-05-28  Gabriel Dos Reis  <gdr@codesourcery.com>

        * decl2.c (lang_decode_option): Use skip_leading_substring instead
        of plain strncmp.

From-SVN: r34240
parent 055177dc
2000-05-28 Gabriel Dos Reis <gdr@codesourcery.com>
* toplev.h (skip_leading_substring): New macro.
* toplev.c (decode_f_option): Use skip_leading_substring instead
of strncmp.
(decode_W_option): Likewise.
2000-05-28 Nick Clifton <nickc@cygnus.com> 2000-05-28 Nick Clifton <nickc@cygnus.com>
* tm.texi (CONDITIONAL_REGISTER_USAGE): Document that it can * tm.texi (CONDITIONAL_REGISTER_USAGE): Document that it can
2000-05-28 Gabriel Dos Reis <gdr@codesourcery.com>
* decl2.c (lang_decode_option): Use skip_leading_substring instead
of plain strncmp.
2000-05-28 Alexandre Oliva <aoliva@cygnus.com> 2000-05-28 Alexandre Oliva <aoliva@cygnus.com>
* operators.def (<?): Duplicated, should have been... * operators.def (<?): Duplicated, should have been...
......
...@@ -590,6 +590,7 @@ lang_decode_option (argc, argv) ...@@ -590,6 +590,7 @@ lang_decode_option (argc, argv)
/* Some kind of -f option. /* Some kind of -f option.
P's value is the option sans `-f'. P's value is the option sans `-f'.
Search for it in the table of options. */ Search for it in the table of options. */
const char *option_value = NULL;
size_t j; size_t j;
p += 2; p += 2;
...@@ -639,31 +640,36 @@ lang_decode_option (argc, argv) ...@@ -639,31 +640,36 @@ lang_decode_option (argc, argv)
flag_new_abi = 0; flag_new_abi = 0;
flag_do_squangling = 0; flag_do_squangling = 0;
} }
else if (!strncmp (p, "template-depth-", 15)) else if ((option_value
= skip_leading_substring (p, "template-depth-")))
max_tinst_depth max_tinst_depth
= read_integral_parameter (p + 15, p - 2, max_tinst_depth); = read_integral_parameter (option_value, p - 2, max_tinst_depth);
else if (!strncmp (p, "name-mangling-version-", 22)) else if ((option_value
= skip_leading_substring (p, "name-mangling-version-")))
name_mangling_version name_mangling_version
= read_integral_parameter (p + 22, p - 2, name_mangling_version); = read_integral_parameter (option_value, p - 2, name_mangling_version);
else if (!strncmp (p, "message-length=", 15)) else if ((option_value
= skip_leading_substring (p, "message-length=")))
set_message_length set_message_length
(read_integral_parameter (p + 15, p - 2, (read_integral_parameter (option_value, p - 2,
/* default line-wrap length */ 72)); /* default line-wrap length */ 72));
else if (!strncmp (p, "diagnostics-show-location=", 26)) else if ((option_value
= skip_leading_substring (p, "diagnostics-show-location=")))
{ {
if (!strncmp (p + 26, "once", 4)) if (!strcmp (option_value, "once"))
set_message_prefixing_rule (DIAGNOSTICS_SHOW_PREFIX_ONCE); set_message_prefixing_rule (DIAGNOSTICS_SHOW_PREFIX_ONCE);
else if (!strncmp (p + 26, "every-line", 10)) else if (!strcmp (option_value, "every-line"))
set_message_prefixing_rule (DIAGNOSTICS_SHOW_PREFIX_EVERY_LINE); set_message_prefixing_rule (DIAGNOSTICS_SHOW_PREFIX_EVERY_LINE);
else else
error ("Unrecognized option `%s'", p - 2); error ("Unrecognized option `%s'", p - 2);
} }
else if (!strncmp (p, "dump-translation-unit-", 22)) else if ((option_value
= skip_leading_substring (p, "dump-translation-unit-")))
{ {
if (p[22] == '\0') if (p[22] == '\0')
error ("no file specified with -fdump-translation-unit"); error ("no file specified with -fdump-translation-unit");
else else
flag_dump_translation_unit = p + 22; flag_dump_translation_unit = option_value;
} }
else else
{ {
......
...@@ -3923,6 +3923,7 @@ decode_f_option (arg) ...@@ -3923,6 +3923,7 @@ decode_f_option (arg)
const char * arg; const char * arg;
{ {
int j; int j;
const char *option_value = NULL;
/* Search for the option in the table of binary f options. */ /* Search for the option in the table of binary f options. */
for (j = sizeof (f_options) / sizeof (f_options[0]); j--;) for (j = sizeof (f_options) / sizeof (f_options[0]); j--;)
...@@ -3941,44 +3942,47 @@ decode_f_option (arg) ...@@ -3941,44 +3942,47 @@ decode_f_option (arg)
} }
} }
if (!strncmp (arg, "inline-limit-", 13) if ((option_value = skip_leading_substring (arg, "inline-limit-"))
|| !strncmp (arg, "inline-limit=", 13)) || (option_value = skip_leading_substring (arg, "inline-limit=")))
inline_max_insns = inline_max_insns =
read_integral_parameter (arg + 13, arg - 2, inline_max_insns); read_integral_parameter (option_value, arg - 2, inline_max_insns);
#ifdef INSN_SCHEDULING #ifdef INSN_SCHEDULING
else if (!strncmp (arg, "sched-verbose=", 14)) else if ((option_value = skip_leading_substring (arg, "sched-verbose=")))
fix_sched_param ("verbose", (const char *)(arg + 14)); fix_sched_param ("verbose", option_value);
#endif #endif
else if (!strncmp (arg, "fixed-", 6)) else if ((option_value = skip_leading_substring (arg, "fixed-")))
fix_register ((const char *)(arg + 6), 1, 1); fix_register (option_value, 1, 1);
else if (!strncmp (arg, "call-used-", 10)) else if ((option_value = skip_leading_substring (arg, "call-used-")))
fix_register ((const char *)(arg + 10), 0, 1); fix_register (option_value, 0, 1);
else if (!strncmp (arg, "call-saved-", 11)) else if ((option_value = skip_leading_substring (arg, "call-saved-")))
fix_register ((const char *)(arg + 11), 0, 0); fix_register (option_value, 0, 0);
else if (!strncmp (arg, "align-loops=", 12)) else if ((option_value = skip_leading_substring (arg, "align-loops=")))
align_loops = read_integral_parameter (arg + 12, arg - 2, align_loops); align_loops = read_integral_parameter (option_value, arg - 2, align_loops);
else if (!strncmp (arg, "align-functions=", 16)) else if ((option_value = skip_leading_substring (arg, "align-functions=")))
align_functions align_functions
= read_integral_parameter (arg + 16, arg - 2, align_functions); = read_integral_parameter (option_value, arg - 2, align_functions);
else if (!strncmp (arg, "align-jumps=", 12)) else if ((option_value = skip_leading_substring (arg, "align-jumps=")))
align_jumps = read_integral_parameter (arg + 12, arg - 2, align_jumps); align_jumps = read_integral_parameter (option_value, arg - 2, align_jumps);
else if (!strncmp (arg, "align-labels=", 13)) else if ((option_value = skip_leading_substring (arg, "align-labels=")))
align_labels = read_integral_parameter (arg + 13, arg - 2, align_labels); align_labels
else if (!strncmp (arg, "stack-limit-register=", 21)) = read_integral_parameter (option_value, arg - 2, align_labels);
else if ((option_value
= skip_leading_substring (arg, "stack-limit-register=")))
{ {
int reg = decode_reg_name (arg + 21); int reg = decode_reg_name (option_value);
if (reg < 0) if (reg < 0)
error ("unrecognized register name `%s'", arg + 21); error ("unrecognized register name `%s'", option_value);
else else
stack_limit_rtx = gen_rtx_REG (Pmode, reg); stack_limit_rtx = gen_rtx_REG (Pmode, reg);
} }
else if (!strncmp (arg, "stack-limit-symbol=", 19)) else if ((option_value
= skip_leading_substring (arg, "stack-limit-symbol=")))
{ {
char *nm; char *nm;
if (ggc_p) if (ggc_p)
nm = ggc_alloc_string (arg + 19, strlen (arg + 19)); nm = ggc_alloc_string (option_value, strlen (option_value));
else else
nm = xstrdup (arg + 19); nm = xstrdup (option_value);
stack_limit_rtx = gen_rtx_SYMBOL_REF (Pmode, nm); stack_limit_rtx = gen_rtx_SYMBOL_REF (Pmode, nm);
} }
else if (!strcmp (arg, "no-stack-limit")) else if (!strcmp (arg, "no-stack-limit"))
...@@ -4001,6 +4005,7 @@ static int ...@@ -4001,6 +4005,7 @@ static int
decode_W_option (arg) decode_W_option (arg)
const char * arg; const char * arg;
{ {
const char *option_value = NULL;
int j; int j;
/* Search for the option in the table of binary W options. */ /* Search for the option in the table of binary W options. */
...@@ -4021,16 +4026,16 @@ decode_W_option (arg) ...@@ -4021,16 +4026,16 @@ decode_W_option (arg)
} }
} }
if (!strncmp (arg, "id-clash-", 9)) if ((option_value = skip_leading_substring (arg, "id-clash-")))
{ {
id_clash_len = read_integral_parameter (arg + 9, arg - 2, -1); id_clash_len = read_integral_parameter (option_value, arg - 2, -1);
if (id_clash_len != -1) if (id_clash_len != -1)
warn_id_clash = 1; warn_id_clash = 1;
} }
else if (!strncmp (arg, "larger-than-", 12)) else if ((option_value = skip_leading_substring (arg, "larger-than-")))
{ {
larger_than_size = read_integral_parameter (arg + 12, arg - 2, -1); larger_than_size = read_integral_parameter (option_value, arg - 2, -1);
if (larger_than_size != -1) if (larger_than_size != -1)
warn_larger_than = 1; warn_larger_than = 1;
......
...@@ -26,6 +26,11 @@ union tree_node; ...@@ -26,6 +26,11 @@ union tree_node;
struct rtx_def; struct rtx_def;
#endif #endif
/* If non-NULL, return one past-the-end of the matching SUBPART of
the WHOLE string. */
#define skip_leading_substring(whole, part) \
(strncmp (whole, part, strlen (part)) ? NULL : whole + strlen (part))
extern int read_integral_parameter PARAMS ((const char *, const char *, extern int read_integral_parameter PARAMS ((const char *, const char *,
const int)); const int));
extern int count_error PARAMS ((int)); extern int count_error PARAMS ((int));
......
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