summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/Makefile.in2
-rw-r--r--gcc/c-opts.c4
-rw-r--r--gcc/common.opt33
-rw-r--r--gcc/f/top.c16
-rw-r--r--gcc/opts.c107
-rw-r--r--gcc/toplev.c96
6 files changed, 143 insertions, 115 deletions
diff --git a/gcc/Makefile.in b/gcc/Makefile.in
index 51255061ac3..ccef73b3956 100644
--- a/gcc/Makefile.in
+++ b/gcc/Makefile.in
@@ -1482,7 +1482,7 @@ diagnostic.o : diagnostic.c diagnostic.h real.h diagnostic.def \
$(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(TM_P_H) flags.h $(GGC_H) \
input.h toplev.h intl.h langhooks.h $(LANGHOOKS_DEF_H)
opts.o : opts.c opts.h options.h toplev.h $(CONFIG_H) $(SYSTEM_H) \
- coretypes.h $(TREE_H) $(TM_H) $(LANGHOOKS_H)
+ coretypes.h $(TREE_H) $(TM_H) $(LANGHOOKS_H) $(GGC_H) $(RTL_H) output.h
toplev.o : toplev.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) $(RTL_H) \
function.h flags.h xcoffout.h input.h $(INSN_ATTR_H) output.h diagnostic.h \
debug.h insn-config.h intl.h $(RECOG_H) Makefile toplev.h \
diff --git a/gcc/c-opts.c b/gcc/c-opts.c
index 4d6ccd2932a..6e8cf6e4be7 100644
--- a/gcc/c-opts.c
+++ b/gcc/c-opts.c
@@ -820,8 +820,8 @@ c_common_handle_option (size_t scode, const char *arg, int value)
case OPT_ffixed_form:
case OPT_ffixed_line_length_:
/* Fortran front end options ignored when preprocessing only. */
- if (flag_preprocess_only)
- result = -1;
+ if (!flag_preprocess_only)
+ result = 0;
break;
case OPT_ffor_scope:
diff --git a/gcc/common.opt b/gcc/common.opt
index 7ce20bb8ee5..d475cad1c0a 100644
--- a/gcc/common.opt
+++ b/gcc/common.opt
@@ -139,6 +139,39 @@ Common Joined
dumpbase
Common Separate
+falign-functions=
+Common RejectNegative Joined UInteger
+
+falign-jumps=
+Common RejectNegative Joined UInteger
+
+falign-labels=
+Common RejectNegative Joined UInteger
+
+falign-loops=
+Common RejectNegative Joined UInteger
+
+fcall-saved-
+Common Joined RejectNegative
+
+fcall-used-
+Common Joined RejectNegative
+
+ffast-math
+Common
+
+ffixed-
+Common Joined RejectNegative
+
+fstack-limit-register=
+Common RejectNegative Joined
+
+fstack-limit-symbol=
+Common RejectNegative Joined
+
+ftls-model=
+Common Joined RejectNegative
+
g
Common JoinedOrMissing
diff --git a/gcc/f/top.c b/gcc/f/top.c
index 7ca2db998b8..89d3e96e310 100644
--- a/gcc/f/top.c
+++ b/gcc/f/top.c
@@ -239,8 +239,6 @@ ffe_handle_option (size_t scode, const char *arg, int value)
case OPT_ffixed_form:
ffe_set_is_free_form (!value);
- if (value)
- return -1;
break;
case OPT_fpedantic:
@@ -564,16 +562,12 @@ ffe_handle_option (size_t scode, const char *arg, int value)
case OPT_ffixed_line_length_:
if (strcmp (arg, "none") == 0)
- {
- ffe_set_fixed_line_length (0);
- return -1;
- }
+ ffe_set_fixed_line_length (0);
else if (ffe_is_digit_string_ (arg))
- {
- ffe_set_fixed_line_length (atol (arg));
- return -1;
- }
- return 0;
+ ffe_set_fixed_line_length (atol (arg));
+ else
+ return 0;
+ break;
case OPT_Wcomment:
case OPT_Wcomments:
diff --git a/gcc/opts.c b/gcc/opts.c
index ddd116938ab..c622fd9b678 100644
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -24,6 +24,9 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#include "coretypes.h"
#include "tm.h"
#include "tree.h"
+#include "rtl.h"
+#include "ggc.h"
+#include "output.h"
#include "langhooks.h"
#include "opts.h"
#include "options.h"
@@ -196,8 +199,11 @@ find_opt (const char *input, int lang_mask)
for (md = md + 1; md < cl_options_count; md++)
{
opt_len = cl_options[md].opt_len;
- if (strncmp (input, cl_options[md].opt_text, opt_len))
+ comp = strncmp (input, cl_options[md].opt_text, opt_len);
+ if (comp < 0)
break;
+ if (comp > 0)
+ continue;
if (input[opt_len] == '\0')
return md;
if (cl_options[md].flags & lang_mask
@@ -237,7 +243,7 @@ handle_option (int argc ATTRIBUTE_UNUSED, char **argv, int lang_mask)
const char *opt, *arg = 0;
char *dup = 0;
int value = 1;
- int result = 0, temp;
+ int result = 0;
const struct cl_option *option;
opt = argv[0];
@@ -320,17 +326,12 @@ handle_option (int argc ATTRIBUTE_UNUSED, char **argv, int lang_mask)
}
if (option->flags & lang_mask)
- {
- temp = (*lang_hooks.handle_option) (opt_index, arg, value);
- if (temp <= 0)
- result = temp;
- }
+ if ((*lang_hooks.handle_option) (opt_index, arg, value) == 0)
+ result = 0;
- if (result > 0 && (option->flags & CL_COMMON))
- {
- if (common_handle_option (opt_index, arg, value) == 0)
- result = 0;
- }
+ if (result && (option->flags & CL_COMMON))
+ if (common_handle_option (opt_index, arg, value) == 0)
+ result = 0;
}
done:
@@ -520,6 +521,65 @@ common_handle_option (size_t scode, const char *arg,
dump_base_name = arg;
break;
+ case OPT_falign_functions_:
+ align_functions = value;
+ break;
+
+ case OPT_falign_jumps_:
+ align_jumps = value;
+ break;
+
+ case OPT_falign_labels_:
+ align_labels = value;
+ break;
+
+ case OPT_falign_loops_:
+ align_loops = value;
+ break;
+
+ case OPT_fcall_used_:
+ fix_register (arg, 0, 1);
+ break;
+
+ case OPT_fcall_saved_:
+ fix_register (arg, 0, 0);
+ break;
+
+ case OPT_ffast_math:
+ set_fast_math_flags (value);
+ break;
+
+ case OPT_ffixed_:
+ fix_register (arg, 1, 1);
+ break;
+
+ case OPT_fstack_limit_register_:
+ {
+ int reg = decode_reg_name (arg);
+ if (reg < 0)
+ error ("unrecognized register name \"%s\"", arg);
+ else
+ stack_limit_rtx = gen_rtx_REG (Pmode, reg);
+ }
+ break;
+
+ case OPT_fstack_limit_symbol_:
+ stack_limit_rtx = gen_rtx_SYMBOL_REF (Pmode, ggc_strdup (arg));
+ break;
+
+ case OPT_ftls_model_:
+ if (!strcmp (arg, "global-dynamic"))
+ flag_tls_default = TLS_MODEL_GLOBAL_DYNAMIC;
+ else if (!strcmp (arg, "local-dynamic"))
+ flag_tls_default = TLS_MODEL_LOCAL_DYNAMIC;
+ else if (!strcmp (arg, "initial-exec"))
+ flag_tls_default = TLS_MODEL_INITIAL_EXEC;
+ else if (!strcmp (arg, "local-exec"))
+ flag_tls_default = TLS_MODEL_LOCAL_EXEC;
+ else
+ warning ("unknown tls-model \"%s\"", arg);
+ break;
+
case OPT_g:
decode_g_option (arg);
break;
@@ -619,3 +679,26 @@ set_Wunused (int setting)
warn_unused_variable = setting;
warn_unused_value = setting;
}
+
+/* The following routines are useful in setting all the flags that
+ -ffast-math and -fno-fast-math imply. */
+void
+set_fast_math_flags (int set)
+{
+ flag_trapping_math = !set;
+ flag_unsafe_math_optimizations = set;
+ flag_finite_math_only = set;
+ flag_errno_math = !set;
+ if (set)
+ flag_signaling_nans = 0;
+}
+
+/* Return true iff flags are set as if -ffast-math. */
+bool
+fast_math_flags_set_p (void)
+{
+ return (!flag_trapping_math
+ && flag_unsafe_math_optimizations
+ && flag_finite_math_only
+ && !flag_errno_math);
+}
diff --git a/gcc/toplev.c b/gcc/toplev.c
index 4bee42e153a..47845bd7ab1 100644
--- a/gcc/toplev.c
+++ b/gcc/toplev.c
@@ -1548,30 +1548,6 @@ static const lang_independent_options W_options[] =
N_ ("Warn about code which might break the strict aliasing rules") }
};
-/* The following routines are useful in setting all the flags that
- -ffast-math and -fno-fast-math imply. */
-
-void
-set_fast_math_flags (int set)
-{
- flag_trapping_math = !set;
- flag_unsafe_math_optimizations = set;
- flag_finite_math_only = set;
- flag_errno_math = !set;
- if (set)
- flag_signaling_nans = 0;
-}
-
-/* Return true iff flags are set as if -ffast-math. */
-bool
-fast_math_flags_set_p (void)
-{
- return (!flag_trapping_math
- && flag_unsafe_math_optimizations
- && flag_finite_math_only
- && !flag_errno_math);
-}
-
/* Output files for assembler code (real compiler output)
and debugging dumps. */
@@ -4197,11 +4173,7 @@ decode_f_option (const char *arg)
}
}
- if (!strcmp (arg, "fast-math"))
- set_fast_math_flags (1);
- else if (!strcmp (arg, "no-fast-math"))
- set_fast_math_flags (0);
- else if ((option_value = skip_leading_substring (arg, "inline-limit-"))
+ if ((option_value = skip_leading_substring (arg, "inline-limit-"))
|| (option_value = skip_leading_substring (arg, "inline-limit=")))
{
int val =
@@ -4219,55 +4191,10 @@ decode_f_option (const char *arg)
set_param_value ("min-inline-insns", 10);
}
}
- else if ((option_value = skip_leading_substring (arg, "tls-model=")))
- {
- if (strcmp (option_value, "global-dynamic") == 0)
- flag_tls_default = TLS_MODEL_GLOBAL_DYNAMIC;
- else if (strcmp (option_value, "local-dynamic") == 0)
- flag_tls_default = TLS_MODEL_LOCAL_DYNAMIC;
- else if (strcmp (option_value, "initial-exec") == 0)
- flag_tls_default = TLS_MODEL_INITIAL_EXEC;
- else if (strcmp (option_value, "local-exec") == 0)
- flag_tls_default = TLS_MODEL_LOCAL_EXEC;
- else
- warning ("`%s': unknown tls-model option", arg - 2);
- }
#ifdef INSN_SCHEDULING
else if ((option_value = skip_leading_substring (arg, "sched-verbose=")))
fix_sched_param ("verbose", option_value);
#endif
- else if ((option_value = skip_leading_substring (arg, "fixed-")))
- fix_register (option_value, 1, 1);
- else if ((option_value = skip_leading_substring (arg, "call-used-")))
- fix_register (option_value, 0, 1);
- else if ((option_value = skip_leading_substring (arg, "call-saved-")))
- fix_register (option_value, 0, 0);
- else if ((option_value = skip_leading_substring (arg, "align-loops=")))
- align_loops = read_integral_parameter (option_value, arg - 2, align_loops);
- else if ((option_value = skip_leading_substring (arg, "align-functions=")))
- align_functions
- = read_integral_parameter (option_value, arg - 2, align_functions);
- else if ((option_value = skip_leading_substring (arg, "align-jumps=")))
- align_jumps = read_integral_parameter (option_value, arg - 2, align_jumps);
- else if ((option_value = skip_leading_substring (arg, "align-labels=")))
- align_labels
- = 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 (option_value);
- if (reg < 0)
- error ("unrecognized register name `%s'", option_value);
- else
- stack_limit_rtx = gen_rtx_REG (Pmode, reg);
- }
- else if ((option_value
- = skip_leading_substring (arg, "stack-limit-symbol=")))
- {
- const char *nm;
- nm = ggc_strdup (option_value);
- stack_limit_rtx = gen_rtx_SYMBOL_REF (Pmode, nm);
- }
else if ((option_value
= skip_leading_substring (arg, "message-length=")))
output_set_maximum_length
@@ -4896,25 +4823,16 @@ parse_options_and_default_flags (int argc, char **argv)
/* Perform normal command line switch decoding. */
for (i = 1; i < argc;)
{
- int lang_processed;
- int indep_processed;
+ int processed;
/* Give the language a chance to decode the option for itself. */
- lang_processed = handle_option (argc - i, argv + i, lang_mask);
+ processed = handle_option (argc - i, argv + i, lang_mask);
- if (lang_processed >= 0)
- /* Now see if the option also has a language independent meaning.
- Some options are both language specific and language independent,
- eg --help. */
- indep_processed = independent_decode_option (argv + i);
- else
- {
- lang_processed = -lang_processed;
- indep_processed = 0;
- }
+ if (!processed)
+ processed = independent_decode_option (argv + i);
- if (lang_processed || indep_processed)
- i += MAX (lang_processed, indep_processed);
+ if (processed)
+ i += processed;
else
{
const char *option = NULL;