diff options
author | Daniel Franke <franke.daniel@gmail.com> | 2008-05-25 18:37:41 -0400 |
---|---|---|
committer | Daniel Franke <dfranke@gcc.gnu.org> | 2008-05-25 18:37:41 -0400 |
commit | 670637ee80cf6a86884d3ac1317992e991482a1e (patch) | |
tree | 9d6609dea095d4ea5b2bebb6f1ba50daa94929f5 /gcc/c-cppbuiltin.c | |
parent | 4cea6c02f134f16f8704767f0ce6435a13eec371 (diff) | |
download | gcc-670637ee80cf6a86884d3ac1317992e991482a1e.tar.gz |
re PR fortran/18428 (No preprocessing option -cpp for gfortran)
gcc:
2008-05-26 Daniel Franke <franke.daniel@gmail.com>
PR fortran/18428
* c.opt: Removed undocumented option '-lang-fortran'.
* c-common.h: Removed global variable 'lang_fortran'.
* c-opts.c (c_common_handle_option): Removed code to handle
option '-lang-fortran'. Updated includes.
* c-cppbuiltin.c (c_cpp_builtins): Removed conditional
definition of '__GFORTRAN__'.
(define__GNUC__): Reimplemented to use BASEVER and
cpp_define_formatted.
(builtin_define_with_value_n): Removed.
* c-incpath.h: Renamed to ...
* incpath.h: ... this.
* c-incpath.c: Renamed to ...
* incpath.c: ... this. Updated includes.
* fix-header.c: Updated includes.
* Makefile.in: Replaced c-incpath.[ch] by incpath.[ch].
(c-cppbuiltin.o): Added dependency on and definition of BASEVER.
(OBJ-archive): Added cppdefault.o, incpath.o and prefix.o.
gcc/cp:
2008-05-26 Daniel Franke <franke.daniel@gmail.com>
* Makefile.in: Adjusted dependencies on c-incpath.o.
gcc/fortran:
2008-05-26 Daniel Franke <franke.daniel@gmail.com>
PR fortran/18428
* lang.opt (A, C, CC, D, E, H, P, U, cpp, d, fworking-directory,
imultilib, iprefix, iquote, isysroot, isystem, nocpp, nostdinc,
o, undef, v): New options.
* options.c (gfc_init_options): Also initialize preprocessor
options.
(gfc_post_options): Also handle post-initialization of preprocessor
options.
(gfc_handle_option): Check if option is a preprocessor option.
If yes, let gfc_cpp_handle_option() handle the option.
* lang-specs.h: Reorganized to handle new options.
* scanner.c (gfc_new_file): Read temporary file instead of
input source if preprocessing is enabled.
* f95-lang.c (gfc_init): Initialize preprocessor.
(gfc_finish): Clean up preprocessor.
* cpp.c: New.
* cpp.h: New.
* Make-lang.in: Added new objects and dependencies.
* gfortran.texi: Updated section "Preprocessing and
conditional compilation".
* invoke.texi: Added new section "Preprocessing Options",
listed and documented the preprocessing options handled by gfortran.
From-SVN: r135882
Diffstat (limited to 'gcc/c-cppbuiltin.c')
-rw-r--r-- | gcc/c-cppbuiltin.c | 59 |
1 files changed, 7 insertions, 52 deletions
diff --git a/gcc/c-cppbuiltin.c b/gcc/c-cppbuiltin.c index 86c3f9cfff2..2f2033de537 100644 --- a/gcc/c-cppbuiltin.c +++ b/gcc/c-cppbuiltin.c @@ -48,8 +48,6 @@ along with GCC; see the file COPYING3. If not see /* Non-static as some targets don't use it. */ void builtin_define_std (const char *) ATTRIBUTE_UNUSED; -static void builtin_define_with_value_n (const char *, const char *, - size_t); static void builtin_define_with_int_value (const char *, HOST_WIDE_INT); static void builtin_define_with_hex_fp_value (const char *, tree, int, const char *, @@ -375,40 +373,17 @@ builtin_define_fixed_point_constants (const char *name_prefix, static void define__GNUC__ (void) { - /* The format of the version string, enforced below, is - ([^0-9]*-)?[0-9]+[.][0-9]+([.][0-9]+)?([- ].*)? */ - const char *q, *v = version_string; - - while (*v && !ISDIGIT (*v)) - v++; - gcc_assert (*v && (v <= version_string || v[-1] == '-')); - - q = v; - while (ISDIGIT (*v)) - v++; - builtin_define_with_value_n ("__GNUC__", q, v - q); - if (c_dialect_cxx ()) - builtin_define_with_value_n ("__GNUG__", q, v - q); - - gcc_assert (*v == '.' && ISDIGIT (v[1])); + int major, minor, patchlevel; - q = ++v; - while (ISDIGIT (*v)) - v++; - builtin_define_with_value_n ("__GNUC_MINOR__", q, v - q); - - if (*v == '.') + if (sscanf (BASEVER, "%d.%d.%d", &major, &minor, &patchlevel) != 3) { - gcc_assert (ISDIGIT (v[1])); - q = ++v; - while (ISDIGIT (*v)) - v++; - builtin_define_with_value_n ("__GNUC_PATCHLEVEL__", q, v - q); + sscanf (BASEVER, "%d.%d", &major, &minor); + patchlevel = 0; } - else - builtin_define_with_value_n ("__GNUC_PATCHLEVEL__", "0", 1); + cpp_define_formatted (parse_in, "__GNUC__=%d", major); + cpp_define_formatted (parse_in, "__GNUC_MINOR__=%d", minor); + cpp_define_formatted (parse_in, "__GNUC_PATCHLEVEL__=%d", patchlevel); - gcc_assert (!*v || *v == ' ' || *v == '-'); } /* Define macros used by <stdint.h>. Currently only defines limits @@ -684,9 +659,6 @@ c_cpp_builtins (cpp_reader *pfile) if (flag_openmp) cpp_define (pfile, "_OPENMP=200505"); - if (lang_fortran) - cpp_define (pfile, "__GFORTRAN__=1"); - builtin_define_type_sizeof ("__SIZEOF_INT__", integer_type_node); builtin_define_type_sizeof ("__SIZEOF_LONG__", long_integer_type_node); builtin_define_type_sizeof ("__SIZEOF_LONG_LONG__", @@ -799,23 +771,6 @@ builtin_define_with_value (const char *macro, const char *expansion, int is_str) cpp_define (parse_in, buf); } -/* Pass an object-like macro and a value to define it to. The third - parameter is the length of the expansion. */ -static void -builtin_define_with_value_n (const char *macro, const char *expansion, size_t elen) -{ - char *buf; - size_t mlen = strlen (macro); - - /* Space for an = and a NUL. */ - buf = (char *) alloca (mlen + elen + 2); - memcpy (buf, macro, mlen); - buf[mlen] = '='; - memcpy (buf + mlen + 1, expansion, elen); - buf[mlen + elen + 1] = '\0'; - - cpp_define (parse_in, buf); -} /* Pass an object-like macro and an integer value to define it to. */ static void |