+2002-05-16 Neil Booth <neil@daikokuya.demon.co.uk>
+
+ * c-common.c (cb_register_builtins): Handle more built-ins
+ here rather than in gcc.c specs.
+ * gcc.c (cpp_unique_options): Move many built-ins to c-common.c.
+ (cpp_options): Pass -O flags even when only preprocessing.
+ * toplev.c (set_fast_math_flags): New prototype.
+ (fast_math_flags_set_p): New.
+ (set_no_fast_math_flags): Remove.
+ (decode_f_option): Update.
+ * toplev.h (set_fast_math_flags): Update.
+ (fast_math_flags_set_p): New.
+ (set_no_fast_math_flags): Remove.
+config:
+ * c4x/c4x.c (c4x_override_options): Update.
+
2002-05-16 Zack Weinberg <zack@codesourcery.com>
* c-common.c (STDC_0_IN_SYSTEM_HEADERS, REGISTER_PREFIX):
/* Misc. */
builtin_define_with_value ("__VERSION__", version_string, 1);
+ /* Other target-independent built-ins determined by command-line
+ options. */
+ if (optimize_size)
+ cpp_define (pfile, "__OPTIMIZE_SIZE__");
+ if (optimize)
+ cpp_define (pfile, "__OPTIMIZE__");
+
+ if (flag_hosted)
+ cpp_define (pfile, "__STDC_HOSTED__=1");
+ else
+ cpp_define (pfile, "__STDC_HOSTED__=0");
+
+ if (fast_math_flags_set_p ())
+ cpp_define (pfile, "__FAST_MATH__");
+ if (flag_no_inline)
+ cpp_define (pfile, "__NO_INLINE__");
+
/* A straightforward target hook doesn't work, because of problems
linking that hook's body when part of non-C front ends. */
TARGET_CPU_CPP_BUILTINS ();
target_flags &= ~C3X_FLAG;
/* Convert foo / 8.0 into foo * 0.125, etc. */
- set_fast_math_flags();
+ set_fast_math_flags (1);
/* We should phase out the following at some stage.
This provides compatibility with the old -mno-aliases option. */
%{!E:%{!M:%{!MM:%{MD|MMD:%{o*:-MQ %*}}}}}\
%{!no-gcc:-D__GNUC__=%v1 -D__GNUC_MINOR__=%v2 -D__GNUC_PATCHLEVEL__=%v3}\
%{!undef:%{!ansi:%{!std=*:%p}%{std=gnu*:%p}} %P} %{trigraphs}\
- %{Os:-D__OPTIMIZE_SIZE__} %{O*:%{!O0:-D__OPTIMIZE__}}\
- %{fno-inline|O0|!O*:-D__NO_INLINE__} %{ffast-math:-D__FAST_MATH__}\
- %{ffreestanding:-D__STDC_HOSTED__=0} %{fno-hosted:-D__STDC_HOSTED__=0}\
- %{!ffreestanding:%{!fno-hosted:-D__STDC_HOSTED__=1}} %{remap}\
- %{g3:-dD} %{H} %C %{D*&U*&A*} %{i*} %Z %i\
+ %{remap} %{g3:-dD} %{H} %C %{D*&U*&A*} %{i*} %Z %i\
%{E|M|MM:%W{o*}}";
/* This contains cpp options which are common with cc1_options and are passed
only when preprocessing only to avoid duplication. */
static const char *cpp_options =
"%(cpp_unique_options) %{std*} %{d*} %{W*&pedantic*} %{w} %{m*} %{f*}\
- %{undef}";
+ %{O*} %{undef}";
/* NB: This is shared amongst all front-ends. */
static const char *cc1_options =
-ffast-math and -fno-fast-math imply. */
void
-set_fast_math_flags ()
+set_fast_math_flags (int set)
{
- flag_trapping_math = 0;
- flag_unsafe_math_optimizations = 1;
- flag_errno_math = 0;
+ flag_trapping_math = !set;
+ flag_unsafe_math_optimizations = set;
+ flag_errno_math = !set;
}
-void
-set_no_fast_math_flags ()
+/* Return true iff flags are set as if -ffast-math. */
+bool
+fast_math_flags_set_p ()
{
- flag_trapping_math = 1;
- flag_unsafe_math_optimizations = 0;
- flag_errno_math = 1;
+ return (!flag_trapping_math
+ && flag_unsafe_math_optimizations
+ && !flag_errno_math);
}
\f
}
if (!strcmp (arg, "fast-math"))
- set_fast_math_flags ();
+ set_fast_math_flags (1);
else if (!strcmp (arg, "no-fast-math"))
- set_no_fast_math_flags ();
+ set_fast_math_flags (0);
else if ((option_value = skip_leading_substring (arg, "inline-limit-"))
|| (option_value = skip_leading_substring (arg, "inline-limit=")))
{
/* The hashtable, so that the C front ends can pass it to cpplib. */
extern struct ht *ident_hash;
-/* These functions can be used by targets to set the flags originally
- implied by -ffast-math and -fno-fast-math. */
+/* This function can be used by targets to set the flags originally
+ implied by -ffast-math and -fno-fast-math. */
+
+extern void set_fast_math_flags PARAMS ((int));
-extern void set_fast_math_flags PARAMS ((void));
-extern void set_no_fast_math_flags PARAMS ((void));
+/* Return true iff flags are set as if -ffast-math. */
+extern bool fast_math_flags_set_p PARAMS ((void));
/* The following functions accept a wide integer argument. Rather
than having to cast on every function call, we use a macro instead. */