OSDN Git Service

2009-06-20 Tobias Burnus <burnus@net-b.de>
[pf3gnuchains/gcc-fork.git] / gcc / fortran / gfortranspec.c
index ca5da29..a6f9b42 100644 (file)
@@ -1,5 +1,6 @@
 /* Specific flags and argument handling of the Fortran front-end.
-   Copyright (C) 1997, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
+   Copyright (C) 1997, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+   2007, 2008, 2009
    Free Software Foundation, Inc.
 
 This file is part of GCC.
@@ -57,10 +58,6 @@ along with GCC; see the file COPYING3.  If not see
 #define MATH_LIBRARY "-lm"
 #endif
 
-#ifndef FORTRAN_INIT
-#define FORTRAN_INIT "-lgfortranbegin"
-#endif
-
 #ifndef FORTRAN_LIBRARY
 #define FORTRAN_LIBRARY "-lgfortran"
 #endif
@@ -174,6 +171,8 @@ lookup_option (Option *xopt, int *xskip, const char **xarg, const char *text)
     opt = OPTION_v, skip = 0;
   else if (text[1] == 'x')
     opt = OPTION_x, arg = text + 2;
+  else if (text[1] == 'J')
+    ;
   else
     {
       if ((skip = WORD_SWITCH_TAKES_ARG (text + 1)) != 0)  /* See gcc.c.  */
@@ -275,10 +274,6 @@ lang_specific_driver (int *in_argc, const char *const **in_argv,
      2 => last two args were -l<library> -lm.  */
   int saw_library = 0;
 
-  /* 0 => initial/reset state
-     1 => FORTRAN_INIT linked in */
-  int use_init = 0;
-
   /* By default, we throw on the math library if we have one.  */
   int need_math = (MATH_LIBRARY[0] != '\0');
 
@@ -302,7 +297,7 @@ lang_specific_driver (int *in_argc, const char *const **in_argv,
   g77_xargc = argc;
   g77_xargv = argv;
   g77_newargc = 0;
-  g77_newargv = (const char **) CONST_CAST (argv);
+  g77_newargv = CONST_CAST2 (const char **, const char *const *, argv);
 
   /* First pass through arglist.
 
@@ -375,8 +370,8 @@ lang_specific_driver (int *in_argc, const char *const **in_argv,
          break;
 
        case OPTION_version:
-         printf ("GNU Fortran (GCC) %s\n", version_string);
-         printf ("Copyright %s 2007 Free Software Foundation, Inc.\n\n",
+         printf ("GNU Fortran %s%s\n", pkgversion_string, version_string);
+         printf ("Copyright %s 2009 Free Software Foundation, Inc.\n\n",
                  _("(C)"));
          printf (_("GNU Fortran comes with NO WARRANTY, to the extent permitted by law.\n\
 You may redistribute copies of GNU Fortran\n\
@@ -426,18 +421,27 @@ For more information about these matters, see the file named COPYING\n\n"));
        {
          char *p;
 
+         fprintf (stderr, _("Warning: Using -M <directory> is deprecated, "
+                  "use -J instead\n"));
          if (argv[i][2] == '\0')
            {
-             p = XNEWVEC (char, strlen (argv[i + 1]) + 2);
-             p[0] = '-';
-             p[1] = 'J';
-             strcpy (&p[2], argv[i + 1]);
-             i++;
+             if (i+1 < argc)
+               {
+                 p = XNEWVEC (char, strlen (argv[i + 1]) + 3);
+                 p[0] = '-';
+                 p[1] = 'J';
+                 strcpy (&p[2], argv[i + 1]);
+                 i++;
+               }
+             else
+               fatal ("argument to '%s' missing", argv[i]);
            }
          else
            {
              p = XNEWVEC (char, strlen (argv[i]) + 1);
-             strcpy (p, argv[i]);
+             p[0] = '-';
+             p[1] = 'J';
+             strcpy (&p[2], argv[i] + 2);
            }
          append_arg (p);
          continue;
@@ -493,12 +497,6 @@ For more information about these matters, see the file named COPYING\n\n"));
                saw_library = 2;        /* -l<library> -lm.  */
              else
                {
-                 if (0 == use_init)
-                   {
-                     append_arg (FORTRAN_INIT);
-                     use_init = 1;
-                   }
-
                  ADD_ARG_LIBGFORTRAN (FORTRAN_LIBRARY);
                }
            }
@@ -528,11 +526,6 @@ For more information about these matters, see the file named COPYING\n\n"));
       switch (saw_library)
        {
        case 0:
-         if (0 == use_init)
-           {
-             append_arg (FORTRAN_INIT);
-             use_init = 1;
-           }
          ADD_ARG_LIBGFORTRAN (library);
          /* Fall through.  */