[gnu.g++.bug] Patches for g++ 1.36.4 on VMS

angel@FLIPPER.MIAMI.EDU (angel li) (02/01/90)

Enclosed are the patches for g++ 1.36.4 on VMS.  I have also upgraded
the gcc-cc1plus.exe on mango.miami.edu for those that don't wish to build
the compiler themselves.  If you previously FTP'ed g++ from mango, do so again.
At least you'll get the corrected ctype.h for VMS.  makefile.vms and
make-cc1plus.com have also been upgraded to reflect new source files
in g++ 1.36.4.  gas and gxx have not changed since last released.

One needs to add the following line to tm-vms.h to build g++ from scratch:

#define NO_DOLLAR_IN_LABEL

This fixes the problem where the compiler complains about variables that start
with a dollar sign (e.g. the $$PsectAttribute hack for stdin, stdout, stderr).  
One can not link objects compiled by a previous version of g++ with objects
generated by the 1.36.4 version because the above patch changes an internal
compiler naming scheme.

This version of g++ is based on gcc 1.36.93 and was compiled with gcc 1.36.93.
I am fairly happy with this version as it has compiled InterViews and built
an almost usable idraw and sted on VMS.  I'll be releasing InterViews diffs
in the very near future.


Angel Li
University of Miami/RSMAS Remote Sensing Group

Internet: angel@flipper.miami.edu			UUCP: ncar!umigw!angel
"Every time you think it weakens the nation."

*** cplus-decl.c.orig	Sun Jan 28 23:18:13 1990
--- cplus-decl.c	Tue Jan 30 19:40:32 1990
***************
*** 7987,7993 ****
--- 7987,7997 ----
  	   && ! strcmp (IDENTIFIER_POINTER (DECL_NAME (fndecl)), "main"))
      {
        /* Make it so that `main' always returns 0 by default.  */
+ #ifdef VMS
+       c_expand_return (integer_one_node);
+ #else
        c_expand_return (integer_zero_node);
+ #endif
      }
  
    /* That's the end of the vtable decl's life.  Need to mark it such
*** cplus-lex.c.orig	Sun Jan 28 09:35:17 1990
--- cplus-lex.c	Tue Jan 30 19:40:35 1990
***************
*** 28,33 ****
--- 28,36 ----
  #include "config.h"
  #include "input.h"
  #include "tree.h"
+ #ifdef VMS
+ #define _IOFBF 2		/* Missing from GNU's stdio.h */
+ #endif
  #include "cplus-tab.h"
  #include "cplus-parse.h"
  #include "cplus-tree.h"
***************
*** 37,42 ****
--- 40,51 ----
  extern int errno;		/* needed for VAX.  */
  extern jmp_buf toplevel;
  
+ #ifdef VMS
+ #define	NULL_FILE	"nla0:"
+ #else
+ #define	NULL_FILE	"/dev/null"
+ #endif
+ 
  #define obstack_chunk_alloc xmalloc
  #define obstack_chunk_free free
  
***************
*** 847,853 ****
  reinit_lex_for_unexec ()
  {
    finput1 = finput;
!   finput2 = fopen ("/dev/null", "r");
  }
  
  void
--- 856,862 ----
  reinit_lex_for_unexec ()
  {
    finput1 = finput;
!   finput2 = fopen (NULL_FILE, "r");
  }
  
  void
***************
*** 914,920 ****
       and will increment it to 1.  */
    lineno = 0;
    finput1 = finput;
!   finput2 = fopen ("/dev/null", "r");
    current_function_decl = NULL;
  
    maxtoken = 40;
--- 923,929 ----
       and will increment it to 1.  */
    lineno = 0;
    finput1 = finput;
!   finput2 = fopen (NULL_FILE, "r");
    current_function_decl = NULL;
  
    maxtoken = 40;
***************
*** 1122,1129 ****
--- 1131,1143 ----
        setvbuf(finput2,t->buf,_IOFBF,t->len);
        finput2->_cnt = t->len-1;
  #else
+ #ifdef VMS
+       setvbuf(finput2,t->buf,_IOFBF,t->len);
+       (*finput2)->_cnt = t->len-1;
+ #else
        setbuffer (finput2, t->buf, t->len);
        finput2->_cnt = finput2->_bufsiz - 1;
+ #endif				/* VMS */
  #endif				/* USG_STDIO */
  #else
        setvbuf(finput2,t->buf,_IOFBF,t->len);
***************
*** 1775,1783 ****
--- 1789,1801 ----
  		  && getc(finput) == 'p'
  		  && ((c = getc (finput)) == ' ' || c == '\t' || c == '\n'))
  		{
+ #ifdef VMS
+ 			;		/* Are you crazy? */
+ #else
  		  ungetc(c, finput);
  		  dump_data();
  		  longjmp (toplevel, 1);
+ #endif
  		}
  	      else
  #endif
***************
*** 2270,2277 ****
--- 2288,2300 ----
        	      setvbuf(finput2,t->buf,_IOFBF,t->len);
         	      finput2->_cnt = t->len-1;
  #else
+ #ifdef VMS
+       	      setvbuf(finput2,t->buf,_IOFBF,t->len);
+        	      (*finput2)->_cnt = t->len-1;
+ #else
    	      setbuffer (finput2, t->buf, t->len);
    	      finput2->_cnt = finput2->_bufsiz - 1;
+ #endif				/* VMS */
  #endif				/* USG_STDIO */
  #else
        	      setvbuf(finput2,t->buf,_IOFBF,t->len);
***************
*** 2430,2435 ****
--- 2453,2459 ----
  	  {
  	    tmp = get_identifier (token_buffer);
  
+ #ifndef VMS
  	    /* Make sure that user does not collide with our internal
  	       naming scheme.  */
  	    if (JOINER == '$'
***************
*** 2446,2451 ****
--- 2470,2476 ----
  		    || ANON_PARMNAME_P (tmp)))
  	      warning ("identifier name `%s' conflicts with GNU C++ internal naming strategy",
  		       token_buffer);
+ #endif
  
  	    /* Come into here if we must reprocess an identifier.  */
  	  resume_identifier_processing:
*** toplev.c.orig	Sun Jan 28 07:21:32 1990
--- toplev.c	Tue Jan 30 19:40:50 1990
***************
*** 1171,1181 ****
--- 1171,1184 ----
        prev_file = fopen (previous_asm_file_name, "r");
        if (prev_file == 0)
  	pfatal_with_name (previous_asm_file_name);
+ #ifndef VMS
        if (_bufsiz(asm_out_file) != _bufsiz(prev_file))
+ #endif
  	{
  	  while ((c = getc (prev_file)) != EOF)
  	    putc (c, asm_out_file);
  	}
+ #ifndef VMS
        else
  	{
  	  /* Copy quickly.  */
***************
*** 1193,1198 ****
--- 1196,1202 ----
  	    }
  	  while (size == _bufsiz(asm_out_file));
  	}
+ #endif
        fclose (prev_file);
      }