Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Dec 1998 10:45:31 -0800 (PST)
From:      "Steven G. Kargl" <kargl@troutmask.apl.washington.edu>
To:        FreeBSD-gnats-submit@FreeBSD.ORG
Subject:   gnu/9175: [Patch] eliminate dead code in F77.c
Message-ID:  <199812221845.KAA50253@troutmask.apl.washington.edu>

next in thread | raw e-mail | index | archive | help

>Number:         9175
>Category:       gnu
>Synopsis:       [Patch] eliminate dead code in F77.c
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:
>Keywords:
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Tue Dec 22 10:40:01 PST 1998
>Last-Modified:
>Originator:     Steven G. Kargl
>Organization:
APL/UW
>Release:        FreeBSD 3.0-CURRENT i386
>Environment:

FreeBSD 3.0-CURRENT

>Description:

	

>How-To-Repeat:

The enclosed patch removes dead code from src/gnu/cc/f77/f77.c

>Fix:

--- f77.c.orig	Thu Dec 17 14:20:17 1998
+++ f77.c	Tue Dec 22 10:36:46 1998
@@ -1,4 +1,4 @@
-/* f77 driver dervied from g++.c by Jonas Olsson */
+/* f77 driver derived from g++.c by Jonas Olsson */
 /* converted from gcc-2.6.x(?) derivative to 2.7.2.1 by Peter Wemm */
 
 /* G++ preliminary semantic processing for the compiler driver.
@@ -43,11 +43,7 @@
 #endif
 #include <stdio.h>
 #include <sys/types.h>
-#if !defined(_WIN32)
 #include <sys/file.h>   /* May get R_OK, etc. on some systems.  */
-#else
-#include <process.h>
-#endif
 
 /* Defined to the name of the compiler; if using a cross compiler, the
    Makefile should compile this file with the proper name
@@ -67,19 +63,6 @@
 #define MATH_LIBRARY "-lm"
 #endif
 
-/* On MSDOS, write temp files in current dir
-   because there's no place else we can expect to use.  */
-#ifdef __MSDOS__
-#ifndef P_tmpdir
-#define P_tmpdir "."
-#endif
-#ifndef R_OK
-#define R_OK 4
-#define W_OK 2
-#define X_OK 1
-#endif
-#endif
-
 #ifndef VPROTO
 #ifdef __STDC__
 #define PVPROTO(ARGS)		ARGS
@@ -109,7 +92,7 @@
 
 /* Name with which this program was invoked.  */
 static char *programname;
-
+
 char *
 my_strerror(e)
      int e;
@@ -131,7 +114,7 @@
   return buffer;
 #endif
 }
-
+
 #ifdef HAVE_VPRINTF
 /* Output an error message and exit */
 
@@ -153,10 +136,6 @@
   vfprintf (stderr, format, ap);
   va_end (ap);
   fprintf (stderr, "\n");
-#if 0
-  /* XXX Not needed for g++ driver.  */
-  delete_temp_files ();
-#endif
   exit (1);
 }
 
@@ -197,10 +176,6 @@
      char *msg, *arg1, *arg2;
 {
   error (msg, arg1, arg2);
-#if 0
-  /* XXX Not needed for g++ driver.  */
-  delete_temp_files ();
-#endif
   exit (1);
 }
 
@@ -249,121 +224,6 @@
   fatal (concat ("%s: ", my_strerror (errno), ""), name);
 }
 
