teacake% diff -rc2 g++-1.37.0 g++-1.37.1 diff -rc2 g++-1.37.0/ChangeLog g++-1.37.1/ChangeLog *** g++-1.37.0/ChangeLog Wed Feb 28 17:19:50 1990 --- g++-1.37.1/ChangeLog Thu Mar 1 21:33:11 1990 *************** *** 1,2 **** --- 1,16 ---- + Thu Mar 1 19:32:03 1990 Michael Tiemann (tiemann at teacake) + + * version.c: version 1.37.1 released. + + * integrate.c (expand_inline_function): Round up size of parm_map. + + * g++.texinfo: Updated to version 1.37.1, including the addition + of a new chapter on exception handling. + + * ld.c: Fixed #ifdef problems introduced by Mark Ullman. + + * cplus-parse.y (print_parse_statistics): Modified to work in case + YYDEBUG is not defined. + Wed Feb 28 09:45:09 1990 Michael Tiemann (tiemann at teacake) diff -rc2 g++-1.37.0/cplus-parse.y g++-1.37.1/cplus-parse.y *** g++-1.37.0/cplus-parse.y Sun Feb 25 16:20:36 1990 --- g++-1.37.1/cplus-parse.y Thu Mar 1 19:30:50 1990 *************** *** 3088,3092 **** #define REDUCE_LENGTH (sizeof (yyr2) / sizeof (yyr2[0])) ! #define TOKEN_LENGTH (256 + sizeof (yytname) / sizeof (yytname[0])) int * --- 3088,3092 ---- #define REDUCE_LENGTH (sizeof (yyr2) / sizeof (yyr2[0])) ! #define TOKEN_LENGTH (256 + YYNTBASE + 1) int * *************** *** 3148,3153 **** if (token_count[index] < token_count[-1]) break; ! fprintf (stderr, "token %d, `%s', count = %d\n", ! index, yytname[YYTRANSLATE (index)], token_count[index]); } fprintf (stderr, "\n"); --- 3148,3156 ---- if (token_count[index] < token_count[-1]) break; ! fprintf (stderr, "token %d", index); ! #if YYDEBUG ! fprintf (stderr, ", `%s'", yytname[YYTRANSLATE (index)]); ! #endif ! fprintf (stderr, ", count = %d\n", token_count[index]); } fprintf (stderr, "\n"); *************** *** 3162,3167 **** if (reduce_count[index] < reduce_count[-1]) break; ! fprintf (stderr, "rule %d, line %d, count = %d\n", ! index, yyrline[index], reduce_count[index]); } fprintf (stderr, "\n"); --- 3165,3173 ---- if (reduce_count[index] < reduce_count[-1]) break; ! fprintf (stderr, "rule %d", index); ! #if YYDEBUG ! fprintf (stderr, ", line %d", yyrline[index]); ! #endif ! fprintf (stderr, ", count = %d\n", reduce_count[index]); } fprintf (stderr, "\n"); diff -rc2 g++-1.37.0/g++.texinfo g++-1.37.1/g++.texinfo *** g++-1.37.0/g++.texinfo Tue Feb 27 21:54:28 1990 --- g++-1.37.1/g++.texinfo Thu Mar 1 20:37:12 1990 *************** *** 48,54 **** @center Michael D. Tiemann @sp 3 ! @center last updated 13 August 1989 @sp 1 ! @center for version 1.36.2 @page @vskip 0pt plus 1filll --- 48,54 ---- @center Michael D. Tiemann @sp 3 ! @center last updated 1 March 1990 @sp 1 ! @center for version 1.37.1 @page @vskip 0pt plus 1filll *************** *** 55,87 **** Copyright @copyright{} 1988 Free Software Foundation, Inc. ! The @i{User's Guide to GNU C++} is a derivative work of authorship based on ! the @i{Using and Porting GNU CC} by Richard Stallman, and documentary comments ! in the source code of Doug Lea's library functions. Both of these ! documents are copyright @copyright The Free Software Foundation. The code described in this document represents a derivative work of ! authorship of the GNU CC compiler. The earlier GNU CC compiler was written ! by Richard Stallman. All copyright conditions applying to GNU CC also ! apply to GNU C++. ! Permission is granted to make and distribute verbatim copies of ! this manual provided the copyright notice and this permission notice ! are preserved on all copies. Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided also that the ! section entitled ``GNU CC General Public License'' is included exactly as ! in the original, and provided that the entire resulting derived work is ! distributed under the terms of a permission notice identical to this one. Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions, ! except that the section entitled ``GNU CC General Public License'' may be ! included in a translation approved by the author instead of in the original ! English. ! @strong{Note: GNU C++ is still in test release. Known bugs are documented ! in the ``BugList'' section. The ``Projects'' section lists things that ! could still be done.} @end titlepage --- 55,88 ---- Copyright @copyright{} 1988 Free Software Foundation, Inc. ! The @i{User's Guide to GNU C++} is a derivative work of authorship based ! on the @i{Using and Porting GNU CC} by Richard Stallman, and documentary ! comments in the source code of Doug Lea's library functions. Both of ! these documents are copyright @copyright The Free Software Foundation. The code described in this document represents a derivative work of ! authorship of the GNU CC compiler. The earlier GNU CC compiler was ! written by Richard Stallman. All copyright conditions applying to GNU ! CC also apply to GNU C++. ! Permission is granted to make and distribute verbatim copies of this ! manual provided the copyright notice and this permission notice are ! preserved on all copies. Permission is granted to copy and distribute modified versions of this manual under the conditions for verbatim copying, provided also that the ! section entitled ``GNU CC General Public License'' is included exactly ! as in the original, and provided that the entire resulting derived work ! is distributed under the terms of a permission notice identical to this ! one. Permission is granted to copy and distribute translations of this manual into another language, under the above conditions for modified versions, ! except that the section entitled ``GNU CC General Public License'' may ! be included in a translation approved by the author instead of in the ! original English. ! @strong{Note: GNU C++ is still in test release. Known bugs are ! documented in the ``BugList'' section. The ``Projects'' section lists ! things that could still be done.} @end titlepage *************** *** 94,107 **** ************ ! This manual documents how to install and use the GNU C++ compiler. ! The GNU C++ compiler is based on the GNU CC compiler, written by Richard M. Stallman. It provides and alternate front end to that compiler which is compatible with C++, and extends the ability of the compiler to take ! advantage of special code-generation features which are impossible to use ! in standard C. Details on the internals of the compiler are identical with ! those of GCC, and are not contained in this file. A texinfo link exists ! for the purposes of convenience and completeness. For hardcopy, please ! print out a copy of the GNU CC Internals document, which should be ! available if you have GNU C++. @end ifinfo --- 95,108 ---- ************ ! This manual documents how to install and use the GNU C++ compiler. The ! GNU C++ compiler is based on the GNU CC compiler, written by Richard M. Stallman. It provides and alternate front end to that compiler which is compatible with C++, and extends the ability of the compiler to take ! advantage of special code-generation features which are impossible to ! use in standard C. Details on the internals of the compiler are ! identical with those of GCC, and are not contained in this file. A ! texinfo link exists for the purposes of convenience and completeness. ! For hardcopy, please print out a copy of the GNU CC Internals document, ! which should be available if you have GNU C++. @end ifinfo *************** *** 295,302 **** programmers, especially those who are currently using C++. ! Aside from Michael Tiemann, who worked out the front end for GNU C++, and ! Richard Stallman, who worked out the back end, the following people (not ! including those who have made their contributions to GNU CC) should not go ! unmentioned. @itemize @bullet --- 296,303 ---- programmers, especially those who are currently using C++. ! Aside from Michael Tiemann, who worked out the front end for GNU C++, ! and Richard Stallman, who worked out the back end, the following people ! (not including those who have made their contributions to GNU CC) should ! not go unmentioned. @itemize @bullet *************** *** 328,331 **** --- 329,336 ---- James Clark wrote a name demangler for the GNU C++ naming scheme, and integrated it with the linker. + + @item + Michael Powell and Jim Mitchell helped design the GNU C++ + exception handling mechanism. @end itemize *************** *** 369,374 **** Other command options are passed on to one stage. Some options control the preprocessor and others the compiler itself. Yet other options ! control the assembler and linker; these are not documented here because the ! GNU assembler and linker are not yet released. Here are the options to control the overall compilation process, including --- 374,379 ---- Other command options are passed on to one stage. Some options control the preprocessor and others the compiler itself. Yet other options ! control the assembler and linker; these are not documented here because ! the GNU assembler and linker are not yet released. Here are the options to control the overall compilation process, including *************** *** 2257,2283 **** * Statement Exprs:: Putting statements and declarations inside expressions. * Naming Types:: Giving a name to the type of some expression. ! * Typeof:: @code{typeof}: referring to the type of an expression. ! * Lvalues:: Using @samp{?:}, @samp{,} and casts in lvalues. ! * Conditionals:: Omitting the middle operand of a @samp{?:} expression. ! * Zero-Length:: Zero-length arrays. ! * Variable-Length:: Arrays whose length is computed at run time. ! * Subscripting:: Any array can be subscripted, even if not an lvalue. ! * Pointer Arith:: Arithmetic on @code{void}-pointers and function pointers. ! * Initializers:: Non-constant initializers. ! * Constructors:: Constructor expressions give structures, unions ! or arrays as values. * Function Attributes:: Declaring that functions have no side effects, ! or that they can never return. * Dollar Signs:: Dollar sign is allowed in identifiers. * Alignment:: Inquiring about the alignment of a type or variable. * Inline:: Defining inline functions (as fast as macros). ! * Extended Asm:: Assembler instructions with C expressions as operands. ! (With them you can define ``built-in'' functions.) ! * Asm Labels:: Specifying the assembler name to use for a C symbol. * Global Reg Vars:: Defining global variables which reside in registers. ! * Operators:: Additional operators provided by GNU C++. * Wrappers:: Function calls as first-class objects. * Switch Ranges:: Specifying a range of values for a switch case. * Static Member Functions:: Hiding Functions in Classes. @end menu --- 2262,2289 ---- * Statement Exprs:: Putting statements and declarations inside expressions. * Naming Types:: Giving a name to the type of some expression. ! * Typeof:: @code{typeof}: referring to the type of an expression. ! * Lvalues:: Using @samp{?:}, @samp{,} and casts in lvalues. ! * Conditionals:: Omitting the middle operand of a @samp{?:} expression. ! * Zero-Length:: Zero-length arrays. ! * Variable-Length:: Arrays whose length is computed at run time. ! * Subscripting:: Any array can be subscripted, even if not an lvalue. ! * Pointer Arith:: Arithmetic on @code{void}-pointers and function pointers. ! * Initializers:: Non-constant initializers. ! * Constructors:: Constructor expressions give structures, unions ! or arrays as values. * Function Attributes:: Declaring that functions have no side effects, ! or that they can never return. * Dollar Signs:: Dollar sign is allowed in identifiers. * Alignment:: Inquiring about the alignment of a type or variable. * Inline:: Defining inline functions (as fast as macros). ! * Extended Asm:: Assembler instructions with C expressions as operands. ! (With them you can define ``built-in'' functions.) ! * Asm Labels:: Specifying the assembler name to use for a C symbol. * Global Reg Vars:: Defining global variables which reside in registers. ! * Operators:: Additional operators provided by GNU C++. * Wrappers:: Function calls as first-class objects. * Switch Ranges:: Specifying a range of values for a switch case. * Static Member Functions:: Hiding Functions in Classes. + * Exception Hanlding:: Handling exceptional circumstances. @end menu *************** *** 3311,3315 **** rejected by the compiler. ! @node Static Member Functions,,Switch Ranges, Extensions @section Static Member Functions --- 3317,3321 ---- rejected by the compiler. ! @node Static Member Functions, Exception Handling, Switch Ranges, Extensions @section Static Member Functions *************** *** 3402,3405 **** --- 3408,3510 ---- in the same class. + @node Exception Handling,, Static Member Functions, Extensions + @section Exception Handing + + The GNU C++ compiler implements a simple form of exception handling. + This extension is subject to change, but is presented here because so + many people have asked about it. + + Exceptions are declared as follows: + + @group + @example + class String { ... }; // some random class + + exception @{@} EX; // an exception that is just a name + exception + @{ + int i; // an integer value contained in this exception + String s; // a String object contained in this exception + @} EY; + @end example + @end group + + @noindent + With these declarations, @code{EX} and @code{EY} name exception types. + Variables of exception type cannot be declared, but from a conceptual + point of view, objects whose types mirror the exception declarations can + be created. + + Exceptions are raised and handled as shown in the following example: + + @group + @example + int f () + @{ + int i = foo (); + + try + @{ + int j = bar (); + i += j; + int k = bazzle (); + if (i < k) + return 7; + i *= k; + @} + except ex + @{ + EX + @{ + // if the EX exception was raised... + if (i < 0) + // raise `EY' exception + raise EY (i, "foo"); + return 4; + @} + EY + @{ + // if the EY exception was raised... + // use the exception's parameters + printString (ex.s); + return ex.i; + @} + default + @{ + // handle other exceptions + @} + @} + @} + @end example + @end group + + Functions which propagate exceptions (either by passing them through, or + by raising them) can be declared to do so as follows: + + @example + int f () raises EY; + @end example + + A shorthand notation exists for reraising exceptions: + + @group + @example + try + @{ + bar (); // may raise an exception... + @} + reraise EX, EY; // reraise only EX and EY + @end example + @end group + + When there is a notion of unhandled exceptions, for example a reraise + which does not list the exception type being handled, a call is made to + @code{__unhandled_exception} with arguments of source filename and line + number where exception was not handled. + + For those interested in reading more about this extension, a paper + explaining the exception handling design is available in the proceedings + from the 1990 USENIX workshop on C++, held in San Francisco, California. + @node Features, Bugs, Extensions, Top @chapter Features of GNU C++ *************** *** 4409,4413 **** First USENIX Technical Conference, Denver CO, 1988. ! [7] Stroustrup, Bjarne: @i{The Evolution of C++: 1985 to 1989} AT&T Bell Labs Tech Report. @contents --- 4514,4521 ---- First USENIX Technical Conference, Denver CO, 1988. ! [7] Tiemann, Michael: @i{An Exception Handling Implementation for C++} ! (to appear) USENIX Technical Conference, San Francisco CA, 1990. ! ! [8] Stroustrup, Bjarne: @i{The Evolution of C++: 1985 to 1989} AT&T Bell Labs Tech Report. @contents diff -rc2 g++-1.37.0/integrate.c g++-1.37.1/integrate.c *** g++-1.37.0/integrate.c Thu Feb 22 05:58:10 1990 --- g++-1.37.1/integrate.c Thu Mar 1 21:32:38 1990 *************** *** 945,953 **** bzero (reg_map, max_regno * sizeof (rtx)); ! parm_map = (rtx *)alloca ((FUNCTION_ARGS_SIZE (header) ! / UNITS_PER_WORD) * sizeof (rtx)); ! bzero (parm_map, ((FUNCTION_ARGS_SIZE (header) ! / UNITS_PER_WORD) ! * sizeof (rtx))); /* Note that expand_expr (called above) can clobber first_parm_offset. */ --- 945,952 ---- bzero (reg_map, max_regno * sizeof (rtx)); ! parm_map = (rtx *)alloca ((FUNCTION_ARGS_SIZE (header) + UNITS_PER_WORD - 1) ! / UNITS_PER_WORD * sizeof (rtx)); ! bzero (parm_map, ((FUNCTION_ARGS_SIZE (header) + UNITS_PER_WORD - 1) ! / UNITS_PER_WORD * sizeof (rtx))); /* Note that expand_expr (called above) can clobber first_parm_offset. */ diff -rc2 g++-1.37.0/ld.c g++-1.37.1/ld.c *** g++-1.37.0/ld.c Mon Feb 5 16:06:31 1990 --- g++-1.37.1/ld.c Thu Mar 1 19:41:30 1990 *************** *** 22,40 **** #ifdef sun /* Use Sun's TARGET convention. */ ! #ifndef TARGET ! #define SUN2 2 ! #define SUN3 3 ! #define SUN4 4 ! #if defined(sparc) ! #define TARGET SUN4 ! #else ! #if defined(mc68020) || defined(m68020) ! #define TARGET SUN3 #else ! #define TARGET SUN2 #endif #endif - #else - #define _CROSS_TARGET_ARCH TARGET /* locate the correct a.out.h file */ #endif --- 22,41 ---- #ifdef sun /* Use Sun's TARGET convention. */ ! #ifndef TARGET ! #define SUN2 2 ! #define SUN3 3 ! #define SUN4 4 ! #if defined(sparc) ! #define TARGET SUN4 #else ! #if defined(mc68020) || defined(m68020) ! #define TARGET SUN3 ! #else ! #define TARGET SUN2 ! #endif #endif + #else + #define _CROSS_TARGET_ARCH TARGET /* locate the correct a.out.h file */ #endif #endif *************** *** 119,186 **** #ifndef N_TXTADDR ! #if defined(vax) || defined(sony_news) || defined(hp300) || defined(pyr) ! #define N_TXTADDR(X) 0 #endif - #ifdef is68k - #define N_TXTADDR(x) (sizeof (struct exec)) - #endif - #ifdef sequent - #define N_TXTADDR(x) (N_ADDRADJ(x)) - #endif - #endif #ifndef N_DATADDR ! #if defined(vax) || defined(sony_news) || defined(hp300) || defined(pyr) ! #define N_DATADDR(x) \ (((x).a_magic==OMAGIC)? (N_TXTADDR(x)+(x).a_text) \ : (page_size+((N_TXTADDR(x)+(x).a_text-1) & ~(page_size-1)))) ! #endif ! #ifdef is68k ! #define SEGMENT_SIZE 0x20000 ! #define N_DATADDR(x) \ (((x).a_magic==Omagic)? (N_TXTADDR(x)+(x).a_text) \ : (SEGMENT_SIZE + ((N_TXTADDR(x)+(x).a_text-1) & ~(SEGMENT_SIZE-1)))) ! #endif ! #ifdef sequent ! #define N_DATADDR(x) \ (((x).a_magic==OMAGIC)? (N_TXTADDR(x)+(x).a_text) \ : (page_size+(((x).a_text-1) & ~(page_size-1)))) #endif - #endif ! #if TARGET == SUN4 ! #define INITIALIZE_HEADER \ ! {outheader.a_machtype = M_SPARC; outheader.a_toolversion = 1;} #endif - #if TARGET == SUN2 - #define INITIALIZE_HEADER outheader.a_machtype = M_68010 - #endif - #ifndef INITIALIZE_HEADER - #define INITIALIZE_HEADER outheader.a_machtype = M_68020 - #endif - #endif #ifdef ALTOS ! #define INITIALIZE_HEADER N_SET_MACHTYPE (outheader, M_68020) #endif #ifdef is68k ! #ifdef M_68020 ! /* ISI rel 4.0D doesn't use it, and rel 3.05 doesn't have an ! a_machtype field and so won't recognize the magic number. To keep ! binary compatibility for now, just ignore it */ ! #define INITIALIZE_HEADER outheader.a_machtype = 0; #endif - #endif #ifdef hpux ! #define INITIALIZE_HEADER N_SET_MACHTYPE (outheader, HP9000S200_ID) #endif #if defined(i386) && !defined(sequent) ! #define INITIALIZE_HEADER N_SET_MACHTYPE (outheader, M_386) #endif #ifdef is68k ! /* This enables code to take care of an ugly hack in the ISI OS. ! If a symbol beings with _$, then the object file is included only ! if the rest of the symbol name has been referenced. */ ! #define DOLLAR_KLUDGE #endif --- 120,188 ---- #ifndef N_TXTADDR ! #if defined(vax) || defined(sony_news) || defined(hp300) || defined(pyr) ! #define N_TXTADDR(X) 0 ! #endif ! #ifdef is68k ! #define N_TXTADDR(x) (sizeof (struct exec)) ! #endif ! #ifdef sequent ! #define N_TXTADDR(x) (N_ADDRADJ(x)) ! #endif #endif #ifndef N_DATADDR ! #if defined(vax) || defined(sony_news) || defined(hp300) || defined(pyr) ! #define N_DATADDR(x) \ (((x).a_magic==OMAGIC)? (N_TXTADDR(x)+(x).a_text) \ : (page_size+((N_TXTADDR(x)+(x).a_text-1) & ~(page_size-1)))) ! #endif ! #ifdef is68k ! #define SEGMENT_SIZE 0x20000 ! #define N_DATADDR(x) \ (((x).a_magic==Omagic)? (N_TXTADDR(x)+(x).a_text) \ : (SEGMENT_SIZE + ((N_TXTADDR(x)+(x).a_text-1) & ~(SEGMENT_SIZE-1)))) ! #endif ! #ifdef sequent ! #define N_DATADDR(x) \ (((x).a_magic==OMAGIC)? (N_TXTADDR(x)+(x).a_text) \ : (page_size+(((x).a_text-1) & ~(page_size-1)))) + #endif #endif ! #ifdef sun ! #if TARGET == SUN4 ! #define INITIALIZE_HEADER \ ! {outheader.a_machtype = M_SPARC; outheader.a_toolversion = 1;} ! #endif ! #if TARGET == SUN2 ! #define INITIALIZE_HEADER outheader.a_machtype = M_68010 ! #endif ! #ifndef INITIALIZE_HEADER ! #define INITIALIZE_HEADER outheader.a_machtype = M_68020 ! #endif #endif #ifdef ALTOS ! #define INITIALIZE_HEADER N_SET_MACHTYPE (outheader, M_68020) #endif #ifdef is68k ! #ifdef M_68020 ! /* ISI rel 4.0D doesn't use it, and rel 3.05 doesn't have an ! a_machtype field and so won't recognize the magic number. To keep ! binary compatibility for now, just ignore it */ ! #define INITIALIZE_HEADER outheader.a_machtype = 0; ! #endif #endif #ifdef hpux ! #define INITIALIZE_HEADER N_SET_MACHTYPE (outheader, HP9000S200_ID) #endif #if defined(i386) && !defined(sequent) ! #define INITIALIZE_HEADER N_SET_MACHTYPE (outheader, M_386) #endif #ifdef is68k ! /* This enables code to take care of an ugly hack in the ISI OS. ! If a symbol beings with _$, then the object file is included only ! if the rest of the symbol name has been referenced. */ ! #define DOLLAR_KLUDGE #endif *************** *** 189,197 **** */ #if defined(sun) && defined(sparc) && !defined(__GNUC__) ! #include "alloca.h" #endif #ifndef L_SET ! #define L_SET 0 #endif --- 191,199 ---- */ #if defined(sun) && defined(sparc) && !defined(__GNUC__) ! #include "alloca.h" #endif #ifndef L_SET ! #define L_SET 0 #endif diff -rc2 g++-1.37.0/version.c g++-1.37.1/version.c *** g++-1.37.0/version.c Tue Feb 27 22:38:48 1990 --- g++-1.37.1/version.c Thu Mar 1 19:56:34 1990 *************** *** 1 **** ! char *version_string = "1.37.0 (based on GCC 1.37)"; --- 1 ---- ! char *version_string = "1.37.1 (based on GCC 1.37)"; teacake%