(vms_fopen): Call `fopen' through an indirect pointer to inhibit checking argument...
authorRichard Kenner <kenner@gcc.gnu.org>
Mon, 12 Dec 1994 13:04:24 +0000 (08:04 -0500)
committerRichard Kenner <kenner@gcc.gnu.org>
Mon, 12 Dec 1994 13:04:24 +0000 (08:04 -0500)
(vms_fopen): Call `fopen' through an indirect pointer to inhibit checking
argument list against its prototype.
Increase RMS multi-block count from 16 to 32.

From-SVN: r8644

gcc/cccp.c
gcc/toplev.c

index 0c736373b237e78ea4829930af8e8d17349d4ee2..20bd11946dde1123fd8b7e670577c8c37bb8d4e8 100644 (file)
@@ -9967,9 +9967,16 @@ fopen (fname, type)
      char *type;
 {
 #undef fopen   /* Get back the REAL fopen routine */
-  if (strcmp (type, "w") == 0)
-    return fopen (fname, type, "mbc=16", "deq=64", "fop=tef", "shr=nil");
-  return fopen (fname, type, "mbc=16");
+  /* The gcc-vms-1.42 distribution's header files prototype fopen with two
+     fixed arguments, which matches ANSI's specification but not VAXCRTL's
+     pre-ANSI implmentation.  This hack circumvents the mismatch problem.  */
+  FILE *(*vmslib_fopen)() = (FILE *(*)()) fopen;
+
+  if (*type == 'w')
+    return (*vmslib_fopen) (fname, type, "mbc=32",
+                           "deq=64", "fop=tef", "shr=nil");
+  else
+    return (*vmslib_fopen) (fname, type, "mbc=32");
 }
 
 static int 
index f4dc8657b7116f11fd8e4dc952dc46f81c47add2..62c34f0aa56b0f6a997a449b04194951f4772d93 100644 (file)
@@ -71,16 +71,23 @@ the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #ifdef VMS
 /* The extra parameters substantially improve the I/O performance.  */
 static FILE *
-VMS_fopen (fname, type)
+vms_fopen (fname, type)
      char * fname;
      char * type;
 {
-  if (strcmp (type, "w") == 0)
-    return fopen (fname, type, "mbc=16", "deq=64", "fop=tef", "shr=nil");
-  return fopen (fname, type, "mbc=16");
+  /* The <stdio.h> in the gcc-vms-1.42 distribution prototypes fopen with two
+     fixed arguments, which matches ANSI's specification but not VAXCRTL's
+     pre-ANSI implementation.  This hack circumvents the mismatch problem.  */
+  FILE *(*vmslib_fopen)() = (FILE *(*)()) fopen;
+
+  if (*type == 'w')
+    return (*vmslib_fopen) (fname, type, "mbc=32",
+                           "deq=64", "fop=tef", "shr=nil");
+  else
+    return (*vmslib_fopen) (fname, type, "mbc=32");
 }
-#define fopen VMS_fopen
-#endif
+#define fopen vms_fopen
+#endif /* VMS */
 
 #ifndef DEFAULT_GDB_EXTENSIONS
 #define DEFAULT_GDB_EXTENSIONS 1