-#ifdef __MSDOS__
-/* This is the common prefix we use to make temp file names.  */
-char *temp_filename;
-
-/* Length of the prefix.  */
-int temp_filename_length;
-
-/* Compute a string to use as the base of all temporary file names.  */
-static char *
-choose_temp_base_try (try, base)
-char *try;
-char *base;
-{
-  char *rv;
-  if (base)
-    rv = base;
-  else if (try == (char *)0)
-    rv = 0;
-  else if (access (try, R_OK | W_OK) != 0)
-    rv = 0;
-  else
-    rv = try;
-  return rv;
-}
-
-static void
-choose_temp_base ()
-{
-  char *base = 0;
-  int len;
-
-  base = choose_temp_base_try (getenv ("TMPDIR"), base);
-  base = choose_temp_base_try (getenv ("TMP"), base);
-  base = choose_temp_base_try (getenv ("TEMP"), base);
-
-#ifdef P_tmpdir
-  base = choose_temp_base_try (P_tmpdir, base);
-#endif
-
-  base = choose_temp_base_try ("/usr/tmp", base);
-  base = choose_temp_base_try ("/tmp", base);
-
-  /* If all else fails, use the current directory! */  
-  if (base == (char *)0)
-    base = "./";
-
-  len = strlen (base);
-  temp_filename = xmalloc (len + sizeof("/ccXXXXXX"));
-  strcpy (temp_filename, base);
-  if (len > 0 && temp_filename[len-1] != '/')
-    temp_filename[len++] = '/';
-  strcpy (temp_filename + len, "ccXXXXXX");
-
-  mktemp (temp_filename);
-  temp_filename_length = strlen (temp_filename);
-  if (temp_filename_length == 0)
-    abort ();
-}
-
-static void
-perror_exec (name)
-     char *name;
-{
-  char *s;
-
-  if (errno < sys_nerr)
-    s = concat ("installation problem, cannot exec %s: ",
-		my_strerror( errno ), "");
-  else
-    s = "installation problem, cannot exec %s";
-  error (s, name);
-}
-
-/* This is almost exactly what's in gcc.c:pexecute for MSDOS.  */
-void
-run_dos (program, argv)
-     char *program;
-     char *argv[];
-{
-  char *scmd, *rf;
-  FILE *argfile;
-  int i;
-
-  choose_temp_base (); /* not in gcc.c */
-
-  scmd = (char *) malloc (strlen (program) + strlen (temp_filename) + 10);
-  rf = scmd + strlen (program) + 6;
-  sprintf (scmd, "%s.exe @%s.gp", program, temp_filename);
-
-  argfile = fopen (rf, "w");
-  if (argfile == 0)
-    pfatal_with_name (rf);
-
-  for (i=1; argv[i]; i++)
-    {
-      char *cp;
-      for (cp = argv[i]; *cp; cp++)
-	{
-	  if (*cp == '"' || *cp == '\'' || *cp == '\\' || isspace (*cp))
-	    fputc ('\\', argfile);
-	  fputc (*cp, argfile);
-	}
-      fputc ('\n', argfile);
-    }
-  fclose (argfile);
-
-  i = system (scmd);
-
-  remove (rf);
-  
-  if (i == -1)
-    perror_exec (program);
-}
-#endif /* __MSDOS__ */
-
 int
 main (argc, argv)
      int argc;
@@ -414,7 +274,6 @@
   if (argc == 1)
     fatal ("No input files specified");
 
-#ifndef __MSDOS__
   /* We do a little magic to find out where the main gcc executable
      is.  If they ran us as /usr/local/bin/f77, then we will look
      for /usr/local/bin/gcc; similarly, if they just ran us as `f77',
@@ -426,7 +285,6 @@
 			     * sizeof (char));
       sprintf (gcc, "%s/%s", argv[0], GCC_NAME);
     }
-#endif
 
   args = (int *) malloc (argc * sizeof (int));
   bzero (args, argc * sizeof (int));
@@ -518,21 +376,6 @@
 	      --j;
 	      saw_math = argv[i];
 	    }
-	  /* ljo: We want .i and .c treated as C, so don't do anything */
-#if 0
-	  /* Wrap foo.c and foo.i files in a language specification to
-	     force the gcc compiler driver to run cc1plus on them.  */
-	  if (args[i] & LANGSPEC)
-	    {
-	      int len = strlen (argv[i]);
-	      if (argv[i][len - 1] == 'i')
-		arglist[j++] = "-xc++-cpp-output";
-	      else
-		arglist[j++] = "-xc++";
-	      arglist[j++] = argv[i];
-	      arglist[j] = "-xnone";
-	    }
-#endif
 	}
 
       /* Add `-lf2c' if we haven't already done so.  */
@@ -560,17 +403,8 @@
 	fprintf (stderr, " %s", arglist[i]);
       fprintf (stderr, "\n");
     }
-#if !defined(OS2) && !defined (_WIN32)
-#ifdef __MSDOS__
-  run_dos (gcc, arglist);
-#else /* !__MSDOS__ */
   if (execvp (gcc, arglist) < 0)
     pfatal_with_name (gcc);
-#endif /* __MSDOS__ */
-#else /* OS2 or _WIN32 */
-  if (spawnvp (1, gcc, arglist) < 0)
-    pfatal_with_name (gcc);
-#endif
 
   return 0;
 }
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199812221845.KAA50253>