diff options
60 files changed, 2437 insertions, 1289 deletions
diff --git a/contrib/gcc/ChangeLog b/contrib/gcc/ChangeLog index c6496ff..0f83fad 100644 --- a/contrib/gcc/ChangeLog +++ b/contrib/gcc/ChangeLog @@ -1,3 +1,340 @@ +2003-08-04 Release Manager + + * GCC 3.3.1 Released. + +2003-08-04 Release Manager + + * GCC 3.3.1 Released. + +2003-08-03 Neil Booth <neil@daikokuya.co.uk> + + PR preprocessor/11534 + * cppexp.c (parse_defined): Warn only if -pedantic. + +2003-08-03 Mark Mitchell <mark@codesourcery.com> + + * Makefile.in (ORDINARY_FLAGS_TO_PASS): Pass AR. + + * Makefile.in (STAGE2_FLAGS_TO_PASS): Pass AR_FOR_TARGET and + RANLIB_FOR_TARGET. + (stage1_build): Likewise. + +2003-08-03 Jan Hubicka <jh@suse.cz> + + PR 10510 + * config/pa/pa.h (MAYBE_FP_REG_CLASS_P): New. + (SECONDARY_MEMORY_NEEDED): Use it. + +2003-08-01 Geoffrey Keating <geoffk@apple.com> + + PR 11709 (partial fix) + * config/rs6000/rs6000.c (rs6000_output_function_epilogue): Don't + insert a label at the end of an function under Mach-O. + + PR 11313 + * c-pragma.c (maybe_apply_pragma_weak): Don't get DECL_ASSEMBLER_NAME + when it's not needed. + +2003-07-29 Richard Henderson <rth@redhat.com> + + PR target/10681 + + 2003-06-27 J"orn Rennecke <joern.rennecke@superh.com> + * flow.c (propagate_one_insn): Use proper test for a register + being part of the return value. + + 2003-06-26 Richard Henderson <rth@redhat.com> + * flow.c (propagate_one_insn): Preserve live-at-end registers + across tail calls. + + 2003-06-26 Richard Henderson <rth@redhat.com> + * config/ia64/ia64.c (ia64_expand_call): Don't add ar.pfs for sibcalls. + (ia64_split_call): Only load descriptor for GP register inputs. + (ia64_expand_epilogue): Check current_frame_info.mask not + current_function_is_leaf to restore ar.pfs. + +2003-07-26 Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at> + + * doc/install.texi (Testing): Adjust required versions of DejaGnu. + +2003-07-24 Aldy Hernandez <aldyh@redhat.com> + + Backport the folling patch. + + 2003-04-01 Aldy Hernandez <aldyh@redhat.com> + + PR/8878 + * expr.c (expand_expr): Handle VECTOR_CST. + (const_vector_from_tree): New. + + * varasm.c (output_constant): Handle VECTOR_CST. + + * c-typeck.c (digest_init): Build a vector constant from a + VECTOR_TYPE. + +2003-07-23 John David Anglin <dave.anglin@nrc-cnrc.gc.ca> + + PR target/11607 and PR target/11516 + * pa.md (extzv, extv, insv): Revert latter half of last patch. + +2003-07-23 Mark Mitchell <mark@codesourcery.com> + + PR optimization/10679 + * tree-inline.c (inlinable_function_p): Honor MIN_INLINE_INSNS. + +2003-07-22 Bob Wilson <bob.wilson@acm.org> + + * unwind-c.c (PERSONALITY_FUNCTION): Delete duplicate define. + +2003-07-23 Dave Fluri <dave.fluri@onlink.net> + + * doc/extend.texi: Fixes to spelling, grammar, and diction. + +2003-07-21 H.J. Lu <hongjiu.lu@intel.com> + + PR optimization/11599 + * config/ia64/ia64.md (prefetch): Support predicate. + +2003-07-17 Eric Botcazou <ebotcazou@libertysurf.fr> + + PR optimization/11536 + * unroll.c (loop_iterations): Do not replace a register holding + the final value by its equivalent before the loop if it is not + invariant. + +2003-07-17 Eric Botcazou <ebotcazou@libertysurf.fr> + + * gcc.c-torture/execute/loop-16.c: New test. + +2003-07-21 Ben Elliston <bje@wasabisystems.com> + + * doc/invoke.texi (V850 Options): Spelling fixes. + +2003-07-21 Lisa M. Goldstein <opus@gnu.org> + + * doc/invoke.texi: Fixes to style, grammar and diction. + +2003-07-20 Mark Mitchell <mark@codesourcery.com> + + PR debug/11279 + * dwarf2out.c (gen_enumeration_type_die): Remember that + enumerators can be unsigned. + +2003-07-19 Kelley Cook <kelleycook@wideopenwest.com> + + * c-tree.texi: Backport changes from mainline. + * c-tree.texi: Ditto. + * collect2.texi: Ditto. + * cpp.texi: Ditto. + * cppopts.texi: Ditto. + * extend.texi: Ditto. + * fragments.texi: Ditto. + * headerdirs.texi: Ditto. + * install.texi: Ditto. + * invoke.texi: Ditto. + * md.texi: Ditto. + * portability.texi: Ditto. + * rtl.texi: Ditto. + * sourcebuild.texi: Ditto. + * trouble.texi: Ditto. + +2003-07-19 Kelley Cook <kelleycook@wideopenwest.com> + + PR optimization/4490 + * doc/invoke.texi (m96bit-long-double, m128bit-long-double): Reword + documentation to accurately reflect what these options do. + +2003-07-18 Richard Henderson <rth@redhat.com> + David S. Miller <davem@redhat.com> + + PR target/11556 + * optabs.c (prepare_operand): Fail gracefully instead of abort + if the predicate doesn't satisfy. + (gen_cond_trap): Allow prepare_operand to fail. + Pass correct opnum argument to prepare_operand. + +2003-07-18 Eric Botcazou <ebotcazou@libertysurf.fr> + + PR optimization/11083 + * toplev.c (rest_of_compilation): Delete unreachable blocks + if dead edges were purged after the addressof pass. + +2003-07-17 Mark Mitchell <mark@codesourcery.com> + + PR optimization/11557 + * calls.c (flags_from_decl_or_type): Do not set ECF_LIBCALL_BLOCK + unless we know which function is being called. + +2003-07-17 Nathanael Nerode <neroden@gcc.gnu.org> + + PR bootstrap/11043 + * config/arc/t-arc: Replace bogus references to "x-crtinit.o", + "x-crtfini.o" with "crtinit.o", "crtfini.o". + +2003-07-17 Eric Botcazou <ebotcazou@libertysurf.fr> + + PR other/11466 + * doc/invoke.texi (SPARC Options): Document "-mlittle-endian" + and its restrictions for the SPARC64 port. + + Backport from mainline: + 2003-06-13 Florian Weimer <fw@deneb.enyo.de> + + * doc/invoke.texi (SPARC Options): Document "-mimpure-text". + +2003-07-17 Eric Botcazou <ebotcazou@libertysurf.fr> + Phil Edwards <phil@jaj.com> + + * doc/install.texi (*-*-solaris2*): Document the step-by-step + procedure to bootstrap and install. + Document the preference for the legacy Sun tools in /usr/bin + over the POSIX tools in /usr/xpg4/bin for the build process. + +2003-07-16 Richard Henderson <rth@redhat.com> + + PR target/10907 + * config/ia64/ia64.c (ia64_epilogue_uses): GP is live at end + even with !TARGET_CONST_GP. + (ia64_function_ok_for_sibcall): Reject non-local functions. + +2003-07-15 Geoffrey Keating <geoffk@apple.com> + + * config/darwin.c (machopic_select_section): Use decl_readonly_section + to do most of the work. + +2003-07-15 David S. Miller <davem@redhat.com> + + * config/sparc/sparc.c (sparc_nonflat_function_epilogue): Only + emit nop if the last real insn is CALL_INSN. + +2003-07-15 Loren James Rittle <ljrittle@acm.org> + + * config/i386/freebsd.h (SET_ASM_OP): Remove. + (SUBTARGET_OVERRIDE_OPTIONS): Handle TARGET_64BIT case. + (ASM_COMMENT_START, ASM_APP_ON, ASM_APP_OFF, DBX_REGISTER_NUMBER + MCOUNT_NAME, SIZE_TYPE, PTRDIFF_TYPE, WCHAR_TYPE_SIZE): Whitespace. + +2003-07-15 Mark Mitchell <mark@codesourcery.com> + + PR debug/11473 + * dbxout.c (dbxout_type): Use TYPE_SIZE to determine the sizes of + base classes. + +2003-07-15 James A. Morrison <ja2morri@student.math.uwaterloo.ca> + + * doc/include/texinfo.tex: Upgrade to texinfo 4.6. + +2003-07-15 Eric Botcazou <ebotcazou@libertysurf.fr> + + PR optimization/11320 + * sched-int.h (struct deps) [reg_conditional_sets]: New field. + (struct sched_info) [compute_jump_reg_dependencies]: New prototype. + * sched-deps.c (sched_analyze_insn) [JUMP_INSN]: Update call to + current_sched_info->compute_jump_reg_dependencies. Record which + registers are used and which registers are set by the jump. + Clear deps->reg_conditional_sets after a barrier. + Set deps->reg_conditional_sets if the insn is a COND_EXEC. + Clear deps->reg_conditional_sets if the insn is not a COND_EXEC. + (init_deps): Initialize reg_conditional_sets. + (free_deps): Clear reg_conditional_sets. + * sched-ebb.c (compute_jump_reg_dependencies): New prototype. + Mark registers live on entry of the fallthrough block and conditionally + set as set by the jump. Mark registers live on entry of non-fallthrough + blocks as used by the jump. + * sched-rgn.c (compute_jump_reg_dependencies): New prototype. + Mark new parameters as unused. + +2003-07-14 Mark Mitchell <mark@codesourcery.com> + + PR debug/11098 + * integrate.c (copy_decl_for_inlining): Do not mark copied decls + as DECL_ABSTRACT. + +2003-07-14 Franz Sirl <Franz.Sirl-kernel@lauterbach.com> + + PR optimization/11440 + * gcse.c (try_replace_reg): Don't attach notes to ZERO_EXTRACT or + SIGN_EXTRACT SETs. + +2003-07-13 Aaron W. LaFramboise <awlaframboise@aol.com> + + * config/i386/gthr-win32.c (__GTHREAD_HIDE_WIN32API): Define to 1. + +2003-07-13 Roger Sayle <roger@eyesopen.com> + + PR optimization/11059 + * expr.c (can_store_by_pieces): Return true if length is zero. + (store_by_pieces): Do nothing if length is zero. + (clear_by_pieces): Do nothing if length is zero. + (clear_storage): Do nothing if length is zero. + (store_constructor): Simplify code when size is zero, or the + target has already been cleared. This avoids emitting a + blockage instruction when initializing empty structures. + +2003-07-13 Richard Henderson <rth@redhat.com> + + * libgcc-std.ver (GCC_3.3.1): Export __gcc_personality_sj0, + __gcc_personality_v0. + +2003-07-11 Dara Hazeghi <dhazeghi@yahoo.com> + + PR optimization/10877 + * doc/install.tex: Update required binutils for i?86-*-linux* + +2003-07-11 Ben Elliston <bje@redhat.com> + + PR c++/1607 + * doc/extend.texi (Function Attributes): Document the effect of + the C++ "this" parameter on the counting of arguments for the + "format" and "format_arg" attributes. + +2003-07-11 Danny Smith <dannysmith@users.sourceforge.net> + + Backport from mainline. + + 2003-05-13 Richard Henderson <rth@redhat.com> + + * c-decl.c (duplicate_decls): Re-invoke make_decl_rtl if + the old decl had instantiated DECL_RTL. + + 2003-05-21 Danny Smith <dannysmith@users.sourceforge.net> + + PR c++/9738 + * config/i386/winnt.c (i386_pe_encode_section_info): Enable + even if not first. + + 2003-07-04 Danny Smith <dannysmith@users.sourceforge.net> + + PR c++/5287, PR c++/7910, PR c++/11021 + * config/i386/winnt.c (ix86_handle_dll_attribute): Don't add + dllimport attribute if function is defined at declaration, but + report error instead. Likewise for dllimport'd variable + definitions. Set implicit TREE_PUBLIC for dllimport'd variables + declared within functions, Report error if dllimport or dllexport + symbol is not global. + (i386_pe_dllimport_p): Ignore dllimport attribute of functions + if defined after declaration or if inlined. Don't allow definition + of static data members of C++ classes. Don't dllimport virtual + methods. + (i386_pe_mark_dllexport): Warn about inconsistent dll attributes. + (i386_pe_mark_dllimport): Remove unnecessary checks. + (i386_pe_encode_section_info): Warn if the dllimport attribute + and symbol prefix have been instantiated and then overridden. + + * doc/extend.texi: Document dllimport and dllexport attributes. + +2003-07-10 James E Wilson <wilson@tuliptree.org> + + PR optimization/9745 + * loop.c (loop_iv_add_mult_emit_before): Call loop_regs_update before + loop_insn_emit_before. + (loop_iv_add_mult_sink, loop_iv_add_mult_hoist): Likewise. + +2003-07-10 Dara Hazeghi <dhazeghi@yahoo.com> + + PR bootstrap/10758 + * doc/install.texi: Document requirements for ia64-*-hpux* target. + 2003-07-09 Mark Mitchell <mark@codesourcery.com> PR c++/10032 @@ -135,10 +472,6 @@ * doc/contrib.texi: Fix typos. * doc/sourcebuild.texi: Likewise. -2003-06-29 Aaron W. LaFramboise <awlaframboise@aol.com> - - * config/i386/gthr-win32.h (__GTHREAD_HIDE_WIN32API): Define to 1. - 2003-06-27 Gunther Nikl <gni@gecko.de> PR target/11014 @@ -3839,7 +4172,8 @@ Mon Apr 7 15:56:30 CEST 2003 Jan Hubicka <jh@suse.cz> * df.c (df_uses_record): Handle CC0. 2003-01-25 Jan Hubicka <jh@suse.cz> - Eric Botcazou <ebotcazou@libertysurf.fr> + Eric Botcazou <ebotcazou@libertysurf.fr> + PR opt/8492 * gcse.c (one_cprop_pass): Delete unreachable blocks. diff --git a/contrib/gcc/Makefile.in b/contrib/gcc/Makefile.in index 75e4d03..40e90c2 100644 --- a/contrib/gcc/Makefile.in +++ b/contrib/gcc/Makefile.in @@ -682,6 +682,7 @@ LANG_STAGESTUFF = @all_stagestuff@ # subdirectories. # ??? The choices here will need some experimenting with. ORDINARY_FLAGS_TO_PASS = \ + "AR=$(AR)" \ "AR_FLAGS_FOR_TARGET=$(AR_FLAGS_FOR_TARGET)" \ "AR_CREATE_FOR_TARGET=$(AR_CREATE_FOR_TARGET)" \ "AR_EXTRACT_FOR_TARGET=$(AR_EXTRACT_FOR_TARGET)" \ @@ -3317,6 +3318,8 @@ VOL_FILES=`echo $(BACKEND) $(OBJS) $(C_OBJS) $(LIBCPP_OBJS) *.c *.h gen*` # the context of the stage_x rule. STAGE2_FLAGS_TO_PASS = \ ADAC="\$$(CC)" \ + AR_FOR_TARGET="$(AR_FOR_TARGET)" \ + RANLIB_FOR_TARGET="$(RANLIB_FOR_TARGET)" \ CFLAGS="$(BOOT_CFLAGS)" \ LDFLAGS="$(BOOT_LDFLAGS)" \ WARN_CFLAGS="\$$(GCC_WARN_CFLAGS)" \ @@ -3332,7 +3335,9 @@ STAGE2_FLAGS_TO_PASS = \ # MAKEINFO and MAKEINFOFLAGS are explicitly passed here to make them # overrideable (for a bootstrap build stage1 also builds gcc.info). stage1_build: - $(MAKE) CC="$(CC)" libdir=$(libdir) LANGUAGES="$(BOOT_LANGUAGES)" \ + $(MAKE) AR_FOR_TARGET="$(AR_FOR_TARGET)" \ + RANLIB_FOR_TARGET="$(RANLIB_FOR_TARGET)" \ + CC="$(CC)" libdir=$(libdir) LANGUAGES="$(BOOT_LANGUAGES)" \ CFLAGS="$(STAGE1_CFLAGS)" MAKEINFO="$(MAKEINFO)" \ MAKEINFOFLAGS="$(MAKEINFOFLAGS)" COVERAGE_FLAGS= $(STAMP) stage1_build diff --git a/contrib/gcc/c-decl.c b/contrib/gcc/c-decl.c index 37b22a7..8896c6c 100644 --- a/contrib/gcc/c-decl.c +++ b/contrib/gcc/c-decl.c @@ -1578,6 +1578,15 @@ duplicate_decls (newdecl, olddecl, different_binding_level) Update OLDDECL to be the same. */ DECL_ATTRIBUTES (olddecl) = DECL_ATTRIBUTES (newdecl); + /* If OLDDECL had its DECL_RTL instantiated, re-invoke make_decl_rtl + so that encode_section_info has a chance to look at the new decl + flags and attributes. */ + if (DECL_RTL_SET_P (olddecl) + && (TREE_CODE (olddecl) == FUNCTION_DECL + || (TREE_CODE (olddecl) == VAR_DECL + && TREE_STATIC (olddecl)))) + make_decl_rtl (olddecl, NULL); + return 1; } diff --git a/contrib/gcc/c-lex.c b/contrib/gcc/c-lex.c index a60fbb0..a4dcbaf 100644 --- a/contrib/gcc/c-lex.c +++ b/contrib/gcc/c-lex.c @@ -297,7 +297,7 @@ cb_file_change (pfile, new_map) } update_header_times (new_map->to_file); - in_system_header = new_map->sysp != 0; + in_system_header = (warn_system_headers && new_map->sysp != 0); input_filename = new_map->to_file; lineno = to_line; map = new_map; diff --git a/contrib/gcc/c-pragma.c b/contrib/gcc/c-pragma.c index 73c7d5f..819e696 100644 --- a/contrib/gcc/c-pragma.c +++ b/contrib/gcc/c-pragma.c @@ -288,15 +288,22 @@ maybe_apply_pragma_weak (decl) { tree *p, t, id; - /* Copied from the check in set_decl_assembler_name. */ - if (TREE_CODE (decl) == FUNCTION_DECL - || (TREE_CODE (decl) == VAR_DECL - && (TREE_STATIC (decl) - || DECL_EXTERNAL (decl) - || TREE_PUBLIC (decl)))) - id = DECL_ASSEMBLER_NAME (decl); - else + /* Avoid asking for DECL_ASSEMBLER_NAME when it's not needed. */ + + /* No weak symbols pending, take the short-cut. */ + if (!pending_weaks) + return; + /* If it's not visible outside this file, it doesn't matter whether + it's weak. */ + if (!DECL_EXTERNAL (decl) && !TREE_PUBLIC (decl)) return; + /* If it's not a function or a variable, it can't be weak. + FIXME: what kinds of things are visible outside this file but + aren't functions or variables? Should this be an abort() instead? */ + if (TREE_CODE (decl) != FUNCTION_DECL && TREE_CODE (decl) != VAR_DECL) + return; + + id = DECL_ASSEMBLER_NAME (decl); for (p = &pending_weaks; (t = *p) ; p = &TREE_CHAIN (t)) if (id == TREE_PURPOSE (t)) diff --git a/contrib/gcc/c-typeck.c b/contrib/gcc/c-typeck.c index 21cc510..5bf72fe 100644 --- a/contrib/gcc/c-typeck.c +++ b/contrib/gcc/c-typeck.c @@ -4759,6 +4759,14 @@ digest_init (type, init, require_constant) return inside_init; } } + /* Build a VECTOR_CST from a *constant* vector constructor. If the + vector constructor is not constant (e.g. {1,2,3,foo()}) then punt + below and handle as a constructor. */ + if (code == VECTOR_TYPE + && comptypes (TREE_TYPE (inside_init), type) + && TREE_CONSTANT (inside_init)) + return build_vector (type, TREE_OPERAND (inside_init, 1)); + /* Any type can be initialized from an expression of the same type, optionally with braces. */ diff --git a/contrib/gcc/calls.c b/contrib/gcc/calls.c index b5a5123..471f5bd 100644 --- a/contrib/gcc/calls.c +++ b/contrib/gcc/calls.c @@ -843,10 +843,13 @@ flags_from_decl_or_type (exp) if (TREE_NOTHROW (exp)) flags |= ECF_NOTHROW; + + if (TREE_READONLY (exp) && ! TREE_THIS_VOLATILE (exp)) + flags |= ECF_LIBCALL_BLOCK; } if (TREE_READONLY (exp) && ! TREE_THIS_VOLATILE (exp)) - flags |= ECF_CONST | ECF_LIBCALL_BLOCK; + flags |= ECF_CONST; if (TREE_THIS_VOLATILE (exp)) flags |= ECF_NORETURN; diff --git a/contrib/gcc/config/darwin.c b/contrib/gcc/config/darwin.c index 3722950..8efd8cd 100644 --- a/contrib/gcc/config/darwin.c +++ b/contrib/gcc/config/darwin.c @@ -1091,18 +1091,21 @@ machopic_select_section (exp, reloc, align) int reloc; unsigned HOST_WIDE_INT align ATTRIBUTE_UNUSED; { - if (TREE_CODE (exp) == STRING_CST) - { - if (flag_writable_strings) - data_section (); - else if (TREE_STRING_LENGTH (exp) != - strlen (TREE_STRING_POINTER (exp)) + 1) - readonly_data_section (); - else - cstring_section (); - } - else if (TREE_CODE (exp) == INTEGER_CST - || TREE_CODE (exp) == REAL_CST) + void (*base_function)(void); + + if (decl_readonly_section (exp, reloc)) + base_function = readonly_data_section; + else if (TREE_READONLY (exp) || TREE_CONSTANT (exp)) + base_function = const_data_section; + else + base_function = data_section; + + if (TREE_CODE (exp) == STRING_CST + && TREE_STRING_LENGTH (exp) == strlen (TREE_STRING_POINTER (exp)) + 1 + && ! flag_writable_strings) + cstring_section (); + else if ((TREE_CODE (exp) == INTEGER_CST || TREE_CODE (exp) == REAL_CST) + && flag_merge_constants) { tree size = TYPE_SIZE (TREE_TYPE (exp)); @@ -1115,7 +1118,7 @@ machopic_select_section (exp, reloc, align) TREE_INT_CST_HIGH (size) == 0) literal8_section (); else - readonly_data_section (); + base_function (); } else if (TREE_CODE (exp) == CONSTRUCTOR && TREE_TYPE (exp) @@ -1129,15 +1132,8 @@ machopic_select_section (exp, reloc, align) objc_constant_string_object_section (); else if (!strcmp (IDENTIFIER_POINTER (name), "NXConstantString")) objc_string_object_section (); - else if (TREE_READONLY (exp) || TREE_CONSTANT (exp)) - { - if (TREE_SIDE_EFFECTS (exp) || (flag_pic && reloc)) - const_data_section (); - else - readonly_data_section (); - } - else - data_section (); + else + base_function (); } else if (TREE_CODE (exp) == VAR_DECL && DECL_NAME (exp) && @@ -1191,26 +1187,11 @@ machopic_select_section (exp, reloc, align) objc_cat_cls_meth_section (); else if (!strncmp (name, "_OBJC_PROTOCOL_", 15)) objc_protocol_section (); - else if ((TREE_READONLY (exp) || TREE_CONSTANT (exp)) - && !TREE_SIDE_EFFECTS (exp)) - { - if (flag_pic && reloc) - const_data_section (); - else - readonly_data_section (); - } - else - data_section (); - } - else if (TREE_READONLY (exp) || TREE_CONSTANT (exp)) - { - if (TREE_SIDE_EFFECTS (exp) || (flag_pic && reloc)) - const_data_section (); - else - readonly_data_section (); + else + base_function (); } - else - data_section (); + else + base_function (); } /* This can be called with address expressions as "rtx". diff --git a/contrib/gcc/config/i386/freebsd.h b/contrib/gcc/config/i386/freebsd.h index 603e3ac..92f7fce 100644 --- a/contrib/gcc/config/i386/freebsd.h +++ b/contrib/gcc/config/i386/freebsd.h @@ -26,19 +26,16 @@ Boston, MA 02111-1307, USA. */ #define TARGET_VERSION fprintf (stderr, " (i386 FreeBSD/ELF)"); /* Override the default comment-starter of "/". */ -#undef ASM_COMMENT_START +#undef ASM_COMMENT_START #define ASM_COMMENT_START "#" -#undef ASM_APP_ON +#undef ASM_APP_ON #define ASM_APP_ON "#APP\n" -#undef ASM_APP_OFF +#undef ASM_APP_OFF #define ASM_APP_OFF "#NO_APP\n" -#undef SET_ASM_OP -#define SET_ASM_OP "\t.set\t" - -#undef DBX_REGISTER_NUMBER +#undef DBX_REGISTER_NUMBER #define DBX_REGISTER_NUMBER(n) \ (TARGET_64BIT ? dbx64_register_map[n] : svr4_dbx_register_map[n]) @@ -47,18 +44,18 @@ Boston, MA 02111-1307, USA. */ /* Tell final.c that we don't need a label passed to mcount. */ -#undef MCOUNT_NAME +#undef MCOUNT_NAME #define MCOUNT_NAME ".mcount" /* Make gcc agree with <machine/ansi.h>. */ -#undef SIZE_TYPE +#undef SIZE_TYPE #define SIZE_TYPE "unsigned int" -#undef PTRDIFF_TYPE +#undef PTRDIFF_TYPE #define PTRDIFF_TYPE "int" -#undef WCHAR_TYPE_SIZE +#undef WCHAR_TYPE_SIZE #define WCHAR_TYPE_SIZE BITS_PER_WORD /* Provide a STARTFILE_SPEC appropriate for FreeBSD. Here we add @@ -137,8 +134,10 @@ Boston, MA 02111-1307, USA. */ compiler get the contents of <float.h> and std::numeric_limits correct. */ #define SUBTARGET_OVERRIDE_OPTIONS \ do { \ - real_format_for_mode[XFmode - QFmode] \ - = &ieee_extended_intel_96_round_53_format; \ - real_format_for_mode[TFmode - QFmode] \ - = &ieee_extended_intel_96_round_53_format; \ + if (!TARGET_64BIT) { \ + real_format_for_mode[XFmode - QFmode] \ + = &ieee_extended_intel_96_round_53_format; \ + real_format_for_mode[TFmode - QFmode] \ + = &ieee_extended_intel_96_round_53_format; \ + } \ } while (0) diff --git a/contrib/gcc/config/i386/gthr-win32.c b/contrib/gcc/config/i386/gthr-win32.c index 06dc204..5510f10 100644 --- a/contrib/gcc/config/i386/gthr-win32.c +++ b/contrib/gcc/config/i386/gthr-win32.c @@ -32,7 +32,7 @@ Software Foundation, 59 Temple Place - Suite 330, Boston, MA #ifndef __GTHREAD_HIDE_WIN32API -# define __GTHREAD_HIDE_WIN32API +# define __GTHREAD_HIDE_WIN32API 1 #endif #include <gthr-win32.h> #include <windows.h> diff --git a/contrib/gcc/config/i386/winnt.c b/contrib/gcc/config/i386/winnt.c index 00b3dfd..01493a2 100644 --- a/contrib/gcc/config/i386/winnt.c +++ b/contrib/gcc/config/i386/winnt.c @@ -1,24 +1,24 @@ /* Subroutines for insn-output.c for Windows NT. Contributed by Douglas Rupp (drupp@cs.washington.edu) - Copyright (C) 1995, 1997, 1998, 1999, 2000, 2001, 2002 + Copyright (C) 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. -This file is part of GNU CC. +This file is part of GCC. -GNU CC is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2, or (at your option) -any later version. +GCC is free software; you can redistribute it and/or modify it under +the terms of the GNU General Public License as published by the Free +Software Foundation; either version 2, or (at your option) any later +version. -GNU CC is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. +GCC is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +for more details. You should have received a copy of the GNU General Public License -along with GNU CC; see the file COPYING. If not, write to -the Free Software Foundation, 59 Temple Place - Suite 330, -Boston, MA 02111-1307, USA. */ +along with GCC; see the file COPYING. If not, write to the Free +Software Foundation, 59 Temple Place - Suite 330, Boston, MA +02111-1307, USA. */ #include "config.h" #include "system.h" @@ -54,16 +54,18 @@ void i386_pe_mark_dllimport PARAMS ((tree)); /* Handle a "dllimport" or "dllexport" attribute; arguments as in struct attribute_spec.handler. */ tree -ix86_handle_dll_attribute (node, name, args, flags, no_add_attrs) - tree *node; +ix86_handle_dll_attribute (pnode, name, args, flags, no_add_attrs) + tree * pnode; tree name; tree args; int flags; bool *no_add_attrs; { + tree node = *pnode; + /* These attributes may apply to structure and union types being created, but otherwise should pass to the declaration involved. */ - if (!DECL_P (*node)) + if (!DECL_P (node)) { if (flags & ((int) ATTR_FLAG_DECL_NEXT | (int) ATTR_FLAG_FUNCTION_NEXT | (int) ATTR_FLAG_ARRAY_NEXT)) @@ -71,20 +73,56 @@ ix86_handle_dll_attribute (node, name, args, flags, no_add_attrs) *no_add_attrs = true; return tree_cons (name, args, NULL_TREE); } - if (TREE_CODE (*node) != RECORD_TYPE && TREE_CODE (*node) != UNION_TYPE) + if (TREE_CODE (node) != RECORD_TYPE && TREE_CODE (node) != UNION_TYPE) { warning ("`%s' attribute ignored", IDENTIFIER_POINTER (name)); *no_add_attrs = true; } + + return NULL_TREE; + } + + /* Report error on dllimport ambiguities seen now before they cause + any damage. */ + else if (is_attribute_p ("dllimport", name)) + { + /* Like MS, treat definition of dllimported variables and + non-inlined functions on declaration as syntax errors. + We allow the attribute for function definitions if declared + inline, but just ignore it in i386_pe_dllimport_p. */ + if (TREE_CODE (node) == FUNCTION_DECL && DECL_INITIAL (node) + && !DECL_INLINE (node)) + { + error_with_decl (node, "function `%s' definition is marked dllimport."); + *no_add_attrs = true; + } + + else if (TREE_CODE (node) == VAR_DECL) + { + if (DECL_INITIAL (node)) + { + error_with_decl (node,"variable `%s' definition is marked dllimport."); + *no_add_attrs = true; + } + + /* `extern' needn't be specified with dllimport. + Specify `extern' now and hope for the best. Sigh. */ + DECL_EXTERNAL (node) = 1; + /* Also, implicitly give dllimport'd variables declared within + a function global scope, unless declared static. */ + if (current_function_decl != NULL_TREE && !TREE_STATIC (node)) + TREE_PUBLIC (node) = 1; + } } - /* `extern' needn't be specified with dllimport. - Specify `extern' now and hope for the best. Sigh. */ - else if (TREE_CODE (*node) == VAR_DECL - && is_attribute_p ("dllimport", name)) + /* Report error if symbol is not accessible at global scope. */ + if (!TREE_PUBLIC (node) + && (TREE_CODE (node) == VAR_DECL + || TREE_CODE (node) == FUNCTION_DECL)) { - DECL_EXTERNAL (*node) = 1; - TREE_PUBLIC (*node) = 1; + error_with_decl (node, "external linkage required for symbol '%s' because of '%s' attribute.", + IDENTIFIER_POINTER (name)); + *no_add_attrs = true; } return NULL_TREE; @@ -169,6 +207,7 @@ i386_pe_dllimport_p (decl) tree decl; { tree imp; + int context_imp = 0; if (TREE_CODE (decl) == FUNCTION_DECL && TARGET_NOP_FUN_DLLIMPORT) @@ -177,17 +216,62 @@ i386_pe_dllimport_p (decl) if (TREE_CODE (decl) != VAR_DECL && TREE_CODE (decl) != FUNCTION_DECL) return 0; + imp = lookup_attribute ("dllimport", DECL_ATTRIBUTES (decl)); - if (imp) - return 1; /* Class members get the dllimport status of their class. */ - if (associated_type (decl)) + if (!imp && associated_type (decl)) { imp = lookup_attribute ("dllimport", TYPE_ATTRIBUTES (associated_type (decl))); if (imp) - return 1; + context_imp = 1; + } + + if (imp) + { + /* Don't mark defined functions as dllimport. If the definition + itself was marked with dllimport, than ix86_handle_dll_attribute + reports an error. This handles the case when the definition + overrides an earlier declaration. */ + if (TREE_CODE (decl) == FUNCTION_DECL && DECL_INITIAL (decl) + && !DECL_INLINE (decl)) + { + /* Don't warn about artificial methods. */ + if (!DECL_ARTIFICIAL (decl)) + warning_with_decl (decl,"function '%s' is defined after prior declaration as dllimport: attribute ignored."); + return 0; + } + + /* We ignore the dllimport attribute for inline member functions. + This differs from MSVC behaviour which treats it like GNUC + 'extern inline' extension. */ + else if (TREE_CODE (decl) == FUNCTION_DECL && DECL_INLINE (decl)) + { + if (extra_warnings) + warning_with_decl (decl, "inline function '%s' is declared as dllimport: attribute ignored."); + return 0; + } + + /* Don't allow definitions of static data members in dllimport class, + Just ignore attribute for vtable data. */ + else if (TREE_CODE (decl) == VAR_DECL + && TREE_STATIC (decl) && TREE_PUBLIC (decl) + && !DECL_EXTERNAL (decl) && context_imp) + { + if (!DECL_VIRTUAL_P (decl)) + error_with_decl (decl, "definition of static data member '%s' of dllimport'd class."); + return 0; + } + + /* Since we can't treat a pointer to a dllimport'd symbol as a + constant address, we turn off the attribute on C++ virtual + methods to allow creation of vtables using thunks. */ + else if (TREE_CODE (TREE_TYPE (decl)) == METHOD_TYPE + && (DECL_VIRTUAL_P (decl))) + return 0; + + return 1; } return 0; @@ -234,7 +318,12 @@ i386_pe_mark_dllexport (decl) else abort (); if (i386_pe_dllimport_name_p (oldname)) - oldname += 9; + { + warning_with_decl (decl,"inconsistent dll linkage for '%s': dllexport assumed."); + /* Remove DLL_IMPORT_PREFIX. */ + oldname += 9; + DECL_NON_ADDR_CONST_P (decl) = 0; + } else if (i386_pe_dllexport_name_p (oldname)) return; /* already done */ @@ -278,39 +367,13 @@ i386_pe_mark_dllimport (decl) } else if (i386_pe_dllimport_name_p (oldname)) { - /* Already done, but force correct linkage since the redeclaration - might have omitted explicit extern. Sigh. */ - if (TREE_CODE (decl) == VAR_DECL - /* ??? Is this test for vtables needed? */ - && !DECL_VIRTUAL_P (decl)) + /* Already done, but do a sanity check to prevent assembler errors. */ + if (!DECL_EXTERNAL (decl) || !TREE_PUBLIC (decl)) { - DECL_EXTERNAL (decl) = 1; - TREE_PUBLIC (decl) = 1; + error_with_decl (decl, "failure in redeclaration of '%s': dllimport'd symbol lacks external linkage."); + abort(); } - return; - } - - /* ??? One can well ask why we're making these checks here, - and that would be a good question. */ - - /* Imported variables can't be initialized. Note that C++ classes - are marked initial, so we need to check. */ - if (TREE_CODE (decl) == VAR_DECL - && !DECL_VIRTUAL_P (decl) - && (DECL_INITIAL (decl) - && ! TYPE_NEEDS_CONSTRUCTING (TREE_TYPE (decl)))) - { - error_with_decl (decl, "initialized variable `%s' is marked dllimport"); - return; - } - /* Nor can they be static. */ - if (TREE_CODE (decl) == VAR_DECL - /* ??? Is this test for vtables needed? */ - && !DECL_VIRTUAL_P (decl) - && 0 /*???*/) - { - error_with_decl (decl, "static variable `%s' is marked dllimport"); - return; + return; } newname = alloca (strlen (oldname) + 11); @@ -372,11 +435,8 @@ gen_stdcall_suffix (decl) void i386_pe_encode_section_info (decl, first) tree decl; - int first; + int first ATTRIBUTE_UNUSED; { - if (!first) - return; - /* This bit is copied from i386.h. */ if (optimize > 0 && TREE_CONSTANT (decl) && (!flag_writable_strings || TREE_CODE (decl) != STRING_CST)) @@ -393,7 +453,8 @@ i386_pe_encode_section_info (decl, first) gen_rtx (SYMBOL_REF, Pmode, gen_stdcall_suffix (decl)); /* Mark the decl so we can tell from the rtl whether the object is - dllexport'd or dllimport'd. */ + dllexport'd or dllimport'd. This also handles dllexport/dllimport + override semantics. */ if (i386_pe_dllexport_p (decl)) i386_pe_mark_dllexport (decl); @@ -415,6 +476,10 @@ i386_pe_encode_section_info (decl, first) tree idp = get_identifier (oldname + 9); rtx newrtl = gen_rtx (SYMBOL_REF, Pmode, IDENTIFIER_POINTER (idp)); + warning_with_decl (decl, "'%s' %s after being referenced with dllimport linkage.", + (DECL_INITIAL (decl) || !DECL_EXTERNAL (decl)) + ? "defined locally" : "redeclared without dllimport attribute"); + XEXP (DECL_RTL (decl), 0) = newrtl; DECL_NON_ADDR_CONST_P (decl) = 0; @@ -698,4 +763,3 @@ i386_pe_asm_file_end (file) } } } - diff --git a/contrib/gcc/config/ia64/ia64.c b/contrib/gcc/config/ia64/ia64.c index a8b13f9..0f34d8f 100644 --- a/contrib/gcc/config/ia64/ia64.c +++ b/contrib/gcc/config/ia64/ia64.c @@ -1467,11 +1467,7 @@ ia64_expand_call (retval, addr, nextarg, sibcall_p) } if (sibcall_p) - { - use_reg (&CALL_INSN_FUNCTION_USAGE (insn), b0); - use_reg (&CALL_INSN_FUNCTION_USAGE (insn), - gen_rtx_REG (DImode, AR_PFS_REGNUM)); - } + use_reg (&CALL_INSN_FUNCTION_USAGE (insn), b0); } void ia64_reload_gp () @@ -1524,7 +1520,7 @@ ia64_split_call (retval, addr, retaddr, scratch_r, scratch_b, /* If we find we're calling through a register, then we're actually calling through a descriptor, so load up the values. */ - if (REG_P (addr)) + if (REG_P (addr) && GR_REGNO_P (REGNO (addr))) { rtx tmp; bool addr_dead_p; @@ -2746,7 +2742,7 @@ ia64_expand_epilogue (sibcall_p) reg = gen_rtx_REG (DImode, AR_PFS_REGNUM); emit_move_insn (reg, alt_reg); } - else if (! current_function_is_leaf) + else if (TEST_HARD_REG_BIT (current_frame_info.mask, AR_PFS_REGNUM)) { alt_regno = next_scratch_gr_reg (); alt_reg = gen_rtx_REG (DImode, alt_regno); @@ -7162,12 +7158,11 @@ ia64_epilogue_uses (regno) switch (regno) { case R_GR (1): - /* When a function makes a call through a function descriptor, we - will write a (potentially) new value to "gp". After returning - from such a call, we need to make sure the function restores the - original gp-value, even if the function itself does not use the - gp anymore. */ - return (TARGET_CONST_GP && !(TARGET_AUTO_PIC || TARGET_NO_PIC)); + /* With a call to a function in another module, we will write a new + value to "gp". After returning from such a call, we need to make + sure the function restores the original gp-value, even if the + function itself does not use the gp anymore. */ + return !(TARGET_AUTO_PIC || TARGET_NO_PIC); case IN_REG (0): case IN_REG (1): case IN_REG (2): case IN_REG (3): case IN_REG (4): case IN_REG (5): case IN_REG (6): case IN_REG (7): @@ -7349,14 +7344,9 @@ bool ia64_function_ok_for_sibcall (decl) tree decl; { - /* Direct calls are always ok. */ - if (decl) - return true; - - /* If TARGET_CONST_GP is in effect, then our caller expects us to - return with our current GP. This means that we'll always have - a GP reload after an indirect call. */ - return !ia64_epilogue_uses (R_GR (1)); + /* We must always return with our current GP. This means we can + only sibcall to functions defined in the current module. */ + return decl && (*targetm.binds_local_p) (decl); } /* Output assembly directives for prologue regions. */ diff --git a/contrib/gcc/config/ia64/ia64.md b/contrib/gcc/config/ia64/ia64.md index 4d177c2..4baa5d3 100644 --- a/contrib/gcc/config/ia64/ia64.md +++ b/contrib/gcc/config/ia64/ia64.md @@ -5280,16 +5280,16 @@ { static const char * const alt[2][4] = { { - "lfetch.nta [%0]", - "lfetch.nt1 [%0]", - "lfetch.nt2 [%0]", - "lfetch [%0]" + "%,lfetch.nta [%0]", + "%,lfetch.nt1 [%0]", + "%,lfetch.nt2 [%0]", + "%,lfetch [%0]" }, { - "lfetch.excl.nta [%0]", - "lfetch.excl.nt1 [%0]", - "lfetch.excl.nt2 [%0]", - "lfetch.excl [%0]" + "%,lfetch.excl.nta [%0]", + "%,lfetch.excl.nt1 [%0]", + "%,lfetch.excl.nt2 [%0]", + "%,lfetch.excl [%0]" } }; int i = (INTVAL (operands[1])); diff --git a/contrib/gcc/config/rs6000/rs6000.c b/contrib/gcc/config/rs6000/rs6000.c index 591f77d..3c17f21 100644 --- a/contrib/gcc/config/rs6000/rs6000.c +++ b/contrib/gcc/config/rs6000/rs6000.c @@ -11110,6 +11110,23 @@ rs6000_output_function_epilogue (file, size) } } +#if TARGET_OBJECT_FORMAT == OBJECT_MACHO + /* Mach-O doesn't support labels at the end of objects, so if + it looks like we might want one, insert a NOP. */ + { + rtx insn = get_last_insn (); + while (insn + && NOTE_P (insn) + && NOTE_LINE_NUMBER (insn) != NOTE_INSN_DELETED_LABEL) + insn = PREV_INSN (insn); + if (insn + && (LABEL_P (insn) + || (NOTE_P (insn) + && NOTE_LINE_NUMBER (insn) == NOTE_INSN_DELETED_LABEL))) + fputs ("\tnop\n", file); + } +#endif + /* Output a traceback table here. See /usr/include/sys/debug.h for info on its format. diff --git a/contrib/gcc/config/sparc/sparc.c b/contrib/gcc/config/sparc/sparc.c index 7c25bc5..5b03f05 100644 --- a/contrib/gcc/config/sparc/sparc.c +++ b/contrib/gcc/config/sparc/sparc.c @@ -4037,11 +4037,19 @@ sparc_nonflat_function_epilogue (file, size, leaf_function) of a function were call foo; dslot; this can make the return PC of foo (ie. address of call instruction plus 8) point to the first instruction in the next function. */ - rtx insn; - - fputs("\tnop\n", file); + rtx insn, last_real_insn; insn = get_last_insn (); + + last_real_insn = prev_real_insn (insn); + if (last_real_insn + && GET_CODE (last_real_insn) == INSN + && GET_CODE (PATTERN (last_real_insn)) == SEQUENCE) + last_real_insn = XVECEXP (PATTERN (last_real_insn), 0, 0); + + if (last_real_insn && GET_CODE (last_real_insn) == CALL_INSN) + fputs("\tnop\n", file); + if (GET_CODE (insn) == NOTE) insn = prev_nonnote_insn (insn); if (insn && GET_CODE (insn) == BARRIER) diff --git a/contrib/gcc/cp/ChangeLog b/contrib/gcc/cp/ChangeLog index 58bd155..854fefa 100644 --- a/contrib/gcc/cp/ChangeLog +++ b/contrib/gcc/cp/ChangeLog @@ -1,3 +1,105 @@ +2003-08-04 Release Manager + + * GCC 3.3.1 Released. + +2003-08-04 Release Manager + + * GCC 3.3.1 Released. + +2003-08-04 Mark Mitchell <mark@codesourcery.com> + + PR c++/11713 + * search.c (setup_class_bindings): Handle conversion operators + specially. + +2003-07-24 Alexandre Oliva <aoliva@redhat.com> + + PR c++/10796 + * decl.c (finish_enum): Make sure the underlying integer type has + the same precision as some full integer type. Reverts part + 2003-06-27's patch that didn't play any role in fixing the PR. + +2003-07-24 Mark Mitchell <mark@codesourcery.com> + + * cp-tree.h (convert_to_base_statically): Declare. + * call.c (build_special_member_call): Convert INSTANCE to the base + type. + * class.c (convert_to_base_statically): New method. + * init.c (construct_virtual_base): Use it. + * method.c (do_build_assign_ref): Fix typo in comment. + +2003-07-24 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net> + + PR c++/11513 + * cp-tree.h (PROCESSING_REAL_TEMPLATE_DECL_P): Use current_scope. + +2003-07-23 Mark Mitchell <mark@codesourcery.com> + + PR c++/11645 + * cp-tree.h (accessible_base_p): Declare. + * call.c (build_over_call): Use it. + * search.c (accessible_base_p): New function, split out from ... + (lookup_base): ... here. + +2003-07-23 Nathan Sidwell <nathan@codesourcery.com> + + PR c++/11282 + * decl.c: (reshape_init): Always advance *INITP. + +2003-07-19 Mark Mitchell <mark@codesourcery.com> + + PR c++/11546 + * pt.c (lookup_template_class): Treat TYPE_DECLs as TEMPLATE_DECLs + where appropriate. + +2003-07-14 Mark Mitchell <mark@codesourcery.com> + + PR c++/7053 + * pt.c (unregister_specialization): Rename to ... + (reregister_specialization): ... this. + (tsubst_friend_function): Use it. + (regenerate_decl_from_template): Likewise. + +2003-07-14 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net> + + PR c++/11154 + * pt.c (more_specialized_class): Add full_args parameter. + (most_specialized_class): Adjust calls to more_specialized_class. + * cp-tree.h (more_specialized_class): Adjust declaration. + +2003-07-13 Mark Mitchell <mark@codesourcery.com> + + PR c++/11503 + * cp-tree.h (DECL_SELF_REFERENCE_P): New macro. + (SET_DECL_SELF_REFERENCE_P): Likewise. + * class.c (build_self_reference): Use SET_DECL_SELF_REFERENCE_P. + * pt.c (tsubst_decl): Copy it. + * search.c (lookup_base): Use DECL_SELF_REFERENCE_P. + +2003-07-11 Danny Smith <dannysmith@users.sourceforge.net> + + Backport from mainline. + + 2003-05-21 Danny Smith <dannysmith@users.sourceforge.net> + + PR c++/9738 + * decl.c (duplicate_decls): Re-invoke make_decl_rtl + if the old decl had instantiated DECL_RTL. + (Based on Richard Henderson 2003-05-13 patch to c-decl.c). + +2003-07-11 Mark Mitchell <mark@codesourcery.com> + + PR c++/8164 + * decl.c (duplicate_decls): Avoid mangling names unnecessarily. + +2003-07-10 Mark Mitchell <mark@codesourcery.com> + + PR c++/10558 + * parse.y (class_template_ok_as_expr): New variable. + (template_arg_1): New non-terminal. + (primary): Issue errors about uses of class templates as + expressions. + 2003-07-09 Mark Mitchell <mark@codesourcery.com> PR c++/10032 diff --git a/contrib/gcc/cp/call.c b/contrib/gcc/cp/call.c index ac7aeb8..8750128 100644 --- a/contrib/gcc/cp/call.c +++ b/contrib/gcc/cp/call.c @@ -4527,12 +4527,17 @@ build_over_call (cand, args, flags) TREE_VALUE (arg), cand->conversion_path, 1); + /* Check that the base class is accessible. */ + if (!accessible_base_p (TREE_TYPE (argtype), + BINFO_TYPE (cand->conversion_path))) + error ("`%T' is not an accessible base of `%T'", + BINFO_TYPE (cand->conversion_path), + TREE_TYPE (argtype)); /* If fn was found by a using declaration, the conversion path will be to the derived class, not the base declaring fn. We must convert from derived to base. */ base_binfo = lookup_base (TREE_TYPE (TREE_TYPE (converted_arg)), TREE_TYPE (parmtype), ba_ignore, NULL); - converted_arg = build_base_path (PLUS_EXPR, converted_arg, base_binfo, 1); @@ -4857,11 +4862,23 @@ build_special_member_call (tree instance, tree name, tree args, TREE_TYPE (instance) = build_pointer_type (class_type); instance = build1 (INDIRECT_REF, class_type, instance); } - else if (name == complete_dtor_identifier - || name == base_dtor_identifier - || name == deleting_dtor_identifier) - my_friendly_assert (args == NULL_TREE, 20020712); + else + { + if (name == complete_dtor_identifier + || name == base_dtor_identifier + || name == deleting_dtor_identifier) + my_friendly_assert (args == NULL_TREE, 20020712); + /* We must perform the conversion here so that we do not + subsequently check to see whether BINFO is an accessible + base. (It is OK for a constructor to call a constructor in + an inaccessible base as long as the constructor being called + is accessible.) */ + if (!same_type_ignoring_top_level_qualifiers_p + (TREE_TYPE (instance), BINFO_TYPE (binfo))) + instance = convert_to_base_statically (instance, binfo); + } + my_friendly_assert (instance != NULL_TREE, 20020712); /* Resolve the name. */ @@ -4899,7 +4916,9 @@ build_special_member_call (tree instance, tree name, tree args, args = tree_cons (NULL_TREE, sub_vtt, args); } - return build_new_method_call (instance, fns, args, binfo, flags); + return build_new_method_call (instance, fns, args, + TYPE_BINFO (BINFO_TYPE (binfo)), + flags); } /* Build a call to "INSTANCE.FN (ARGS)". */ diff --git a/contrib/gcc/cp/class.c b/contrib/gcc/cp/class.c index 82eede5..c1da654 100644 --- a/contrib/gcc/cp/class.c +++ b/contrib/gcc/cp/class.c @@ -401,6 +401,33 @@ convert_to_base (tree object, tree type, bool check_access) return build_base_path (PLUS_EXPR, object, binfo, /*nonnull=*/1); } +/* EXPR is an expression with class type. BASE is a base class (a + BINFO) of that class type. Returns EXPR, converted to the BASE + type. This function assumes that EXPR is the most derived class; + therefore virtual bases can be found at their static offsets. */ + +tree +convert_to_base_statically (tree expr, tree base) +{ + tree expr_type; + + expr_type = TREE_TYPE (expr); + if (!same_type_p (expr_type, BINFO_TYPE (base))) + { + tree pointer_type; + + pointer_type = build_pointer_type (expr_type); + expr = build_unary_op (ADDR_EXPR, expr, /*noconvert=*/1); + if (!integer_zerop (BINFO_OFFSET (base))) + expr = build (PLUS_EXPR, pointer_type, expr, + build_nop (pointer_type, BINFO_OFFSET (base))); + expr = build_nop (build_pointer_type (BINFO_TYPE (base)), expr); + expr = build1 (INDIRECT_REF, BINFO_TYPE (base), expr); + } + + return expr; +} + /* Virtual function things. */ @@ -6537,6 +6564,7 @@ build_self_reference () DECL_NONLOCAL (value) = 1; DECL_CONTEXT (value) = current_class_type; DECL_ARTIFICIAL (value) = 1; + SET_DECL_SELF_REFERENCE_P (value); if (processing_template_decl) value = push_template_decl (value); diff --git a/contrib/gcc/cp/cp-tree.h b/contrib/gcc/cp/cp-tree.h index bfeec9b..9b529a8 100644 --- a/contrib/gcc/cp/cp-tree.h +++ b/contrib/gcc/cp/cp-tree.h @@ -98,6 +98,7 @@ struct diagnostic_context; 3: DECL_IN_AGGR_P. 4: DECL_C_BIT_FIELD (in a FIELD_DECL) DECL_VAR_MARKED_P (in a VAR_DECL) + DECL_SELF_REFERENCE_P (in a TYPE_DECL) 5: DECL_INTERFACE_KNOWN. 6: DECL_THIS_STATIC (in VAR_DECL or FUNCTION_DECL). 7: DECL_DEAD_FOR_LOCAL (in VAR_DECL). @@ -2878,16 +2879,20 @@ struct lang_decl GTY(()) (TREE_CODE (NODE) == TYPE_DECL || DECL_CLASS_TEMPLATE_P (NODE)) /* Nonzero if NODE is the typedef implicitly generated for a type when - the type is declared. (In C++, `struct S {};' is roughly equivalent - to `struct S {}; typedef struct S S;' in C. This macro will hold - for the typedef indicated in this example. Note that in C++, there - is a second implicit typedef for each class, in the scope of `S' - itself, so that you can say `S::S'. This macro does *not* hold for - those typedefs. */ + the type is declared. In C++, `struct S {};' is roughly + equivalent to `struct S {}; typedef struct S S;' in C. + DECL_IMPLICIT_TYPEDEF_P will hold for the typedef indicated in this + example. In C++, there is a second implicit typedef for each + class, in the scope of `S' itself, so that you can say `S::S'. + DECL_SELF_REFERENCE_P will hold for that second typedef. */ #define DECL_IMPLICIT_TYPEDEF_P(NODE) \ (TREE_CODE (NODE) == TYPE_DECL && DECL_LANG_FLAG_2 (NODE)) #define SET_DECL_IMPLICIT_TYPEDEF_P(NODE) \ (DECL_LANG_FLAG_2 (NODE) = 1) +#define DECL_SELF_REFERENCE_P(NODE) \ + (TREE_CODE (NODE) == TYPE_DECL && DECL_LANG_FLAG_4 (NODE)) +#define SET_DECL_SELF_REFERENCE_P(NODE) \ + (DECL_LANG_FLAG_4 (NODE) = 1) /* A `primary' template is one that has its own template header. A member function of a class template is a template, but not primary. @@ -2956,7 +2961,7 @@ struct lang_decl GTY(()) entity with its own template parameter list, and which is not a full specialization. */ #define PROCESSING_REAL_TEMPLATE_DECL_P() \ - (processing_template_decl > template_class_depth (current_class_type)) + (processing_template_decl > template_class_depth (current_scope ())) /* Nonzero if this VAR_DECL or FUNCTION_DECL has already been instantiated, i.e. its definition has been generated from the @@ -3627,6 +3632,7 @@ extern tree perform_direct_initialization_if_possible (tree, tree); /* in class.c */ extern tree build_base_path PARAMS ((enum tree_code, tree, tree, int)); extern tree convert_to_base (tree, tree, bool); +extern tree convert_to_base_statically (tree, tree); extern tree build_vtbl_ref PARAMS ((tree, tree)); extern tree build_vfn_ref PARAMS ((tree, tree)); extern tree get_vtable_decl PARAMS ((tree, int)); @@ -4081,7 +4087,7 @@ extern tree instantiate_decl PARAMS ((tree, int)); extern tree get_bindings PARAMS ((tree, tree, tree)); extern int push_tinst_level PARAMS ((tree)); extern void pop_tinst_level PARAMS ((void)); -extern int more_specialized_class PARAMS ((tree, tree)); +extern int more_specialized_class PARAMS ((tree, tree, tree)); extern int is_member_template PARAMS ((tree)); extern int comp_template_parms PARAMS ((tree, tree)); extern int template_class_depth PARAMS ((tree)); @@ -4117,6 +4123,7 @@ extern int unemitted_tinfo_decl_p PARAMS((tree, void *)); extern int emit_tinfo_decl PARAMS((tree *, void *)); /* in search.c */ +extern bool accessible_base_p (tree, tree); extern tree lookup_base PARAMS ((tree, tree, base_access, base_kind *)); extern int types_overlap_p PARAMS ((tree, tree)); extern tree get_vbase PARAMS ((tree, tree)); diff --git a/contrib/gcc/cp/decl.c b/contrib/gcc/cp/decl.c index be31ac2..a392ee0 100644 --- a/contrib/gcc/cp/decl.c +++ b/contrib/gcc/cp/decl.c @@ -3514,7 +3514,9 @@ duplicate_decls (newdecl, olddecl) /* Already complained about this, so don't do so again. */ else if (current_class_type == NULL_TREE - || IDENTIFIER_ERROR_LOCUS (DECL_ASSEMBLER_NAME (newdecl)) != current_class_type) + || !DECL_ASSEMBLER_NAME_SET_P (newdecl) + || (IDENTIFIER_ERROR_LOCUS (DECL_ASSEMBLER_NAME (newdecl)) + != current_class_type)) { error ("conflicting types for `%#D'", newdecl); cp_error_at ("previous declaration as `%#D'", olddecl); @@ -4039,6 +4041,15 @@ duplicate_decls (newdecl, olddecl) Update OLDDECL to be the same. */ DECL_ATTRIBUTES (olddecl) = DECL_ATTRIBUTES (newdecl); + /* If OLDDECL had its DECL_RTL instantiated, re-invoke make_decl_rtl + so that encode_section_info has a chance to look at the new decl + flags and attributes. */ + if (DECL_RTL_SET_P (olddecl) + && (TREE_CODE (olddecl) == FUNCTION_DECL + || (TREE_CODE (olddecl) == VAR_DECL + && TREE_STATIC (olddecl)))) + make_decl_rtl (olddecl, NULL); + return 1; } @@ -8191,6 +8202,7 @@ reshape_init (tree type, tree *initp) { my_friendly_assert (TREE_CODE (old_init) == TREE_LIST, 20021202); TREE_VALUE (old_init) = error_mark_node; + *initp = TREE_CHAIN (old_init); return old_init; } @@ -14004,16 +14016,16 @@ finish_enum (enumtype) else fixup_signed_type (enumtype); - /* We use "int" or "unsigned int" as the underlying type, unless all - the values will not fit or the user has requested that we try to - use shorter types where possible. */ - if (precision < TYPE_PRECISION (integer_type_node) - && !flag_short_enums) - { - TYPE_PRECISION (enumtype) = TYPE_PRECISION (integer_type_node); - TYPE_SIZE (enumtype) = NULL_TREE; - layout_type (enumtype); - } + if (flag_short_enums || (precision > TYPE_PRECISION (integer_type_node))) + /* Use the width of the narrowest normal C type which is wide + enough. */ + TYPE_PRECISION (enumtype) = TYPE_PRECISION (c_common_type_for_size + (precision, 1)); + else + TYPE_PRECISION (enumtype) = TYPE_PRECISION (integer_type_node); + + TYPE_SIZE (enumtype) = NULL_TREE; + layout_type (enumtype); /* Fix up all variant types of this enum type. */ for (t = TYPE_MAIN_VARIANT (enumtype); t; t = TYPE_NEXT_VARIANT (t)) diff --git a/contrib/gcc/cp/init.c b/contrib/gcc/cp/init.c index 279e3b1..83a8753 100644 --- a/contrib/gcc/cp/init.c +++ b/contrib/gcc/cp/init.c @@ -880,18 +880,10 @@ construct_virtual_base (tree vbase, tree arguments) constructing virtual bases, then we must be the most derived class. Therefore, we don't have to look up the virtual base; we already know where it is. */ - exp = build (PLUS_EXPR, - TREE_TYPE (current_class_ptr), - current_class_ptr, - fold (build1 (NOP_EXPR, TREE_TYPE (current_class_ptr), - BINFO_OFFSET (vbase)))); - exp = build1 (NOP_EXPR, - build_pointer_type (BINFO_TYPE (vbase)), - exp); - exp = build1 (INDIRECT_REF, BINFO_TYPE (vbase), exp); - - expand_aggr_init_1 (vbase, current_class_ref, exp, - arguments, LOOKUP_COMPLAIN); + exp = convert_to_base_statically (current_class_ref, vbase); + + expand_aggr_init_1 (vbase, current_class_ref, exp, arguments, + LOOKUP_COMPLAIN); finish_compound_stmt (/*has_no_scope=*/1, compound_stmt); finish_then_clause (inner_if_stmt); finish_if_stmt (); diff --git a/contrib/gcc/cp/method.c b/contrib/gcc/cp/method.c index 16682af..1c2d2ea 100644 --- a/contrib/gcc/cp/method.c +++ b/contrib/gcc/cp/method.c @@ -661,7 +661,7 @@ do_build_assign_ref (fndecl) int cvquals = cp_type_quals (TREE_TYPE (parm)); int i; - /* Assign to each of thedirect base classes. */ + /* Assign to each of the direct base classes. */ for (i = 0; i < CLASSTYPE_N_BASECLASSES (current_class_type); ++i) { tree binfo; diff --git a/contrib/gcc/cp/parse.y b/contrib/gcc/cp/parse.y index 46e5021..157a210 100644 --- a/contrib/gcc/cp/parse.y +++ b/contrib/gcc/cp/parse.y @@ -56,6 +56,7 @@ Boston, MA 02111-1307, USA. */ static short *malloced_yyss; static void *malloced_yyvs; +static int class_template_ok_as_expr; #define yyoverflow(MSG, SS, SSSIZE, VS, VSSIZE, YYSSZ) \ do { \ @@ -449,7 +450,7 @@ check_class_key (key, aggr) %type <code> template_close_bracket %type <ttype> apparent_template_type %type <ttype> template_type template_arg_list template_arg_list_opt -%type <ttype> template_arg +%type <ttype> template_arg template_arg_1 %type <ttype> condition xcond paren_cond_or_null %type <ttype> type_name nested_name_specifier nested_type ptr_to_mem %type <ttype> complete_type_name notype_identifier nonnested_type @@ -1121,7 +1122,7 @@ template_close_bracket: template_arg_list_opt: /* empty */ { $$ = NULL_TREE; } - | template_arg_list + | template_arg_list ; template_arg_list: @@ -1132,6 +1133,15 @@ template_arg_list: ; template_arg: + { ++class_template_ok_as_expr; } + template_arg_1 + { + --class_template_ok_as_expr; + $$ = $2; + } + ; + +template_arg_1: type_id { $$ = groktypename ($1.t); } | PTYPENAME @@ -1704,7 +1714,14 @@ primary: $$ = $2; } | overqualified_id %prec HYPERUNARY - { $$ = build_offset_ref (OP0 ($$), OP1 ($$)); } + { $$ = build_offset_ref (OP0 ($$), OP1 ($$)); + if (!class_template_ok_as_expr + && DECL_CLASS_TEMPLATE_P ($$)) + { + error ("invalid use of template `%D'", $$); + $$ = error_mark_node; + } + } | overqualified_id '(' nonnull_exprlist ')' { $$ = parse_finish_call_expr ($1, $3, 0); } | overqualified_id LEFT_RIGHT diff --git a/contrib/gcc/cp/pt.c b/contrib/gcc/cp/pt.c index 22f93bf..62a66d3 100644 --- a/contrib/gcc/cp/pt.c +++ b/contrib/gcc/cp/pt.c @@ -128,7 +128,7 @@ static tree retrieve_specialization PARAMS ((tree, tree)); static tree retrieve_local_specialization PARAMS ((tree)); static tree register_specialization PARAMS ((tree, tree, tree)); static void register_local_specialization PARAMS ((tree, tree)); -static int unregister_specialization PARAMS ((tree, tree)); +static int reregister_specialization PARAMS ((tree, tree, tree)); static tree reduce_template_parm_level PARAMS ((tree, tree, int)); static tree build_template_decl PARAMS ((tree, tree)); static int mark_template_parm PARAMS ((tree, void *)); @@ -1041,13 +1041,11 @@ register_specialization (spec, tmpl, args) } /* Unregister the specialization SPEC as a specialization of TMPL. - Returns nonzero if the SPEC was listed as a specialization of - TMPL. */ + Replace it with NEW_SPEC, if NEW_SPEC is non-NULL. Returns true + if the SPEC was listed as a specialization of TMPL. */ static int -unregister_specialization (spec, tmpl) - tree spec; - tree tmpl; +reregister_specialization (tree spec, tree tmpl, tree new_spec) { tree* s; @@ -1056,7 +1054,10 @@ unregister_specialization (spec, tmpl) s = &TREE_CHAIN (*s)) if (TREE_VALUE (*s) == spec) { - *s = TREE_CHAIN (*s); + if (!new_spec) + *s = TREE_CHAIN (*s); + else + TREE_VALUE (*s) = new_spec; return 1; } @@ -4086,10 +4087,20 @@ lookup_template_class (d1, arglist, in_decl, context, entering_scope, complain) } if (template) context = DECL_CONTEXT (template); + if (template + && TREE_CODE (template) == TYPE_DECL + && IS_AGGR_TYPE (TREE_TYPE (template)) + && TREE_CODE (TREE_TYPE (template)) != TEMPLATE_TYPE_PARM) + { + d1 = template; + goto type_decl; + } } else if (TREE_CODE (d1) == TYPE_DECL && IS_AGGR_TYPE (TREE_TYPE (d1))) { - tree type = TREE_TYPE (d1); + tree type; + type_decl: + type = TREE_TYPE (d1); /* If we are declaring a constructor, say A<T>::A<T>, we will get an implicit typename for the second A. Deal with it. */ @@ -4997,8 +5008,9 @@ tsubst_friend_function (decl, args) DECL_TEMPLATE_INFO (old_decl) = new_friend_template_info; if (TREE_CODE (old_decl) != TEMPLATE_DECL) - /* duplicate_decls will take care of this case. */ - ; + reregister_specialization (new_friend, + most_general_template (old_decl), + old_decl); else { tree t; @@ -6340,6 +6352,8 @@ tsubst_decl (t, args, type, complain) r = copy_decl (t); if (TREE_CODE (r) == VAR_DECL) type = complete_type (type); + else if (DECL_SELF_REFERENCE_P (t)) + SET_DECL_SELF_REFERENCE_P (r); TREE_TYPE (r) = type; c_apply_type_quals_to_decl (cp_type_quals (type), r); DECL_CONTEXT (r) = ctx; @@ -9450,22 +9464,25 @@ more_specialized (pat1, pat2, deduce, len) 1 if PAT1 is more specialized than PAT2 as described in [temp.class.order]. -1 if PAT2 is more specialized than PAT1. - 0 if neither is more specialized. */ + 0 if neither is more specialized. + + FULL_ARGS is the full set of template arguments that triggers this + partial ordering. */ int -more_specialized_class (pat1, pat2) - tree pat1, pat2; +more_specialized_class (pat1, pat2, full_args) + tree pat1, pat2, full_args; { tree targs; int winner = 0; targs = get_class_bindings (TREE_VALUE (pat1), TREE_PURPOSE (pat1), - TREE_PURPOSE (pat2)); + add_outermost_template_args (full_args, TREE_PURPOSE (pat2))); if (targs) --winner; targs = get_class_bindings (TREE_VALUE (pat2), TREE_PURPOSE (pat2), - TREE_PURPOSE (pat1)); + add_outermost_template_args (full_args, TREE_PURPOSE (pat1))); if (targs) ++winner; @@ -9751,7 +9768,7 @@ most_specialized_class (tmpl, args) t = TREE_CHAIN (t); for (; t; t = TREE_CHAIN (t)) { - fate = more_specialized_class (champ, t); + fate = more_specialized_class (champ, t, args); if (fate == 1) ; else @@ -9768,7 +9785,7 @@ most_specialized_class (tmpl, args) for (t = list; t && t != champ; t = TREE_CHAIN (t)) { - fate = more_specialized_class (champ, t); + fate = more_specialized_class (champ, t, args); if (fate != 1) return error_mark_node; } @@ -10106,7 +10123,7 @@ regenerate_decl_from_template (decl, tmpl) instantiation. */ gen_tmpl = most_general_template (tmpl); push_access_scope_real (gen_tmpl, args, DECL_CONTEXT (decl)); - unregistered = unregister_specialization (decl, gen_tmpl); + unregistered = reregister_specialization (decl, gen_tmpl, NULL_TREE); /* If the DECL was not unregistered then something peculiar is happening: we created a specialization but did not call diff --git a/contrib/gcc/cp/search.c b/contrib/gcc/cp/search.c index 7a82796..4721a58 100644 --- a/contrib/gcc/cp/search.c +++ b/contrib/gcc/cp/search.c @@ -254,6 +254,28 @@ lookup_base_r (binfo, base, access, is_virtual, binfo_ptr) return found; } +/* Returns true if type BASE is accessible in T. (BASE is known to be + a base class of T.) */ + +bool +accessible_base_p (tree t, tree base) +{ + tree decl; + + /* [class.access.base] + + A base class is said to be accessible if an invented public + member of the base class is accessible. */ + /* Rather than inventing a public member, we use the implicit + public typedef created in the scope of every class. */ + decl = TYPE_FIELDS (base); + while (!DECL_SELF_REFERENCE_P (decl)) + decl = TREE_CHAIN (decl); + while (ANON_AGGR_TYPE_P (t)) + t = TYPE_CONTEXT (t); + return accessible_p (t, decl); +} + /* Lookup BASE in the hierarchy dominated by T. Do access checking as ACCESS specifies. Return the binfo we discover (which might not be canonical). If KIND_PTR is non-NULL, fill with information about @@ -313,41 +335,24 @@ lookup_base (t, base, access, kind_ptr) break; default: - if (access != ba_ignore + if ((access & ~ba_quiet) != ba_ignore /* If BASE is incomplete, then BASE and TYPE are probably the same, in which case BASE is accessible. If they are not the same, then TYPE is invalid. In that case, there's no need to issue another error here, and there's no implicit typedef to use in the code that follows, so we skip the check. */ - && COMPLETE_TYPE_P (base)) + && COMPLETE_TYPE_P (base) + && !accessible_base_p (t, base)) { - tree decl; - - /* [class.access.base] - - A base class is said to be accessible if an invented public - member of the base class is accessible. */ - /* Rather than inventing a public member, we use the implicit - public typedef created in the scope of every class. */ - decl = TYPE_FIELDS (base); - while (TREE_CODE (decl) != TYPE_DECL - || !DECL_ARTIFICIAL (decl) - || DECL_NAME (decl) != constructor_name (base)) - decl = TREE_CHAIN (decl); - while (ANON_AGGR_TYPE_P (t)) - t = TYPE_CONTEXT (t); - if (!accessible_p (t, decl)) + if (!(access & ba_quiet)) { - if (!(access & ba_quiet)) - { - error ("`%T' is an inaccessible base of `%T'", base, t); - binfo = error_mark_node; - } - else - binfo = NULL_TREE; - bk = bk_inaccessible; + error ("`%T' is an inaccessible base of `%T'", base, t); + binfo = error_mark_node; } + else + binfo = NULL_TREE; + bk = bk_inaccessible; } break; } @@ -2635,6 +2640,20 @@ setup_class_bindings (name, type_binding_p) if (BASELINK_P (value_binding)) /* NAME is some overloaded functions. */ value_binding = BASELINK_FUNCTIONS (value_binding); + /* Two conversion operators that convert to the same type + may have different names. (See + mangle_conv_op_name_for_type.) To avoid recording the + same conversion operator declaration more than once we + must check to see that the same operator was not already + found under another name. */ + if (IDENTIFIER_TYPENAME_P (name) + && is_overloaded_fn (value_binding)) + { + tree fns; + for (fns = value_binding; fns; fns = OVL_NEXT (fns)) + if (IDENTIFIER_CLASS_VALUE (DECL_NAME (OVL_CURRENT (fns)))) + return; + } pushdecl_class_level (value_binding); } } diff --git a/contrib/gcc/cppexp.c b/contrib/gcc/cppexp.c index 7f576f2..12919f6 100644 --- a/contrib/gcc/cppexp.c +++ b/contrib/gcc/cppexp.c @@ -502,7 +502,7 @@ parse_defined (pfile) if (node) { - if (pfile->context != initial_context) + if (pfile->context != initial_context && CPP_PEDANTIC (pfile)) cpp_error (pfile, DL_WARNING, "this use of \"defined\" may not be portable"); diff --git a/contrib/gcc/dbxout.c b/contrib/gcc/dbxout.c index 60ca664..43dd9ab 100644 --- a/contrib/gcc/dbxout.c +++ b/contrib/gcc/dbxout.c @@ -1621,9 +1621,7 @@ dbxout_type (type, full) * BITS_PER_UNIT); putc (',', asmfile); CHARS (1); - print_wide_int (tree_low_cst (DECL_SIZE - (TYPE_NAME - (BINFO_TYPE (child))), + print_wide_int (tree_low_cst (TYPE_SIZE (BINFO_TYPE (child)), 0) * BITS_PER_UNIT); putc (';', asmfile); diff --git a/contrib/gcc/doc/c-tree.texi b/contrib/gcc/doc/c-tree.texi index 8f5a5bb..fbc90fa3 100644 --- a/contrib/gcc/doc/c-tree.texi +++ b/contrib/gcc/doc/c-tree.texi @@ -1,4 +1,4 @@ -@c Copyright (c) 1999, 2000, 2001 Free Software Foundation, Inc. +@c Copyright (c) 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. @c Free Software Foundation, Inc. @c This is part of the GCC manual. @c For copying conditions, see the file gcc.texi. @@ -645,7 +645,7 @@ the unqualified name of the name of the namespace (@pxref{Identifiers}). The name of the global namespace is @samp{::}, even though in C++ the global namespace is unnamed. However, you should use comparison with @code{global_namespace}, rather than @code{DECL_NAME} to determine -whether or not a namespaces is the global one. An unnamed namespace +whether or not a namespace is the global one. An unnamed namespace will have a @code{DECL_NAME} equal to @code{anonymous_namespace_name}. Within a single translation unit, all unnamed namespaces will have the same name. diff --git a/contrib/gcc/doc/collect2.texi b/contrib/gcc/doc/collect2.texi index a3d43b2..c3498c5 100644 --- a/contrib/gcc/doc/collect2.texi +++ b/contrib/gcc/doc/collect2.texi @@ -5,7 +5,7 @@ @node Collect2 @chapter @code{collect2} -GNU CC uses a utility called @code{collect2} on nearly all systems to arrange +GCC uses a utility called @code{collect2} on nearly all systems to arrange to call various initialization functions at start time. The program @code{collect2} works by linking the program once and diff --git a/contrib/gcc/doc/cpp.texi b/contrib/gcc/doc/cpp.texi index a6d6fb0..070e31c 100644 --- a/contrib/gcc/doc/cpp.texi +++ b/contrib/gcc/doc/cpp.texi @@ -377,8 +377,9 @@ comment. @end group @end example -Comments are not recognized within string literals. @t{@w{"/* blah -*/"}} is the string constant @samp{@w{/* blah */}}, not an empty string. +Comments are not recognized within string literals. +@t{@w{"/* blah */"}} is the string constant @samp{@w{/* blah */}}, not +an empty string. Line comments are not in the 1989 edition of the C standard, but they are recognized by GCC as an extension. In C++ and in the 1999 edition @@ -1731,7 +1732,7 @@ predefined macros, but you cannot undefine them. @subsection Standard Predefined Macros @cindex standard predefined macros. -The standard predefined macros are specified by the C and/or C++ +The standard predefined macros are specified by the relevant language standards, so they are available with all compilers that implement those standards. Older compilers may not provide all of them. Their names all start with double underscores. @@ -1850,6 +1851,15 @@ of the 1998 C++ standard will define this macro to @code{199711L}. The GNU C++ compiler is not yet fully conforming, so it uses @code{1} instead. We hope to complete our implementation in the near future. +@item __OBJC__ +This macro is defined, with value 1, when the Objective-C compiler is in +use. You can use @code{__OBJC__} to test whether a header is compiled +by a C compiler or a Objective-C compiler. + +@item __ASSEMBLER__ +This macro is defined with value 1 when preprocessing assembly +language. + @end table @node Common Predefined Macros @@ -1911,11 +1921,6 @@ calculate a single number, then compare that against a threshold: @noindent Many people find this form easier to understand. -@item __OBJC__ -This macro is defined, with value 1, when the Objective-C compiler is in -use. You can use @code{__OBJC__} to test whether a header is compiled -by a C compiler or a Objective-C compiler. - @item __GNUG__ The GNU C++ compiler defines this. Testing it is equivalent to testing @code{@w{(__GNUC__ && __cplusplus)}}. @@ -1940,6 +1945,9 @@ incremented on every @samp{#include} directive and decremented at the end of every included file. It starts out at 0, it's value within the base file specified on the command line. +@item __ELF__ +This macro is defined if the target uses the ELF object format. + @item __VERSION__ This macro expands to a string constant which describes the version of the compiler in use. You should not rely on its contents having any @@ -2031,6 +2039,12 @@ This macro is defined, with value 1, if (and only if) the NeXT runtime (as in @option{-fnext-runtime}) is in use for Objective-C. If the GNU runtime is used, this macro is not defined, so that you can use this macro to determine which runtime (NeXT or GNU) is being used. + +@item __LP64__ +@item _LP64 +These macros are defined, with value 1, if (and only if) the compilation +is for a target where @code{long int} and pointer both use 64-bits and +@code{int} uses 32-bit. @end table @node System-specific Predefined Macros diff --git a/contrib/gcc/doc/cppopts.texi b/contrib/gcc/doc/cppopts.texi index 7abb803..1cc688a 100644 --- a/contrib/gcc/doc/cppopts.texi +++ b/contrib/gcc/doc/cppopts.texi @@ -40,8 +40,11 @@ provided with a @option{-D} option. @item -undef @opindex undef -Do not predefine any system-specific macros. The common predefined -macros remain defined. +Do not predefine any system-specific or GCC-specific macros. The +standard predefined macros remain defined. +@ifset cppmanual +@xref{Standard Predefined Macros}. +@end ifset @item -I @var{dir} @opindex I @@ -562,13 +565,6 @@ the source line. The @option{-CC} option is generally used to support lint comments. -@item -gcc -@opindex gcc -Define the macros @sc{__gnuc__}, @sc{__gnuc_minor__} and -@sc{__gnuc_patchlevel__}. These are defined automatically when you use -@command{gcc -E}; you can turn them off in that case with -@option{-no-gcc}. - @item -traditional-cpp @opindex traditional-cpp Try to imitate the behavior of old-fashioned C preprocessors, as diff --git a/contrib/gcc/doc/extend.texi b/contrib/gcc/doc/extend.texi index 484a646..f656904 100644 --- a/contrib/gcc/doc/extend.texi +++ b/contrib/gcc/doc/extend.texi @@ -1,5 +1,5 @@ -@c Copyright (C) 1988,1989,1992,1993,1994,1996,1998,1999,2000,2001,2002, -@c 2003 Free Software Foundation, Inc. +@c Copyright (C) 1988,1989,1992,1993,1994,1996,1998,1999,2000,2001,2002, 2003 +@c Free Software Foundation, Inc. @c This is part of the GCC manual. @c For copying conditions, see the file gcc.texi. @@ -1371,7 +1371,8 @@ struct empty @{ @end example The structure will have size zero. In C++, empty structures are part -of the language, and the language standard says they have size 1. +of the language. G++ treats empty structures as if they had a single +member of type @code{char}. @node Variable Length @section Arrays of Variable Length @@ -1527,8 +1528,8 @@ argument, these arguments are not macro expanded. Recently, the preprocessor has relaxed its treatment of escaped newlines. Previously, the newline had to immediately follow a -backslash. The current implementation allows whitespace in the form of -spaces, horizontal and vertical tabs, and form feeds between the +backslash. The current implementation allows whitespace in the form +of spaces, horizontal and vertical tabs, and form feeds between the backslash and the subsequent newline. The preprocessor issues a warning, but treats it as a valid escaped newline and combines the two lines to form a single logical line. This works within comments and @@ -2104,6 +2105,9 @@ functions where the arguments are not available to be checked (such as @code{vprintf}), specify the third parameter as zero. In this case the compiler only checks the format string for consistency. For @code{strftime} formats, the third parameter is required to be zero. +Since non-static C++ methods have an implicit @code{this} argument, the +arguments of such methods should be counted from two, not one, when +giving values for @var{string-index} and @var{first-to-check}. In the example above, the format string (@code{my_format}) is the second argument of the function @code{my_print}, and the arguments to check @@ -2156,7 +2160,9 @@ string argument is not constant; this would generate a warning when without the attribute. The parameter @var{string-index} specifies which argument is the format -string argument (starting from 1). +string argument (starting from one). Since non-static C++ methods have +an implicit @code{this} argument, the arguments of such methods should +be counted from two. The @code{format-arg} attribute allows you to identify your own functions which modify format strings, so that GCC can check the @@ -2286,7 +2292,7 @@ and linker. @cindex @code{malloc} attribute The @code{malloc} attribute is used to tell the compiler that a function may be treated as if it were the malloc function. The compiler assumes -that calls to malloc result in a pointers that cannot alias anything. +that calls to malloc result in pointers that cannot alias anything. This will often improve optimization. @item alias ("@var{target}") @@ -2338,7 +2344,7 @@ by another module. Internal visibility is like hidden visibility, but with additional processor specific semantics. Unless otherwise specified by the psABI, gcc defines internal visibility to mean that the function is @emph{never} -called from another module. Note that hidden symbols, while then cannot +called from another module. Note that hidden symbols, while they cannot be referenced directly by other modules, can be referenced indirectly via function pointers. By indicating that a symbol cannot be called from outside the module, gcc may for instance omit the load of a PIC register @@ -2347,15 +2353,6 @@ since it is known that the calling function loaded the correct value. Not all ELF targets support this attribute. -@item tls_model ("@var{tls_model}") -@cindex @code{tls_model} attribute -The @code{tls_model} attribute sets thread-local storage model -(@pxref{Thread-Local}) of a particular @code{__thread} variable, -overriding @code{-ftls-model=} command line switch on a per-variable -basis. -The @var{tls_model} argument should be one of @code{global-dynamic}, -@code{local-dynamic}, @code{initial-exec} or @code{local-exec}. - @item regparm (@var{number}) @cindex @code{regparm} attribute @cindex functions that are passed arguments in registers on the 386 @@ -2381,8 +2378,6 @@ On the Intel 386, the @code{stdcall} attribute causes the compiler to assume that the called function will pop off the stack space used to pass arguments, unless it takes a variable number of arguments. -The PowerPC compiler for Windows NT currently ignores the @code{stdcall} -attribute. @item cdecl @cindex functions that do pop the argument stack on the 386 @@ -2392,9 +2387,6 @@ assume that the calling function will pop off the stack space used to pass arguments. This is useful to override the effects of the @option{-mrtd} switch. -The PowerPC compiler for Windows NT currently ignores the @code{cdecl} -attribute. - @item longcall/shortcall @cindex functions called via pointer on the RS/6000 and PowerPC On the RS/6000 and PowerPC, the @code{longcall} attribute causes the @@ -2404,12 +2396,12 @@ attribute causes the compiler not to do this. These attributes override both the @option{-mlongcall} switch and the @code{#pragma longcall} setting. -@xref{RS/6000 and PowerPC Options}, for more information on when long -calls are and are not necessary. +@xref{RS/6000 and PowerPC Options}, for more information on whether long +calls are necessary. @item long_call/short_call @cindex indirect calls on ARM -This attribute allows to specify how to call a particular function on +This attribute specifies how a particular function is called on ARM@. Both attributes override the @option{-mlong-calls} (@pxref{ARM Options}) command line switch and @code{#pragma long_calls} settings. The @code{long_call} attribute causes the compiler to always call the @@ -2418,31 +2410,6 @@ contents of that register. The @code{short_call} attribute always places the offset to the function from the call site into the @samp{BL} instruction directly. -@item dllimport -@cindex functions which are imported from a dll on PowerPC Windows NT -On the PowerPC running Windows NT, the @code{dllimport} attribute causes -the compiler to call the function via a global pointer to the function -pointer that is set up by the Windows NT dll library. The pointer name -is formed by combining @code{__imp_} and the function name. - -@item dllexport -@cindex functions which are exported from a dll on PowerPC Windows NT -On the PowerPC running Windows NT, the @code{dllexport} attribute causes -the compiler to provide a global pointer to the function pointer, so -that it can be called with the @code{dllimport} attribute. The pointer -name is formed by combining @code{__imp_} and the function name. - -@item exception (@var{except-func} [, @var{except-arg}]) -@cindex functions which specify exception handling on PowerPC Windows NT -On the PowerPC running Windows NT, the @code{exception} attribute causes -the compiler to modify the structured exception table entry it emits for -the declared function. The string or identifier @var{except-func} is -placed in the third entry of the structured exception table. It -represents a function, which is called by the exception handling -mechanism if an exception occurs. If it was specified, the string or -identifier @var{except-arg} is placed in the fourth entry of the -structured exception table. - @item function_vector @cindex calling functions through the function vector on the H8/300 processors Use this attribute on the H8/300 and H8/300H to indicate that the specified @@ -2464,9 +2431,9 @@ interrupt handler when this attribute is present. Note, interrupt handlers for the H8/300, H8/300H and SH processors can be specified via the @code{interrupt_handler} attribute. -Note, on the AVR interrupts will be enabled inside the function. +Note, on the AVR, interrupts will be enabled inside the function. -Note, for the ARM you can specify the kind of interrupt to be handled by +Note, for the ARM, you can specify the kind of interrupt to be handled by adding an optional parameter to the interrupt attribute like this: @smallexample @@ -2521,20 +2488,20 @@ slightly under 32kbytes of data. @item signal @cindex signal handler functions on the AVR processors Use this attribute on the AVR to indicate that the specified -function is an signal handler. The compiler will generate function -entry and exit sequences suitable for use in an signal handler when this -attribute is present. Interrupts will be disabled inside function. +function is a signal handler. The compiler will generate function +entry and exit sequences suitable for use in a signal handler when this +attribute is present. Interrupts will be disabled inside the function. @item naked @cindex function without a prologue/epilogue code Use this attribute on the ARM, AVR and IP2K ports to indicate that the -specified function do not need prologue/epilogue sequences generated by +specified function does not need prologue/epilogue sequences generated by the compiler. It is up to the programmer to provide these sequences. @item model (@var{model-name}) @cindex function addressability on the M32R/D Use this attribute on the M32R/D to set the addressability of an object, -and the code generated for a function. +and of the code generated for a function. The identifier @var{model-name} is one of @code{small}, @code{medium}, or @code{large}, representing each of the code models. @@ -2575,6 +2542,67 @@ use the normal calling convention based on @code{jsr} and @code{rts}. This attribute can be used to cancel the effect of the @option{-mlong-calls} option. +@item dllimport +@cindex @code{__declspec(dllimport)} +On Windows targets, the @code{dllimport} attribute causes the compiler +to reference a function or variable via a global pointer to a pointer +that is set up by the Windows dll library. The pointer name is formed by +combining @code{_imp__} and the function or variable name. The attribute +implies @code{extern} storage. + +Currently, the attribute is ignored for inlined functions. If the +attribute is applied to a symbol @emph{definition}, an error is reported. +If a symbol previously declared @code{dllimport} is later defined, the +attribute is ignored in subsequent references, and a warning is emitted. +The attribute is also overriden by a subsequent declaration as +@code{dllexport}. + +When applied to C++ classes, the attribute marks non-inlined +member functions and static data members as imports. However, the +attribute is ignored for virtual methods to allow creation of vtables +using thunks. + +On cygwin, mingw and arm-pe targets, @code{__declspec(dllimport)} is +recognized as a synonym for @code{__attribute__ ((dllimport))} for +compatibility with other Windows compilers. + +The use of the @code{dllimport} attribute on functions is not necessary, +but provides a small performance benefit by eliminating a thunk in the +dll. The use of the @code{dllimport} attribute on imported variables was +required on older versions of GNU ld, but can now be avoided by passing +the @option{--enable-auto-import} switch to ld. As with functions, using +the attribute for a variable eliminates a thunk in the dll. + +One drawback to using this attribute is that a pointer to a function or +variable marked as dllimport cannot be used as a constant address. The +attribute can be disabled for functions by setting the +@option{-mnop-fun-dllimport} flag. + +@item dllexport +@cindex @code{__declspec(dllexport)} +On Windows targets the @code{dllexport} attribute causes the compiler to +provide a global pointer to a pointer in a dll, so that it can be +referenced with the @code{dllimport} attribute. The pointer name is +formed by combining @code{_imp__} and the function or variable name. + +Currently, the @code{dllexport}attribute is ignored for inlined +functions, but export can be forced by using the +@option{-fkeep-inline-functions} flag. The attribute is also ignored for +undefined symbols. + +When applied to C++ classes. the attribute marks defined non-inlined +member functions and static data members as exports. Static consts +initialized in-class are not marked unless they are also defined +out-of-class. + +On cygwin, mingw and arm-pe targets, @code{__declspec(dllexport)} is +recognized as a synonym for @code{__attribute__ ((dllexport))} for +compatibility with other Windows compilers. + +Alternative methods for including the symbol in the dll's export table +are to use a .def file with an @code{EXPORTS} section or, with GNU ld, +using the @option{--export-all} linker flag. + @end table You can specify multiple attributes in a declaration by separating them @@ -2946,7 +2974,7 @@ This is true on many RISC machines. On more traditional machine designs, @code{__alignof__ (double)} is 4 or even 2. Some machines never actually require alignment; they allow reference to any -data type even at an odd addresses. For these machines, @code{__alignof__} +data type even at an odd address. For these machines, @code{__alignof__} reports the @emph{recommended} alignment of a type. If the operand of @code{__alignof__} is an lvalue rather than a type, @@ -2972,15 +3000,13 @@ It is an error to ask for the alignment of an incomplete type. The keyword @code{__attribute__} allows you to specify special attributes of variables or structure fields. This keyword is followed -by an attribute specification inside double parentheses. Ten -attributes are currently defined for variables: @code{aligned}, -@code{mode}, @code{nocommon}, @code{packed}, @code{section}, -@code{transparent_union}, @code{unused}, @code{deprecated}, -@code{vector_size}, and @code{weak}. Some other attributes are defined -for variables on particular target systems. Other attributes are -available for functions (@pxref{Function Attributes}) and for types -(@pxref{Type Attributes}). Other front ends might define more -attributes (@pxref{C++ Extensions,,Extensions to the C++ Language}). +by an attribute specification inside double parentheses. Some +attributes are currently defined generically for variables. +Other attributes are defined for variables on particular target +systems. Other attributes are available for functions +(@pxref{Function Attributes}) and for types (@pxref{Type Attributes}). +Other front ends might define more attributes +(@pxref{C++ Extensions,,Extensions to the C++ Language}). You may also specify attributes with @samp{__} preceding and following each keyword. This allows you to use them in header files without @@ -3064,6 +3090,40 @@ does not allow the exception to be caught, only to perform an action. It is undefined what happens if @var{cleanup_function} does not return normally. +@item common +@itemx nocommon +@cindex @code{common} attribute +@cindex @code{nocommon} attribute +@opindex fcommon +@opindex fno-common +The @code{common} attribute requests GCC to place a variable in +``common'' storage. The @code{nocommon} attribute requests the +opposite -- to allocate space for it directly. + +These attributes override the default chosen by the +@option{-fno-common} and @option{-fcommon} flags respectively. + +@item deprecated +@cindex @code{deprecated} attribute +The @code{deprecated} attribute results in a warning if the variable +is used anywhere in the source file. This is useful when identifying +variables that are expected to be removed in a future version of a +program. The warning also includes the location of the declaration +of the deprecated variable, to enable users to easily find further +information about why the variable is deprecated, or what they should +do instead. Note that the warning only occurs for uses: + +@smallexample +extern int old_var __attribute__ ((deprecated)); +extern int old_var; +int new_fn () @{ return old_var; @} +@end smallexample + +results in a warning on line 3 but not line 2. + +The @code{deprecated} attribute can also be used for functions and +types (@pxref{Function Attributes}, @pxref{Type Attributes}.) + @item mode (@var{mode}) @cindex @code{mode} attribute This attribute specifies the data type for the declaration---whichever @@ -3075,18 +3135,6 @@ indicate the mode corresponding to a one-byte integer, @samp{word} or @samp{__word__} for the mode of a one-word integer, and @samp{pointer} or @samp{__pointer__} for the mode used to represent pointers. -@item nocommon -@cindex @code{nocommon} attribute -@opindex fno-common -This attribute specifies requests GCC not to place a variable -``common'' but instead to allocate space for it directly. If you -specify the @option{-fno-common} flag, GCC will do this for all -variables. - -Specifying the @code{nocommon} attribute for a variable provides an -initialization of zeros. A variable may only be initialized in one -source file. - @item packed @cindex @code{packed} attribute The @code{packed} attribute specifies that a variable or structure field @@ -3155,7 +3203,7 @@ section, consider using the facilities of the linker instead. @item shared @cindex @code{shared} variable attribute -On Windows NT, in addition to putting variable definitions in a named +On Windows, in addition to putting variable definitions in a named section, the section can also be shared among all running copies of an executable or DLL@. For example, this small program defines shared data by putting it in a named section @code{shared} and marking the section @@ -3178,7 +3226,18 @@ You may only use the @code{shared} attribute along with @code{section} attribute with a fully initialized global definition because of the way linkers work. See @code{section} attribute for more information. -The @code{shared} attribute is only available on Windows NT@. +The @code{shared} attribute is only available on Windows@. + +@item tls_model ("@var{tls_model}") +@cindex @code{tls_model} attribute +The @code{tls_model} attribute sets thread-local storage model +(@pxref{Thread-Local}) of a particular @code{__thread} variable, +overriding @code{-ftls-model=} command line switch on a per-variable +basis. +The @var{tls_model} argument should be one of @code{global-dynamic}, +@code{local-dynamic}, @code{initial-exec} or @code{local-exec}. + +Not all targets support this attribute. @item transparent_union This attribute, attached to a function parameter which is a union, means @@ -3193,26 +3252,6 @@ This attribute, attached to a variable, means that the variable is meant to be possibly unused. GCC will not produce a warning for this variable. -@item deprecated -The @code{deprecated} attribute results in a warning if the variable -is used anywhere in the source file. This is useful when identifying -variables that are expected to be removed in a future version of a -program. The warning also includes the location of the declaration -of the deprecated variable, to enable users to easily find further -information about why the variable is deprecated, or what they should -do instead. Note that the warnings only occurs for uses: - -@smallexample -extern int old_var __attribute__ ((deprecated)); -extern int old_var; -int new_fn () @{ return old_var; @} -@end smallexample - -results in a warning on line 3 but not line 2. - -The @code{deprecated} attribute can also be used for functions and -types (@pxref{Function Attributes}, @pxref{Type Attributes}.) - @item vector_size (@var{bytes}) This attribute specifies the vector size for the variable, measured in bytes. For example, the declaration: @@ -3258,6 +3297,12 @@ Medium and large model objects may live anywhere in the 32-bit address space (the compiler will generate @code{seth/add3} instructions to load their addresses). +@item dllimport +The @code{dllimport} attribute is described in @xref{Function Attributes}. + +@item dlexport +The @code{dllexport} attribute is described in @xref{Function Attributes}. + @end table To specify multiple attributes, separate them by commas within the @@ -3378,7 +3423,7 @@ alignment. See your linker documentation for further information. @item packed This attribute, attached to an @code{enum}, @code{struct}, or -@code{union} type definition, specified that the minimum required memory +@code{union} type definition, specifies that the minimum required memory be used to represent the type. @opindex fshort-enums @@ -3407,7 +3452,7 @@ the referenced type must be respected, just as with normal pointer conversions. Second, the argument is passed to the function using the calling -conventions of first member of the transparent union, not the calling +conventions of the first member of the transparent union, not the calling conventions of the union itself. All members of the union must have the same machine representation; this is necessary for this argument passing to work properly. @@ -3619,8 +3664,9 @@ The definition in the header file will cause most calls to the function to be inlined. If any uses of the function remain, they will refer to the single copy in the library. -For future compatibility with when GCC implements ISO C99 semantics for -inline functions, it is best to use @code{static inline} only. (The +Since GCC eventually will implement ISO C99 semantics for +inline functions, it is best to use @code{static inline} only +to guarentee compatibility. (The existing semantics will remain available when @option{-std=gnu89} is specified, but eventually the default will be @option{-std=gnu99} and that will implement the C99 semantics, though it does not do so yet.) @@ -3692,7 +3738,7 @@ asm ("fsinx %[angle],%[output]" @noindent Note that the symbolic operand names have no relation whatsoever to other C identifiers. You may use any name you like, even those of -existing C symbols, but must ensure that no two operands within the same +existing C symbols, but you must ensure that no two operands within the same assembler construct use the same symbolic name. Output operand expressions must be lvalues; the compiler can check this. @@ -5689,9 +5735,7 @@ vector unsigned int vec_mulo (vector unsigned short, vector signed int vec_mulo (vector signed short, vector signed short); vector float vec_nmsub (vector float, vector float, vector float); -@end smallexample -@smallexample vector float vec_nor (vector float, vector float); vector signed int vec_nor (vector signed int, vector signed int); vector unsigned int vec_nor (vector unsigned int, vector unsigned int); @@ -6257,9 +6301,7 @@ vector signed int vec_any_eq (vector signed char, vector unsigned char); vector signed int vec_any_eq (vector signed char, vector signed char); vector signed int vec_any_eq (vector unsigned char, vector signed char); -@end smallexample -@smallexample vector signed int vec_any_eq (vector unsigned char, vector unsigned char); vector signed int vec_any_eq (vector signed short, @@ -6712,6 +6754,7 @@ The following are a set of changes to ISO/IEC 14882:1998 (aka C++98) that document the exact semantics of the language extension. @itemize @bullet +@item @b{[intro.execution]} New text after paragraph 4 diff --git a/contrib/gcc/doc/fragments.texi b/contrib/gcc/doc/fragments.texi index f9ef3d2..c9ebcf9 100644 --- a/contrib/gcc/doc/fragments.texi +++ b/contrib/gcc/doc/fragments.texi @@ -1,5 +1,5 @@ @c Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, -@c 1999, 2000, 2001 Free Software Foundation, Inc. +@c 1999, 2000, 2001, 2003 Free Software Foundation, Inc. @c This is part of the GCC manual. @c For copying conditions, see the file gcc.texi. @@ -134,12 +134,12 @@ specified, there are combinations that should not be built. In that case, set @code{MULTILIB_EXCEPTIONS} to be all of the switch exceptions in shell case syntax that should not be built. -For example, in the PowerPC embedded ABI support, it is not desirable -to build libraries compiled with the @option{-mcall-aix} option -and either of the @option{-fleading-underscore} or @option{-mlittle} options -at the same time. Therefore @code{MULTILIB_EXCEPTIONS} is set to +For example the ARM processor cannot execute both hardware floating +point instructions and the reduced size THUMB instructions at the same +time, so there is no need to build libraries with both of these +options enabled. Therefore @code{MULTILIB_EXCEPTIONS} is set to: @smallexample -*mcall-aix/*fleading-underscore* *mlittle/*mcall-aix* +*mthumb/*mhard-float* @end smallexample @findex MULTILIB_EXTRA_OPTS @@ -147,7 +147,24 @@ at the same time. Therefore @code{MULTILIB_EXCEPTIONS} is set to Sometimes it is desirable that when building multiple versions of @file{libgcc.a} certain options should always be passed on to the compiler. In that case, set @code{MULTILIB_EXTRA_OPTS} to be the list -of options to be used for all builds. +of options to be used for all builds. If you set this, you should +probably set @code{CRTSTUFF_T_CFLAGS} to a dash followed by it. + +@findex SPECS +@item SPECS +Unfortunately, setting @code{MULTILIB_EXTRA_OPTS} is not enough, since +it does not affect the build of target libraries, at least not the +build of the default multilib. One possible work-around is to use +@code{DRIVER_SELF_SPECS} to bring options from the @file{specs} file +as if they had been passed in the compiler driver command line. +However, you don't want to be adding these options after the toolchain +is installed, so you can instead tweak the @file{specs} file that will +be used during the toolchain build, while you still install the +original, built-in @file{specs}. The trick is to set @code{SPECS} to +some other filename (say @file{specs.install}), that will then be +created out of the built-in specs, and introduce a @file{Makefile} +rule to generate the @file{specs} file that's going to be used at +build time out of your @file{specs.install}. @end table @node Host Fragment diff --git a/contrib/gcc/doc/headerdirs.texi b/contrib/gcc/doc/headerdirs.texi index beac0dd..bc7f07f 100644 --- a/contrib/gcc/doc/headerdirs.texi +++ b/contrib/gcc/doc/headerdirs.texi @@ -6,28 +6,27 @@ @chapter Standard Header File Directories @code{GCC_INCLUDE_DIR} means the same thing for native and cross. It is -where GNU CC stores its private include files, and also where GNU CC -stores the fixed include files. A cross compiled GNU CC runs +where GCC stores its private include files, and also where GCC +stores the fixed include files. A cross compiled GCC runs @code{fixincludes} on the header files in @file{$(tooldir)/include}. (If the cross compilation header files need to be fixed, they must be -installed before GNU CC is built. If the cross compilation header files -are already suitable for ISO C and GNU CC, nothing special need be -done). +installed before GCC is built. If the cross compilation header files +are already suitable for GCC, nothing special need be done). @code{GPLUSPLUS_INCLUDE_DIR} means the same thing for native and cross. It is where @command{g++} looks first for header files. The C++ library installs only target independent header files in that directory. -@code{LOCAL_INCLUDE_DIR} is used only by native compilers. GNU CC +@code{LOCAL_INCLUDE_DIR} is used only by native compilers. GCC doesn't install anything there. It is normally @file{/usr/local/include}. This is where local additions to a packaged system should place header files. -@code{CROSS_INCLUDE_DIR} is used only by cross compilers. GNU CC +@code{CROSS_INCLUDE_DIR} is used only by cross compilers. GCC doesn't install anything there. @code{TOOL_INCLUDE_DIR} is used for both native and cross compilers. It -is the place for other packages to install header files that GNU CC will +is the place for other packages to install header files that GCC will use. For a cross-compiler, this is the equivalent of @file{/usr/include}. When you build a cross-compiler, @code{fixincludes} processes any header files in this directory. diff --git a/contrib/gcc/doc/include/texinfo.tex b/contrib/gcc/doc/include/texinfo.tex index a8541dc..e9293f3 100644 --- a/contrib/gcc/doc/include/texinfo.tex +++ b/contrib/gcc/doc/include/texinfo.tex @@ -3,10 +3,10 @@ % Load plain if necessary, i.e., if running under initex. \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi % -\def\texinfoversion{2002-12-26.16} +\def\texinfoversion{2003-05-04.08} % % Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, -% 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc. +% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc. % % This texinfo.tex file is free software; you can redistribute it and/or % modify it under the terms of the GNU General Public License as @@ -34,12 +34,12 @@ % ftp://tug.org/tex/texinfo.tex % (and all CTAN mirrors, see http://www.ctan.org), % and /home/gd/gnu/doc/texinfo.tex on the GNU machines. -% +% % The GNU Texinfo home page is http://www.gnu.org/software/texinfo. -% +% % The texinfo.tex in any given Texinfo distribution could well be out % of date, so if that's what you're using, please check. -% +% % Send bug reports to bug-texinfo@gnu.org. Please include including a % complete document in each bug report with which we can reproduce the % problem. Patches are, of course, greatly appreciated. @@ -56,8 +56,9 @@ % Sometimes one run after texindex suffices, and sometimes you need more % than two; texi2dvi does it as many times as necessary. % -% It is possible to adapt texinfo.tex for other languages. You can get -% the existing language-specific files from the full Texinfo distribution. +% It is possible to adapt texinfo.tex for other languages, to some +% extent. You can get the existing language-specific files from the +% full Texinfo distribution. \message{Loading texinfo [version \texinfoversion]:} @@ -70,11 +71,11 @@ \message{Basics,} \chardef\other=12 -% We never want plain's outer \+ definition in Texinfo. +% We never want plain's \outer definition of \+ in Texinfo. % For @tex, we can use \tabalign. \let\+ = \relax -% Save some parts of plain tex whose names we will redefine. +% Save some plain tex macros whose names we will redefine. \let\ptexb=\b \let\ptexbullet=\bullet \let\ptexc=\c @@ -87,10 +88,12 @@ \let\ptexgtr=> \let\ptexhat=^ \let\ptexi=\i +\let\ptexindent=\indent \let\ptexlbrace=\{ \let\ptexless=< \let\ptexplus=+ \let\ptexrbrace=\} +\let\ptexslash=\/ \let\ptexstar=\* \let\ptext=\t @@ -140,6 +143,18 @@ \ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi \ifx\putwordDeftypefun\undefined\gdef\putwordDeftypefun{Function}\fi +% In some macros, we cannot use the `\? notation---the left quote is +% in some cases the escape char. +\chardef\colonChar = `\: +\chardef\commaChar = `\, +\chardef\dotChar = `\. +\chardef\equalChar = `\= +\chardef\exclamChar= `\! +\chardef\questChar = `\? +\chardef\semiChar = `\; +\chardef\spaceChar = `\ % +\chardef\underChar = `\_ + % Ignore a token. % \def\gobble#1{} @@ -151,8 +166,9 @@ % Hyphenation fixes. \hyphenation{ap-pen-dix} -\hyphenation{mini-buf-fer mini-buf-fers} \hyphenation{eshell} +\hyphenation{mini-buf-fer mini-buf-fers} +\hyphenation{time-stamp} \hyphenation{white-space} % Margin to add to right of even pages, to left of odd pages. @@ -189,7 +205,7 @@ % add check for \lastpenalty to plain's definitions. If the last thing % we did was a \nobreak, we don't want to insert more space. -% +% \def\smallbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\smallskipamount \removelastskip\penalty-50\smallskip\fi\fi} \def\medbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\medskipamount @@ -290,7 +306,7 @@ \egroup % \vbox from first cropmarks clause \fi }% end of \shipout\vbox - }% end of group with \turnoffactive + }% end of group with \normalturnoffactive \advancepageno \ifnum\outputpenalty>-20000 \else\dosupereject\fi } @@ -469,16 +485,19 @@ \let\{=\mylbrace \let\}=\myrbrace \begingroup - % Definitions to produce actual \{ & \} command in an index. - \catcode`\{ = 12 \catcode`\} = 12 + % Definitions to produce \{ and \} commands for indices, + % and @{ and @} for the aux file. + \catcode`\{ = \other \catcode`\} = \other \catcode`\[ = 1 \catcode`\] = 2 - \catcode`\@ = 0 \catcode`\\ = 12 - @gdef@lbracecmd[\{]% - @gdef@rbracecmd[\}]% -@endgroup + \catcode`\! = 0 \catcode`\\ = \other + !gdef!lbracecmd[\{]% + !gdef!rbracecmd[\}]% + !gdef!lbraceatcmd[@{]% + !gdef!rbraceatcmd[@}]% +!endgroup % Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent -% Others are defined by plain TeX: @` @' @" @^ @~ @= @v @H. +% Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H. \let\, = \c \let\dotaccent = \. \def\ringaccent#1{{\accent23 #1}} @@ -487,7 +506,7 @@ \let\udotaccent = \d % Other special characters: @questiondown @exclamdown -% Plain TeX defines: @AA @AE @O @OE @L (and lowercase versions) @ss. +% Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss. \def\questiondown{?`} \def\exclamdown{!`} @@ -520,6 +539,9 @@ % @* forces a line break. \def\*{\hfil\break\hbox{}\ignorespaces} +% @/ allows a line break. +\let\/=\allowbreak + % @. is an end-of-sentence period. \def\.{.\spacefactor=3000 } @@ -542,6 +564,16 @@ % therefore, no glue is inserted, and the space between the headline and % the text is small, which looks bad. % +% Another complication is that the group might be very large. This can +% cause the glue on the previous page to be unduly stretched, because it +% does not have much material. In this case, it's better to add an +% explicit \vfill so that the extra space is at the bottom. The +% threshold for doing this is if the group is more than \vfilllimit +% percent of a page (\vfilllimit can be changed inside of @tex). +% +\newbox\groupbox +\def\vfilllimit{0.7} +% \def\group{\begingroup \ifnum\catcode13=\active \else \errhelp = \groupinvalidhelp @@ -555,10 +587,22 @@ % above. But it's pretty close. \def\Egroup{% \egroup % End the \vtop. + % \dimen0 is the vertical size of the group's box. + \dimen0 = \ht\groupbox \advance\dimen0 by \dp\groupbox + % \dimen2 is how much space is left on the page (more or less). + \dimen2 = \pageheight \advance\dimen2 by -\pagetotal + % if the group doesn't fit on the current page, and it's a big big + % group, force a page break. + \ifdim \dimen0 > \dimen2 + \ifdim \pagetotal < \vfilllimit\pageheight + \page + \fi + \fi + \copy\groupbox \endgroup % End the \group. }% % - \vtop\bgroup + \setbox\groupbox = \vtop\bgroup % We have to put a strut on the last line in case the @group is in % the midst of an example, rather than completely enclosing it. % Otherwise, the interline space between the last line of the group @@ -683,8 +727,7 @@ where each line of input produces a line of output.} \spacefactor=3000 } - -% @page forces the start of a new page +% @page forces the start of a new page. % \def\page{\par\vfill\supereject} @@ -733,10 +776,10 @@ where each line of input produces a line of output.} % @inmargin{TEXT [, RIGHT-TEXT]} % (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right; % else use TEXT for both). -% +% \def\inmargin#1{\parseinmargin #1,,\finish} \def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing. - \setbox0 = \hbox{\ignorespaces #2}% + \setbox0 = \hbox{\ignorespaces #2}% \ifdim\wd0 > 0pt \def\lefttext{#1}% have both texts \def\righttext{#2}% @@ -756,30 +799,36 @@ where each line of input produces a line of output.} % @include file insert text of that file as input. % Allow normal characters that we make active in the argument (a file name). \def\include{\begingroup - \catcode`\\=12 - \catcode`~=12 - \catcode`^=12 - \catcode`_=12 - \catcode`|=12 - \catcode`<=12 - \catcode`>=12 - \catcode`+=12 + \catcode`\\=\other + \catcode`~=\other + \catcode`^=\other + \catcode`_=\other + \catcode`|=\other + \catcode`<=\other + \catcode`>=\other + \catcode`+=\other \parsearg\includezzz} % Restore active chars for included file. \def\includezzz#1{\endgroup\begingroup % Read the included file in a group so nested @include's work. \def\thisfile{#1}% + \let\value=\expandablevalue \input\thisfile \endgroup} \def\thisfile{} -% @center line outputs that line, centered - -\def\center{\parsearg\centerzzz} -\def\centerzzz #1{{\advance\hsize by -\leftskip -\advance\hsize by -\rightskip -\centerline{#1}}} +% @center line +% outputs that line, centered. +% +\def\center{\parsearg\docenter} +\def\docenter#1{{% + \ifhmode \hfil\break \fi + \advance\hsize by -\leftskip + \advance\hsize by -\rightskip + \line{\hfil \ignorespaces#1\unskip \hfil}% + \ifhmode \break \fi +}} % @sp n outputs n lines of vertical space @@ -799,8 +848,9 @@ where each line of input produces a line of output.} % @paragraphindent NCHARS % We'll use ems for NCHARS, close enough. -% We cannot implement @paragraphindent asis, though. -% +% NCHARS can also be the word `asis' or `none'. +% We cannot feasibly implement @paragraphindent asis, though. +% \def\asisword{asis} % no translation, these are keywords \def\noneword{none} % @@ -835,6 +885,53 @@ where each line of input produces a line of output.} \fi } +% @firstparagraphindent WORD +% If WORD is `none', then suppress indentation of the first paragraph +% after a section heading. If WORD is `insert', then do indentat such +% paragraphs. +% +% The paragraph indentation is suppressed or not by calling +% \suppressfirstparagraphindent, which the sectioning commands do. We +% switch the definition of this back and forth according to WORD. By +% default, we suppress indentation. +% +\def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent} +\newdimen\currentparindent +% +\def\insertword{insert} +% +\def\firstparagraphindent{\parsearg\dofirstparagraphindent} +\def\dofirstparagraphindent#1{% + \def\temp{#1}% + \ifx\temp\noneword + \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent + \else\ifx\temp\insertword + \let\suppressfirstparagraphindent = \relax + \else + \errhelp = \EMsimple + \errmessage{Unknown @firstparagraphindent option `\temp'}% + \fi\fi +} + +% Here is how we actually suppress indentation. Redefine \everypar to +% \kern backwards by \parindent, and then reset itself to empty. +% +% We also make \indent itself not actually do anything until the next +% paragraph. +% +\gdef\dosuppressfirstparagraphindent{% + \gdef\indent{% + \global\let\indent=\ptexindent + \global\everypar = {}% + }% + \global\everypar = {% + \kern-\parindent + \global\let\indent=\ptexindent + \global\everypar = {}% + }% +}% + + % @asis just yields its argument. Used with @table, for example. % \def\asis#1{#1} @@ -843,17 +940,17 @@ where each line of input produces a line of output.} % We don't use $'s directly in the definition of \math because we need % to set catcodes according to plain TeX first, to allow for subscripts, % superscripts, special math chars, etc. -% +% \let\implicitmath = $%$ font-lock fix % % One complication: _ usually means subscripts, but it could also mean % an actual _ character, as in @math{@var{some_variable} + 1}. So make % _ within @math be active (mathcode "8000), and distinguish by seeing % if the current family is \slfam, which is what @var uses. -% -{\catcode95 = \active % 95 = _ +% +{\catcode\underChar = \active \gdef\mathunderscore{% - \catcode95=\active + \catcode\underChar=\active \def_{\ifnum\fam=\slfam \_\else\sb\fi}% }} % @@ -861,7 +958,7 @@ where each line of input produces a line of output.} % FYI, plain.tex uses \\ as a temporary control sequence (why?), but % this is not advertised and we don't care. Texinfo does not % otherwise define @\. -% +% % The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\. \def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi} % @@ -876,7 +973,7 @@ where each line of input produces a line of output.} % Some active characters (such as <) are spaced differently in math. % We have to reset their definitions in case the @math was an % argument to a command which set the catcodes (such as @item or @section). -% +% { \catcode`^ = \active \catcode`< = \active @@ -1002,8 +1099,8 @@ where each line of input produces a line of output.} \def\pdfmakeoutlines{{% \openin 1 \jobname.toc \ifeof 1\else\begingroup - \closein 1 - % Thanh's hack / proper braces in bookmarks + \closein 1 + % Thanh's hack / proper braces in bookmarks \edef\mylbrace{\iftrue \string{\else}\fi}\let\{=\mylbrace \edef\myrbrace{\iffalse{\else\string}\fi}\let\}=\myrbrace % @@ -1032,7 +1129,7 @@ where each line of input produces a line of output.} \let\unnumbsubsubsecentry = \subsubsecentry % % Make special characters normal for writing to the pdf file. - % + % \indexnofonts \let\tt=\relax \turnoffactive @@ -1047,7 +1144,7 @@ where each line of input produces a line of output.} \let\nextmakelinks=\makelinks \ifnum\lnkcount>0,\fi \picknum{#1}% - \startlink attr{/Border [0 0 0]} + \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{\the\pgn}}% \linkcolor #1% \advance\lnkcount by 1% @@ -1102,7 +1199,7 @@ where each line of input produces a line of output.} \ifx\first0\adn0 \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3 \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6 - \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9 + \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9 \else \ifnum0=\countA\else\makelink\fi \ifx\first.\let\next=\done\else @@ -1193,9 +1290,10 @@ where each line of input produces a line of output.} \setfont\textrm\rmshape{10}{\mainmagstep} \setfont\texttt\ttshape{10}{\mainmagstep} \fi -% Instead of cmb10, you many want to use cmbx10. +% Instead of cmb10, you may want to use cmbx10. % cmbx10 is a prettier font on its own, but cmb10 -% looks better when embedded in a line with cmr10. +% looks better when embedded in a line with cmr10 +% (in Bob's opinion). \setfont\textbf\bfshape{10}{\mainmagstep} \setfont\textit\itshape{10}{\mainmagstep} \setfont\textsl\slshape{10}{\mainmagstep} @@ -1344,7 +1442,25 @@ where each line of input produces a line of output.} \let\tensf=\smallersf \let\teni=\smalleri \let\tensy=\smallersy \let\tenttsl=\smallerttsl \resetmathfonts \setleading{9.5pt}} -\let\smallexamplefonts = \smallerfonts + +% Set the fonts to use with the @small... environments. +\let\smallexamplefonts = \smallfonts + +% About \smallexamplefonts. If we use \smallfonts (9pt), @smallexample +% can fit this many characters: +% 8.5x11=86 smallbook=72 a4=90 a5=69 +% If we use \smallerfonts (8pt), then we can fit this many characters: +% 8.5x11=90+ smallbook=80 a4=90+ a5=77 +% For me, subjectively, the few extra characters that fit aren't worth +% the additional smallness of 8pt. So I'm making the default 9pt. +% +% By the way, for comparison, here's what fits with @example (10pt): +% 8.5x11=71 smallbook=60 a4=75 a5=58 +% +% I wish we used A4 paper on this side of the Atlantic. +% +% --karl, 24jan03. + % Set up the default fonts, so we can use them for creating boxes. % @@ -1368,7 +1484,8 @@ where each line of input produces a line of output.} % \smartitalic{ARG} outputs arg in italics, followed by an italic correction % unless the following character is such as not to need one. -\def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else\/\fi\fi\fi} +\def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else + \ptexslash\fi\fi\fi} \def\smartslanted#1{{\ifusingtt\ttsl\sl #1}\futurelet\next\smartitalicx} \def\smartitalic#1{{\ifusingtt\ttsl\it #1}\futurelet\next\smartitalicx} @@ -1388,6 +1505,17 @@ where each line of input produces a line of output.} \def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation} \def\restorehyphenation{\hyphenchar\font = `- } +% Set sfcode to normal for the chars that usually have another value. +% Can't use plain's \frenchspacing because it uses the `\x notation, and +% sometimes \x has an active definition that messes things up. +% +\catcode`@=11 + \def\frenchspacing{% + \sfcode\dotChar =\@m \sfcode\questChar=\@m \sfcode\exclamChar=\@m + \sfcode\colonChar=\@m \sfcode\semiChar =\@m \sfcode\commaChar =\@m + } +\catcode`@=\other + \def\t#1{% {\tt \rawbackslash \frenchspacing #1}% \null @@ -1487,15 +1615,17 @@ where each line of input produces a line of output.} \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}% \else\ifx\arg\wordcode \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}% + \else + \errhelp = \EMsimple + \errmessage{Unknown @kbdinputstyle option `\arg'}% \fi\fi\fi } \def\worddistinct{distinct} \def\wordexample{example} \def\wordcode{code} -% Default is kbdinputdistinct. (Too much of a hassle to call the macro, -% the catcodes are wrong for parsearg to work.) -\gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl} +% Default is `distinct.' +\kbdinputstyle distinct \def\xkey{\key} \def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}% @@ -1538,7 +1668,7 @@ where each line of input produces a line of output.} % rms does not like angle brackets --karl, 17may97. % So now @email is just like @uref, unless we are pdf. -% +% %\def\email#1{\angleleft{\tt #1}\angleright} \ifpdf \def\email#1{\doemail#1,,\finish} @@ -1583,6 +1713,16 @@ where each line of input produces a line of output.} % @pounds{} is a sterling sign. \def\pounds{{\it\$}} +% @registeredsymbol - R in a circle. For now, only works in text size; +% we'd have to redo the font mechanism to change the \scriptstyle and +% \scriptscriptstyle font sizes to make it look right in headings. +% Adapted from the plain.tex definition of \copyright. +% +\def\registeredsymbol{% + $^{{\ooalign{\hfil\raise.07ex\hbox{$\scriptstyle\rm R$}\hfil\crcr\Orb}}% + }$% +} + \message{page headings,} @@ -1995,23 +2135,21 @@ where each line of input produces a line of output.} \itemizey {#1}{\Eitemize} } -\def\itemizey #1#2{% -\aboveenvbreak % -\itemmax=\itemindent % -\advance \itemmax by -\itemmargin % -\advance \leftskip by \itemindent % -\exdentamount=\itemindent -\parindent = 0pt % -\parskip = \smallskipamount % -\ifdim \parskip=0pt \parskip=2pt \fi% -\def#2{\endgraf\afterenvbreak\endgroup}% -\def\itemcontents{#1}% -\let\item=\itemizeitem} - -% Set sfcode to normal for the chars that usually have another value. -% These are `.?!:;,' -\def\frenchspacing{\sfcode46=1000 \sfcode63=1000 \sfcode33=1000 - \sfcode58=1000 \sfcode59=1000 \sfcode44=1000 } +\def\itemizey#1#2{% + \aboveenvbreak + \itemmax=\itemindent + \advance\itemmax by -\itemmargin + \advance\leftskip by \itemindent + \exdentamount=\itemindent + \parindent=0pt + \parskip=\smallskipamount + \ifdim\parskip=0pt \parskip=2pt \fi + \def#2{\endgraf\afterenvbreak\endgroup}% + \def\itemcontents{#1}% + % @itemize with no arg is equivalent to @itemize @bullet. + \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi + \let\item=\itemizeitem +} % \splitoff TOKENS\endmark defines \first to be the first token in % TOKENS, and \rest to be the remainder. @@ -2234,8 +2372,8 @@ where each line of input produces a line of output.} \let\go\pickupwholefraction \else \global\advance\colcount by 1 - \setbox0=\hbox{#1\unskip }% Add a normal word space as a separator; - % typically that is always in the input, anyway. + \setbox0=\hbox{#1\unskip\space}% Add a normal word space as a + % separator; typically that is always in the input, anyway. \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}% \fi \fi @@ -2250,18 +2388,18 @@ where each line of input produces a line of output.} \go } -% This used to have \hskip1sp. But then the space in a template line is -% not enough. That is bad. So let's go back to just & until we -% encounter the problem it was intended to solve again. -% --karl, nathan@acm.org, 20apr99. -\def\tab{&} - % @multitable ... @end multitable definitions: % \def\multitable{\parsearg\dotable} \def\dotable#1{\bgroup \vskip\parskip - \let\item\crcr + \let\item=\crcrwithfootnotes + % A \tab used to include \hskip1sp. But then the space in a template + % line is not enough. That is bad. So let's go back to just & until + % we encounter the problem it was intended to solve again. --karl, + % nathan@acm.org, 20apr99. + \let\tab=&% + \let\startfootins=\startsavedfootnote \tolerance=9500 \hbadness=9500 \setmultitablespacing @@ -2269,7 +2407,11 @@ where each line of input produces a line of output.} \parindent=\multitableparindent \overfullrule=0pt \global\colcount=0 - \def\Emultitable{\global\setpercentfalse\cr\egroup\egroup}% + \def\Emultitable{% + \global\setpercentfalse + \crcrwithfootnotes\crcr + \egroup\egroup + }% % % To parse everything between @multitable and @item: \setuptable#1 \endsetuptable @@ -2358,6 +2500,25 @@ width0pt\relax} \fi %% than skip between lines in the table. \fi} +% In case a @footnote appears inside an alignment, save the footnote +% text to a box and make the \insert when a row of the table is +% finished. Otherwise, the insertion is lost, it never migrates to the +% main vertical list. --kasal, 22jan03. +% +\newbox\savedfootnotes +% +% \dotable \let's \startfootins to this, so that \dofootnote will call +% it instead of starting the insertion right away. +\def\startsavedfootnote{% + \global\setbox\savedfootnotes = \vbox\bgroup + \unvbox\savedfootnotes +} +\def\crcrwithfootnotes{% + \crcr + \ifvoid\savedfootnotes \else + \noalign{\insert\footins{\box\savedfootnotes}}% + \fi +} \message{conditionals,} % Prevent errors for section commands. @@ -2393,50 +2554,101 @@ width0pt\relax} \fi % and so want to turn off most commands, in case they are used % incorrectly. % +% We use \empty instead of \relax for the @def... commands, so that \end +% doesn't throw an error. For instance: +% @ignore +% @deffn ... +% @end deffn +% @end ignore +% +% The @end deffn is going to get expanded, because we're trying to allow +% nested conditionals. But we don't want to expand the actual @deffn, +% since it might be syntactically correct and intended to be ignored. +% Since \end checks for \relax, using \empty does not cause an error. +% \def\ignoremorecommands{% \let\defcodeindex = \relax - \let\defcv = \relax - \let\deffn = \relax - \let\deffnx = \relax + \let\defcv = \empty + \let\defcvx = \empty + \let\Edefcv = \empty + \let\deffn = \empty + \let\deffnx = \empty + \let\Edeffn = \empty \let\defindex = \relax - \let\defivar = \relax - \let\defmac = \relax - \let\defmethod = \relax - \let\defop = \relax - \let\defopt = \relax - \let\defspec = \relax - \let\deftp = \relax - \let\deftypefn = \relax - \let\deftypefun = \relax - \let\deftypeivar = \relax - \let\deftypeop = \relax - \let\deftypevar = \relax - \let\deftypevr = \relax - \let\defun = \relax - \let\defvar = \relax - \let\defvr = \relax - \let\ref = \relax - \let\xref = \relax - \let\printindex = \relax - \let\pxref = \relax - \let\settitle = \relax - \let\setchapternewpage = \relax - \let\setchapterstyle = \relax - \let\everyheading = \relax + \let\defivar = \empty + \let\defivarx = \empty + \let\Edefivar = \empty + \let\defmac = \empty + \let\defmacx = \empty + \let\Edefmac = \empty + \let\defmethod = \empty + \let\defmethodx = \empty + \let\Edefmethod = \empty + \let\defop = \empty + \let\defopx = \empty + \let\Edefop = \empty + \let\defopt = \empty + \let\defoptx = \empty + \let\Edefopt = \empty + \let\defspec = \empty + \let\defspecx = \empty + \let\Edefspec = \empty + \let\deftp = \empty + \let\deftpx = \empty + \let\Edeftp = \empty + \let\deftypefn = \empty + \let\deftypefnx = \empty + \let\Edeftypefn = \empty + \let\deftypefun = \empty + \let\deftypefunx = \empty + \let\Edeftypefun = \empty + \let\deftypeivar = \empty + \let\deftypeivarx = \empty + \let\Edeftypeivar = \empty + \let\deftypemethod = \empty + \let\deftypemethodx = \empty + \let\Edeftypemethod = \empty + \let\deftypeop = \empty + \let\deftypeopx = \empty + \let\Edeftypeop = \empty + \let\deftypevar = \empty + \let\deftypevarx = \empty + \let\Edeftypevar = \empty + \let\deftypevr = \empty + \let\deftypevrx = \empty + \let\Edeftypevr = \empty + \let\defun = \empty + \let\defunx = \empty + \let\Edefun = \empty + \let\defvar = \empty + \let\defvarx = \empty + \let\Edefvar = \empty + \let\defvr = \empty + \let\defvrx = \empty + \let\Edefvr = \empty + \let\clear = \relax + \let\down = \relax + \let\evenfooting = \relax \let\evenheading = \relax - \let\oddheading = \relax \let\everyfooting = \relax - \let\evenfooting = \relax - \let\oddfooting = \relax + \let\everyheading = \relax \let\headings = \relax \let\include = \relax + \let\item = \relax \let\lowersections = \relax - \let\down = \relax + \let\oddfooting = \relax + \let\oddheading = \relax + \let\printindex = \relax + \let\pxref = \relax \let\raisesections = \relax - \let\up = \relax + \let\ref = \relax \let\set = \relax - \let\clear = \relax - \let\item = \relax + \let\setchapternewpage = \relax + \let\setchapterstyle = \relax + \let\settitle = \relax + \let\up = \relax + \let\verbatiminclude = \relax + \let\xref = \relax } % Ignore @ignore, @ifhtml, @ifinfo, and the like. @@ -2470,7 +2682,7 @@ width0pt\relax} \fi \long\def\doignoretext##1@end #1{\enddoignore}% % % Make sure that spaces turn into tokens that match what \doignoretext wants. - \catcode32 = 10 + \catcode\spaceChar = 10 % % Ignore braces, too, so mismatched braces don't cause trouble. \catcode`\{ = 9 @@ -2535,7 +2747,7 @@ width0pt\relax} \fi % command, so that nested ignore constructs work. Thus, we put the % text into a \vbox and then do nothing with the result. To minimize % the chance of memory overflow, we follow the approach outlined on - % page 401 of the TeXbook: make the current font be a dummy font. + % page 401 of the TeXbook. % \setbox0 = \vbox\bgroup % Don't complain about control sequences we have declared \outer. @@ -2556,8 +2768,8 @@ width0pt\relax} \fi % % Set the current font to be \nullfont, a TeX primitive, and define % all the font commands to also use \nullfont. We don't use - % dummy.tfm, as suggested in the TeXbook, because not all sites - % might have that installed. Therefore, math mode will still + % dummy.tfm, as suggested in the TeXbook, because some sites + % might not have that installed. Therefore, math mode will still % produce output, but that should be an extremely small amount of % stuff compared to the main input. % @@ -2631,7 +2843,7 @@ width0pt\relax} \fi % we're called from @code, as @code{@value{foo-bar_}}. So \let any % such active characters to their normal equivalents. \gdef\value{\begingroup - \catcode`\-=12 \catcode`\_=12 + \catcode`\-=\other \catcode`\_=\other \indexbreaks \let_\normalunderscore \valuexxx} } @@ -2640,15 +2852,17 @@ width0pt\relax} \fi % We have this subroutine so that we can handle at least some @value's % properly in indexes (we \let\value to this in \indexdummies). Ones % whose names contain - or _ still won't work, but we can't do anything -% about that. The command has to be fully expandable, since the result -% winds up in the index file. This means that if the variable's value -% contains other Texinfo commands, it's almost certain it will fail -% (although perhaps we could fix that with sufficient work to do a -% one-level expansion on the result, instead of complete). +% about that. The command has to be fully expandable (if the variable +% is set), since the result winds up in the index file. This means that +% if the variable's value contains other Texinfo commands, it's almost +% certain it will fail (although perhaps we could fix that with +% sufficient work to do a one-level expansion on the result, instead of +% complete). % \def\expandablevalue#1{% \expandafter\ifx\csname SET#1\endcsname\relax {[No value for ``#1'']}% + \message{Variable `#1', used in @value, is not set.}% \else \csname SET#1\endcsname \fi @@ -2657,13 +2871,14 @@ width0pt\relax} \fi % @ifset VAR ... @end ifset reads the `...' iff VAR has been defined % with @set. % -\def\ifset{\parsearg\ifsetxxx} -\def\ifsetxxx #1{% +\def\ifset{\parsearg\doifset} +\def\doifset#1{% \expandafter\ifx\csname SET#1\endcsname\relax - \expandafter\ifsetfail + \let\next=\ifsetfail \else - \expandafter\ifsetsucceed + \let\next=\ifsetsucceed \fi + \next } \def\ifsetsucceed{\conditionalsucceed{ifset}} \def\ifsetfail{\nestedignore{ifset}} @@ -2672,13 +2887,14 @@ width0pt\relax} \fi % @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been % defined with @set, or has been undefined with @clear. % -\def\ifclear{\parsearg\ifclearxxx} -\def\ifclearxxx #1{% +\def\ifclear{\parsearg\doifclear} +\def\doifclear#1{% \expandafter\ifx\csname SET#1\endcsname\relax - \expandafter\ifclearsucceed + \let\next=\ifclearsucceed \else - \expandafter\ifclearfail + \let\next=\ifclearfail \fi + \next } \def\ifclearsucceed{\conditionalsucceed{ifclear}} \def\ifclearfail{\nestedignore{ifclear}} @@ -2697,28 +2913,13 @@ width0pt\relax} \fi \defineunmatchedend{ifnotinfo} \defineunmatchedend{ifnotplaintext} -% We can't just want to start a group at @iftex (etc.) and end it at -% @end iftex, since then @set commands inside the conditional have no -% effect (they'd get reverted at the end of the group). So we must -% define \Eiftex to redefine itself to be its previous value. (We can't -% just define it to fail again with an ``unmatched end'' error, since -% the @ifset might be nested.) -% -\def\conditionalsucceed#1{% - \edef\temp{% - % Remember the current value of \E#1. - \let\nece{prevE#1} = \nece{E#1}% - % - % At the `@end #1', redefine \E#1 to be its previous value. - \def\nece{E#1}{\let\nece{E#1} = \nece{prevE#1}}% - }% - \temp -} - -% We need to expand lots of \csname's, but we don't want to expand the -% control sequences after we've constructed them. +% True conditional. Since \set globally defines its variables, we can +% just start and end a group (to keep the @end definition undefined at +% the outer level). % -\def\nece#1{\expandafter\noexpand\csname#1\endcsname} +\def\conditionalsucceed#1{\begingroup + \expandafter\def\csname E#1\endcsname{\endgroup}% +} % @defininfoenclose. \let\definfoenclose=\comment @@ -2769,10 +2970,10 @@ width0pt\relax} \fi % @synindex foo bar makes index foo feed into index bar. % Do this instead of @defindex foo if you don't want it as a separate index. -% +% % @syncodeindex foo bar similar, but put all entries made for index foo % inside @code. -% +% \def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}} \def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}} @@ -2811,104 +3012,166 @@ width0pt\relax} \fi \def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer} \def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}} -% Take care of texinfo commands likely to appear in an index entry. -% (Must be a way to avoid doing expansion at all, and thus not have to -% laboriously list every single command here.) -% +% Take care of Texinfo commands that can appear in an index entry. +% Since there are some commands we want to expand, and others we don't, +% we have to laboriously prevent expansion for those that we don't. +% \def\indexdummies{% -\def\ { }% -\def\@{@}% change to @@ when we switch to @ as escape char in aux files. -% Need these in case \tex is in effect and \{ is a \delimiter again. -% But can't use \lbracecmd and \rbracecmd because texindex assumes -% braces and backslashes are used only as delimiters. -\let\{ = \mylbrace -\let\} = \myrbrace -\def\_{{\realbackslash _}}% -\normalturnoffactive -% -% Take care of the plain tex accent commands. -\def\,##1{\realbackslash ,{##1}}% -\def\"{\realbackslash "}% -\def\`{\realbackslash `}% -\def\'{\realbackslash '}% -\def\^{\realbackslash ^}% -\def\~{\realbackslash ~}% -\def\={\realbackslash =}% -\def\b{\realbackslash b}% -\def\c{\realbackslash c}% -\def\d{\realbackslash d}% -\def\u{\realbackslash u}% -\def\v{\realbackslash v}% -\def\H{\realbackslash H}% -\def\dotless##1{\realbackslash dotless {##1}}% -% Take care of the plain tex special European modified letters. -\def\AA{\realbackslash AA}% -\def\AE{\realbackslash AE}% -\def\L{\realbackslash L}% -\def\OE{\realbackslash OE}% -\def\O{\realbackslash O}% -\def\aa{\realbackslash aa}% -\def\ae{\realbackslash ae}% -\def\l{\realbackslash l}% -\def\oe{\realbackslash oe}% -\def\o{\realbackslash o}% -\def\ss{\realbackslash ss}% -% -% Although these internals commands shouldn't show up, sometimes they do. -\def\bf{\realbackslash bf }% -\def\gtr{\realbackslash gtr}% -\def\hat{\realbackslash hat}% -\def\less{\realbackslash less}% -%\def\rm{\realbackslash rm }% -\def\sf{\realbackslash sf}% -\def\sl{\realbackslash sl }% -\def\tclose##1{\realbackslash tclose {##1}}% -\def\tt{\realbackslash tt}% -% -\def\b##1{\realbackslash b {##1}}% -\def\i##1{\realbackslash i {##1}}% -\def\sc##1{\realbackslash sc {##1}}% -\def\t##1{\realbackslash t {##1}}% -\def\r##1{\realbackslash r {##1}}% -% -\def\TeX{\realbackslash TeX}% -\def\acronym##1{\realbackslash acronym {##1}}% -\def\cite##1{\realbackslash cite {##1}}% -\def\code##1{\realbackslash code {##1}}% -\def\command##1{\realbackslash command {##1}}% -\def\dfn##1{\realbackslash dfn {##1}}% -\def\dots{\realbackslash dots }% -\def\emph##1{\realbackslash emph {##1}}% -\def\env##1{\realbackslash env {##1}}% -\def\file##1{\realbackslash file {##1}}% -\def\kbd##1{\realbackslash kbd {##1}}% -\def\key##1{\realbackslash key {##1}}% -\def\math##1{\realbackslash math {##1}}% -\def\option##1{\realbackslash option {##1}}% -\def\samp##1{\realbackslash samp {##1}}% -\def\strong##1{\realbackslash strong {##1}}% -\def\uref##1{\realbackslash uref {##1}}% -\def\url##1{\realbackslash url {##1}}% -\def\var##1{\realbackslash var {##1}}% -\def\w{\realbackslash w }% -% -% These math commands don't seem likely to be used in index entries. -\def\copyright{\realbackslash copyright}% -\def\equiv{\realbackslash equiv}% -\def\error{\realbackslash error}% -\def\expansion{\realbackslash expansion}% -\def\point{\realbackslash point}% -\def\print{\realbackslash print}% -\def\result{\realbackslash result}% -% -% Handle some cases of @value -- where the variable name does not -% contain - or _, and the value does not contain any -% (non-fully-expandable) commands. -\let\value = \expandablevalue -% -\unsepspaces -% Turn off macro expansion -\turnoffmacros + \def\@{@}% change to @@ when we switch to @ as escape char in index files. + \def\ {\realbackslash\space }% + % Need these in case \tex is in effect and \{ is a \delimiter again. + % But can't use \lbracecmd and \rbracecmd because texindex assumes + % braces and backslashes are used only as delimiters. + \let\{ = \mylbrace + \let\} = \myrbrace + % + % \definedummyword defines \#1 as \realbackslash #1\space, thus + % effectively preventing its expansion. This is used only for control + % words, not control letters, because the \space would be incorrect + % for control characters, but is needed to separate the control word + % from whatever follows. + % + % For control letters, we have \definedummyletter, which omits the + % space. + % + % These can be used both for control words that take an argument and + % those that do not. If it is followed by {arg} in the input, then + % that will dutifully get written to the index (or wherever). + % + \def\definedummyword##1{% + \expandafter\def\csname ##1\endcsname{\realbackslash ##1\space}% + }% + \def\definedummyletter##1{% + \expandafter\def\csname ##1\endcsname{\realbackslash ##1}% + }% + % + % Do the redefinitions. + \commondummies +} + +% For the aux file, @ is the escape character. So we want to redefine +% everything using @ instead of \realbackslash. When everything uses +% @, this will be simpler. +% +\def\atdummies{% + \def\@{@@}% + \def\ {@ }% + \let\{ = \lbraceatcmd + \let\} = \rbraceatcmd + % + % (See comments in \indexdummies.) + \def\definedummyword##1{% + \expandafter\def\csname ##1\endcsname{@##1\space}% + }% + \def\definedummyletter##1{% + \expandafter\def\csname ##1\endcsname{@##1}% + }% + % + % Do the redefinitions. + \commondummies +} + +% Called from \indexdummies and \atdummies. \definedummyword and +% \definedummyletter must be defined first. +% +\def\commondummies{% + % + \normalturnoffactive + % + % Control letters and accents. + \definedummyletter{_}% + \definedummyletter{,}% + \definedummyletter{"}% + \definedummyletter{`}% + \definedummyletter{'}% + \definedummyletter{^}% + \definedummyletter{~}% + \definedummyletter{=}% + \definedummyword{u}% + \definedummyword{v}% + \definedummyword{H}% + \definedummyword{dotaccent}% + \definedummyword{ringaccent}% + \definedummyword{tieaccent}% + \definedummyword{ubaraccent}% + \definedummyword{udotaccent}% + \definedummyword{dotless}% + % + % Other non-English letters. + \definedummyword{AA}% + \definedummyword{AE}% + \definedummyword{L}% + \definedummyword{OE}% + \definedummyword{O}% + \definedummyword{aa}% + \definedummyword{ae}% + \definedummyword{l}% + \definedummyword{oe}% + \definedummyword{o}% + \definedummyword{ss}% + % + % Although these internal commands shouldn't show up, sometimes they do. + \definedummyword{bf}% + \definedummyword{gtr}% + \definedummyword{hat}% + \definedummyword{less}% + \definedummyword{sf}% + \definedummyword{sl}% + \definedummyword{tclose}% + \definedummyword{tt}% + % + % Texinfo font commands. + \definedummyword{b}% + \definedummyword{i}% + \definedummyword{r}% + \definedummyword{sc}% + \definedummyword{t}% + % + \definedummyword{TeX}% + \definedummyword{acronym}% + \definedummyword{cite}% + \definedummyword{code}% + \definedummyword{command}% + \definedummyword{dfn}% + \definedummyword{dots}% + \definedummyword{emph}% + \definedummyword{env}% + \definedummyword{file}% + \definedummyword{kbd}% + \definedummyword{key}% + \definedummyword{math}% + \definedummyword{option}% + \definedummyword{samp}% + \definedummyword{strong}% + \definedummyword{uref}% + \definedummyword{url}% + \definedummyword{var}% + \definedummyword{w}% + % + % Assorted special characters. + \definedummyword{bullet}% + \definedummyword{copyright}% + \definedummyword{dots}% + \definedummyword{enddots}% + \definedummyword{equiv}% + \definedummyword{error}% + \definedummyword{expansion}% + \definedummyword{minus}% + \definedummyword{pounds}% + \definedummyword{point}% + \definedummyword{print}% + \definedummyword{result}% + % + % Handle some cases of @value -- where the variable name does not + % contain - or _, and the value does not contain any + % (non-fully-expandable) commands. + \let\value = \expandablevalue + % + % Normal spaces, not active ones. + \unsepspaces + % + % No macro expansion. + \turnoffmacros } % If an index command is used in an @example environment, any spaces @@ -2917,83 +3180,86 @@ width0pt\relax} \fi {\obeyspaces \gdef\unsepspaces{\obeyspaces\let =\space}} -% \indexnofonts no-ops all font-change commands. -% This is used when outputting the strings to sort the index by. -\def\indexdummyfont#1{#1} + +% \indexnofonts is used when outputting the strings to sort the index +% by, and when constructing control sequence names. It eliminates all +% control sequences and just writes whatever the best ASCII sort string +% would be for a given command (usually its argument). +% \def\indexdummytex{TeX} \def\indexdummydots{...} - +% \def\indexnofonts{% -\def\@{@}% -% how to handle braces? -\def\_{\normalunderscore}% -% -\let\,=\indexdummyfont -\let\"=\indexdummyfont -\let\`=\indexdummyfont -\let\'=\indexdummyfont -\let\^=\indexdummyfont -\let\~=\indexdummyfont -\let\==\indexdummyfont -\let\b=\indexdummyfont -\let\c=\indexdummyfont -\let\d=\indexdummyfont -\let\u=\indexdummyfont -\let\v=\indexdummyfont -\let\H=\indexdummyfont -\let\dotless=\indexdummyfont -% Take care of the plain tex special European modified letters. -\def\AA{AA}% -\def\AE{AE}% -\def\L{L}% -\def\OE{OE}% -\def\O{O}% -\def\aa{aa}% -\def\ae{ae}% -\def\l{l}% -\def\oe{oe}% -\def\o{o}% -\def\ss{ss}% -% -% Don't no-op \tt, since it isn't a user-level command -% and is used in the definitions of the active chars like <, >, |, etc. -% Likewise with the other plain tex font commands. -%\let\tt=\indexdummyfont -% -\let\b=\indexdummyfont -\let\i=\indexdummyfont -\let\r=\indexdummyfont -\let\sc=\indexdummyfont -\let\t=\indexdummyfont -% -\let\TeX=\indexdummytex -\let\acronym=\indexdummyfont -\let\cite=\indexdummyfont -\let\code=\indexdummyfont -\let\command=\indexdummyfont -\let\dfn=\indexdummyfont -\let\dots=\indexdummydots -\let\emph=\indexdummyfont -\let\env=\indexdummyfont -\let\file=\indexdummyfont -\let\kbd=\indexdummyfont -\let\key=\indexdummyfont -\let\math=\indexdummyfont -\let\option=\indexdummyfont -\let\samp=\indexdummyfont -\let\strong=\indexdummyfont -\let\uref=\indexdummyfont -\let\url=\indexdummyfont -\let\var=\indexdummyfont -\let\w=\indexdummyfont -} - -% To define \realbackslash, we must make \ not be an escape. -% We must first make another character (@) an escape -% so we do not become unable to do a definition. - -{\catcode`\@=0 \catcode`\\=\other - @gdef@realbackslash{\}} + \def\ { }% + \def\@{@}% + % how to handle braces? + \def\_{\normalunderscore}% + % + \let\,=\asis + \let\"=\asis + \let\`=\asis + \let\'=\asis + \let\^=\asis + \let\~=\asis + \let\==\asis + \let\u=\asis + \let\v=\asis + \let\H=\asis + \let\dotaccent=\asis + \let\ringaccent=\asis + \let\tieaccent=\asis + \let\ubaraccent=\asis + \let\udotaccent=\asis + \let\dotless=\asis + % + % Other non-English letters. + \def\AA{AA}% + \def\AE{AE}% + \def\L{L}% + \def\OE{OE}% + \def\O{O}% + \def\aa{aa}% + \def\ae{ae}% + \def\l{l}% + \def\oe{oe}% + \def\o{o}% + \def\ss{ss}% + \def\exclamdown{!}% + \def\questiondown{?}% + % + % Don't no-op \tt, since it isn't a user-level command + % and is used in the definitions of the active chars like <, >, |, etc. + % Likewise with the other plain tex font commands. + %\let\tt=\asis + % + % Texinfo font commands. + \let\b=\asis + \let\i=\asis + \let\r=\asis + \let\sc=\asis + \let\t=\asis + % + \let\TeX=\indexdummytex + \let\acronym=\asis + \let\cite=\asis + \let\code=\asis + \let\command=\asis + \let\dfn=\asis + \let\dots=\indexdummydots + \let\emph=\asis + \let\env=\asis + \let\file=\asis + \let\kbd=\asis + \let\key=\asis + \let\math=\asis + \let\option=\asis + \let\samp=\asis + \let\strong=\asis + \let\uref=\asis + \let\url=\asis + \let\var=\asis + \let\w=\asis +} \let\indexbackslash=0 %overridden during \printindex. \let\SETmarginindex=\relax % put index entries in margin (undocumented)? @@ -3025,28 +3291,24 @@ width0pt\relax} \fi \def\rawbackslashxx{\indexbackslash}% \indexbackslash isn't defined now % so it will be output as is; and it will print as backslash. % - \def\thirdarg{#3}% - % - % If third arg is present, precede it with space in sort key. - \ifx\thirdarg\emptymacro - \let\subentry = \empty - \else - \def\subentry{ #3}% - \fi - % - % First process the index entry with all font commands turned - % off to get the string to sort by. - {\indexnofonts \xdef\indexsorttmp{#2\subentry}}% - % - % Now the real index entry with the fonts. + % The main index entry text. \toks0 = {#2}% % - % If the third (subentry) arg is present, add it to the index - % line to write. + % If third arg is present, precede it with space in sort key. + \def\thirdarg{#3}% \ifx\thirdarg\emptymacro \else - \toks0 = \expandafter{\the\toks0{#3}}% + % If the third (subentry) arg is present, add it to the index + % line to write. + \toks0 = \expandafter{\the\toks0 \space #3}% \fi % + % Process the index entry with all font commands turned off, to + % get the string to sort by. + {\indexnofonts + \edef\temp{\the\toks0}% need full expansion + \xdef\indexsorttmp{\temp}% + }% + % % Set up the complete index entry, with both the sort key and % the original text, including any font commands. We write % three arguments to \entry to the .?? file (four in the @@ -3077,12 +3339,11 @@ width0pt\relax} \fi \iflinks \ifvmode \skip0 = \lastskip - \ifdim\lastskip = 0pt \else \nobreak\vskip-\lastskip \fi + \ifdim\lastskip = 0pt \else \nobreak\vskip-\skip0 \fi \fi % \temp % do the write % - % \ifvmode \ifdim\skip0 = 0pt \else \nobreak\vskip\skip0 \fi \fi \fi }% @@ -3132,6 +3393,7 @@ width0pt\relax} \fi % \smallfonts \rm \tolerance = 9500 + \everypar = {}% don't want the \kern\-parindent from indentation suppression. \indexbreaks % % See if the index file exists and is nonempty. @@ -3375,7 +3637,7 @@ width0pt\relax} \fi \wd0=\hsize \wd2=\hsize \hbox to\pagewidth{\box0\hfil\box2}% } -% +% % All done with double columns. \def\enddoublecolumns{% \output = {% @@ -3513,6 +3775,7 @@ width0pt\relax} \fi \numberedsubsubseczzz{#2} \fi \fi +\suppressfirstparagraphindent } % like \numhead, but chooses appendix heading levels @@ -3532,6 +3795,7 @@ width0pt\relax} \fi \appendixsubsubseczzz{#2} \fi \fi +\suppressfirstparagraphindent } % like \numhead, but chooses numberless heading levels @@ -3551,6 +3815,7 @@ width0pt\relax} \fi \unnumberedsubsubseczzz{#2} \fi \fi +\suppressfirstparagraphindent } % @chapter, @appendix, @unnumbered. @@ -3558,22 +3823,19 @@ width0pt\relax} \fi \outer\def\chapter{\parsearg\chapteryyy} \def\chapteryyy #1{\numhead0{#1}} % normally numhead0 calls chapterzzz \def\chapterzzz #1{% -\secno=0 \subsecno=0 \subsubsecno=0 -\global\advance \chapno by 1 \message{\putwordChapter\space \the\chapno}% -\chapmacro {#1}{\the\chapno}% -\gdef\thissection{#1}% -\gdef\thischaptername{#1}% -% We don't substitute the actual chapter name into \thischapter -% because we don't want its macros evaluated now. -\xdef\thischapter{\putwordChapter{} \the\chapno: \noexpand\thischaptername}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash chapentry{\the\toks0}% - {\the\chapno}}}% -\temp -\donoderef -\global\let\section = \numberedsec -\global\let\subsection = \numberedsubsec -\global\let\subsubsection = \numberedsubsubsec + \secno=0 \subsecno=0 \subsubsecno=0 + \global\advance \chapno by 1 \message{\putwordChapter\space \the\chapno}% + \chapmacro {#1}{\the\chapno}% + \gdef\thissection{#1}% + \gdef\thischaptername{#1}% + % We don't substitute the actual chapter name into \thischapter + % because we don't want its macros evaluated now. + \xdef\thischapter{\putwordChapter{} \the\chapno: \noexpand\thischaptername}% + \writetocentry{chap}{#1}{{\the\chapno}} + \donoderef + \global\let\section = \numberedsec + \global\let\subsection = \numberedsubsec + \global\let\subsubsection = \numberedsubsubsec } % we use \chapno to avoid indenting back @@ -3584,21 +3846,18 @@ width0pt\relax} \fi \outer\def\appendix{\parsearg\appendixyyy} \def\appendixyyy #1{\apphead0{#1}} % normally apphead0 calls appendixzzz \def\appendixzzz #1{% -\secno=0 \subsecno=0 \subsubsecno=0 -\global\advance \appendixno by 1 -\message{\putwordAppendix\space \appendixletter}% -\chapmacro {#1}{\appendixbox{\putwordAppendix{} \appendixletter}}% -\gdef\thissection{#1}% -\gdef\thischaptername{#1}% -\xdef\thischapter{\putwordAppendix{} \appendixletter: \noexpand\thischaptername}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash appendixentry{\the\toks0}% - {\appendixletter}}}% -\temp -\appendixnoderef -\global\let\section = \appendixsec -\global\let\subsection = \appendixsubsec -\global\let\subsubsection = \appendixsubsubsec + \secno=0 \subsecno=0 \subsubsecno=0 + \global\advance \appendixno by 1 + \message{\putwordAppendix\space \appendixletter}% + \chapmacro {#1}{\appendixbox{\putwordAppendix{} \appendixletter}}% + \gdef\thissection{#1}% + \gdef\thischaptername{#1}% + \xdef\thischapter{\putwordAppendix{} \appendixletter: \noexpand\thischaptername}% + \writetocentry{appendix}{#1}{{\appendixletter}} + \appendixnoderef + \global\let\section = \appendixsec + \global\let\subsection = \appendixsubsec + \global\let\subsubsection = \appendixsubsubsec } % @centerchap is like @unnumbered, but the heading is centered. @@ -3611,150 +3870,121 @@ width0pt\relax} \fi \outer\def\unnumbered{\parsearg\unnumberedyyy} \def\unnumberedyyy #1{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz \def\unnumberedzzz #1{% -\secno=0 \subsecno=0 \subsubsecno=0 -% -% This used to be simply \message{#1}, but TeX fully expands the -% argument to \message. Therefore, if #1 contained @-commands, TeX -% expanded them. For example, in `@unnumbered The @cite{Book}', TeX -% expanded @cite (which turns out to cause errors because \cite is meant -% to be executed, not expanded). -% -% Anyway, we don't want the fully-expanded definition of @cite to appear -% as a result of the \message, we just want `@cite' itself. We use -% \the<toks register> to achieve this: TeX expands \the<toks> only once, -% simply yielding the contents of <toks register>. (We also do this for -% the toc entries.) -\toks0 = {#1}\message{(\the\toks0)}% -% -\unnumbchapmacro {#1}% -\gdef\thischapter{#1}\gdef\thissection{#1}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash unnumbchapentry{\the\toks0}{\the\chapno}}}% -\temp -\unnumbnoderef -\global\let\section = \unnumberedsec -\global\let\subsection = \unnumberedsubsec -\global\let\subsubsection = \unnumberedsubsubsec + \secno=0 \subsecno=0 \subsubsecno=0 + % + % This used to be simply \message{#1}, but TeX fully expands the + % argument to \message. Therefore, if #1 contained @-commands, TeX + % expanded them. For example, in `@unnumbered The @cite{Book}', TeX + % expanded @cite (which turns out to cause errors because \cite is meant + % to be executed, not expanded). + % + % Anyway, we don't want the fully-expanded definition of @cite to appear + % as a result of the \message, we just want `@cite' itself. We use + % \the<toks register> to achieve this: TeX expands \the<toks> only once, + % simply yielding the contents of <toks register>. (We also do this for + % the toc entries.) + \toks0 = {#1}\message{(\the\toks0)}% + % + \unnumbchapmacro {#1}% + \gdef\thischapter{#1}\gdef\thissection{#1}% + \writetocentry{unnumbchap}{#1}{{\the\chapno}} + \unnumbnoderef + \global\let\section = \unnumberedsec + \global\let\subsection = \unnumberedsubsec + \global\let\subsubsection = \unnumberedsubsubsec } % Sections. \outer\def\numberedsec{\parsearg\secyyy} \def\secyyy #1{\numhead1{#1}} % normally calls seczzz \def\seczzz #1{% -\subsecno=0 \subsubsecno=0 \global\advance \secno by 1 % -\gdef\thissection{#1}\secheading {#1}{\the\chapno}{\the\secno}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash secentry{\the\toks0}% - {\the\chapno}{\the\secno}}}% -\temp -\donoderef -\nobreak + \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 % + \gdef\thissection{#1}\secheading {#1}{\the\chapno}{\the\secno}% + \writetocentry{sec}{#1}{{\the\chapno}{\the\secno}} + \donoderef + \nobreak } \outer\def\appendixsection{\parsearg\appendixsecyyy} \outer\def\appendixsec{\parsearg\appendixsecyyy} \def\appendixsecyyy #1{\apphead1{#1}} % normally calls appendixsectionzzz \def\appendixsectionzzz #1{% -\subsecno=0 \subsubsecno=0 \global\advance \secno by 1 % -\gdef\thissection{#1}\secheading {#1}{\appendixletter}{\the\secno}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash secentry{\the\toks0}% - {\appendixletter}{\the\secno}}}% -\temp -\appendixnoderef -\nobreak + \subsecno=0 \subsubsecno=0 \global\advance \secno by 1 % + \gdef\thissection{#1}\secheading {#1}{\appendixletter}{\the\secno}% + \writetocentry{sec}{#1}{{\appendixletter}{\the\secno}} + \appendixnoderef + \nobreak } \outer\def\unnumberedsec{\parsearg\unnumberedsecyyy} \def\unnumberedsecyyy #1{\unnmhead1{#1}} % normally calls unnumberedseczzz \def\unnumberedseczzz #1{% -\plainsecheading {#1}\gdef\thissection{#1}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash unnumbsecentry% - {\the\toks0}{\the\chapno}{\the\secno}}}% -\temp -\unnumbnoderef -\nobreak + \plainsecheading {#1}\gdef\thissection{#1}% + \writetocentry{unnumbsec}{#1}{{\the\chapno}{\the\secno}} + \unnumbnoderef + \nobreak } % Subsections. \outer\def\numberedsubsec{\parsearg\numberedsubsecyyy} \def\numberedsubsecyyy #1{\numhead2{#1}} % normally calls numberedsubseczzz \def\numberedsubseczzz #1{% -\gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 % -\subsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash subsecentry{\the\toks0}% - {\the\chapno}{\the\secno}{\the\subsecno}}}% -\temp -\donoderef -\nobreak + \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 % + \subsecheading {#1}{\the\chapno}{\the\secno}{\the\subsecno}% + \writetocentry{subsec}{#1}{{\the\chapno}{\the\secno}{\the\subsecno}} + \donoderef + \nobreak } \outer\def\appendixsubsec{\parsearg\appendixsubsecyyy} \def\appendixsubsecyyy #1{\apphead2{#1}} % normally calls appendixsubseczzz \def\appendixsubseczzz #1{% -\gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 % -\subsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash subsecentry{\the\toks0}% - {\appendixletter}{\the\secno}{\the\subsecno}}}% -\temp -\appendixnoderef -\nobreak + \gdef\thissection{#1}\subsubsecno=0 \global\advance \subsecno by 1 % + \subsecheading {#1}{\appendixletter}{\the\secno}{\the\subsecno}% + \writetocentry{subsec}{#1}{{\appendixletter}{\the\secno}{\the\subsecno}} + \appendixnoderef + \nobreak } \outer\def\unnumberedsubsec{\parsearg\unnumberedsubsecyyy} \def\unnumberedsubsecyyy #1{\unnmhead2{#1}} %normally calls unnumberedsubseczzz \def\unnumberedsubseczzz #1{% -\plainsubsecheading {#1}\gdef\thissection{#1}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash unnumbsubsecentry% - {\the\toks0}{\the\chapno}{\the\secno}{\the\subsecno}}}% -\temp -\unnumbnoderef -\nobreak + \plainsubsecheading {#1}\gdef\thissection{#1}% + \writetocentry{unnumbsubsec}{#1}{{\the\chapno}{\the\secno}{\the\subsecno}} + \unnumbnoderef + \nobreak } % Subsubsections. \outer\def\numberedsubsubsec{\parsearg\numberedsubsubsecyyy} \def\numberedsubsubsecyyy #1{\numhead3{#1}} % normally numberedsubsubseczzz \def\numberedsubsubseczzz #1{% -\gdef\thissection{#1}\global\advance \subsubsecno by 1 % -\subsubsecheading {#1} - {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash subsubsecentry{\the\toks0}% - {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}}}% -\temp -\donoderef -\nobreak + \gdef\thissection{#1}\global\advance \subsubsecno by 1 % + \subsubsecheading {#1} + {\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}% + \writetocentry{subsubsec}{#1}{{\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}} + \donoderef + \nobreak } \outer\def\appendixsubsubsec{\parsearg\appendixsubsubsecyyy} \def\appendixsubsubsecyyy #1{\apphead3{#1}} % normally appendixsubsubseczzz \def\appendixsubsubseczzz #1{% -\gdef\thissection{#1}\global\advance \subsubsecno by 1 % -\subsubsecheading {#1} - {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash subsubsecentry{\the\toks0}% - {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}}}% -\temp -\appendixnoderef -\nobreak + \gdef\thissection{#1}\global\advance \subsubsecno by 1 % + \subsubsecheading {#1} + {\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}% + \writetocentry{subsubsec}{#1}{{\appendixletter}{\the\secno}{\the\subsecno}{\the\subsubsecno}} + \appendixnoderef + \nobreak } \outer\def\unnumberedsubsubsec{\parsearg\unnumberedsubsubsecyyy} \def\unnumberedsubsubsecyyy #1{\unnmhead3{#1}} %normally unnumberedsubsubseczzz \def\unnumberedsubsubseczzz #1{% -\plainsubsubsecheading {#1}\gdef\thissection{#1}% -\toks0 = {#1}% -\edef\temp{\noexpand\writetocentry{\realbackslash unnumbsubsubsecentry% - {\the\toks0}{\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}}}% -\temp -\unnumbnoderef -\nobreak + \plainsubsubsecheading {#1}\gdef\thissection{#1}% + \writetocentry{unnumbsubsubsec}{#1}{{\the\chapno}{\the\secno}{\the\subsecno}{\the\subsubsecno}} + \unnumbnoderef + \nobreak } % These are variants which are not "outer", so they can appear in @ifinfo. @@ -3795,16 +4025,16 @@ width0pt\relax} \fi \def\majorheading{\parsearg\majorheadingzzz} \def\majorheadingzzz #1{% -{\advance\chapheadingskip by 10pt \chapbreak }% -{\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 - \parindent=0pt\raggedright - \rm #1\hfill}}\bigskip \par\penalty 200} + {\advance\chapheadingskip by 10pt \chapbreak }% + {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 + \parindent=0pt\raggedright + \rm #1\hfill}}\bigskip \par\penalty 200} \def\chapheading{\parsearg\chapheadingzzz} \def\chapheadingzzz #1{\chapbreak % -{\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 - \parindent=0pt\raggedright - \rm #1\hfill}}\bigskip \par\penalty 200} + {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 + \parindent=0pt\raggedright + \rm #1\hfill}}\bigskip \par\penalty 200} % @heading, @subheading, @subsubheading. \def\heading{\parsearg\plainsecheading} @@ -3952,7 +4182,7 @@ width0pt\relax} \fi }% % Add extra space after the heading -- either a line space or a % paragraph space, whichever is more. (Some people like to set - % \parskip to large values for some reason.) + % \parskip to large values for some reason.) Don't allow stretch, though. \nobreak \ifdim\parskip>\normalbaselineskip \kern\parskip @@ -3971,16 +4201,22 @@ width0pt\relax} \fi % Called from @chapter, etc. We supply {\folio} at the end of the % argument, which will end up as the last argument to the \...entry macro. % -% We open the .toc file here instead of at @setfilename or any other -% fixed time so that @contents can be put in the document anywhere. +% Usage: \writetocentry{chap}{The Name of The Game}{{\the\chapno}} +% We open the .toc file for writing here instead of at @setfilename (or +% any other fixed time) so that @contents can be anywhere in the document. % \newif\iftocfileopened -\def\writetocentry#1{% +\def\writetocentry#1#2#3{% \iftocfileopened\else \immediate\openout\tocfile = \jobname.toc \global\tocfileopenedtrue \fi - \iflinks \write\tocfile{#1{\folio}}\fi + % + \iflinks + \toks0 = {#2}% + \edef\temp{\write\tocfile{\realbackslash #1entry{\the\toks0}#3{\folio}}}% + \temp + \fi % % Tell \shipout to create a page destination if we're doing pdf, which % will be the target of the links in the table of contents. We can't @@ -4019,7 +4255,7 @@ width0pt\relax} \fi \advance\hsize by -\contentsrightmargin % Don't use the full line length. % % Roman numerals for page numbers. - \ifnum \pageno>0 \pageno = \lastnegativepageno \fi + \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi } @@ -4036,7 +4272,7 @@ width0pt\relax} \fi \pdfmakeoutlines \endgroup \lastnegativepageno = \pageno - \pageno = \savepageno + \global\pageno = \savepageno } % And just the chapters. @@ -4068,7 +4304,7 @@ width0pt\relax} \fi \contentsalignmacro % in case @setchapternewpage odd is in effect \endgroup \lastnegativepageno = \pageno - \pageno = \savepageno + \global\pageno = \savepageno } \let\shortcontents = \summarycontents @@ -4192,7 +4428,7 @@ width0pt\relax} \fi % @foo ... @end foo. % @point{}, @result{}, @expansion{}, @print{}, @equiv{}. -% +% % Since these characters are used in examples, it should be an even number of % \tt widths. Each \tt character is 1en, so two makes it 1em. % @@ -4204,7 +4440,7 @@ width0pt\relax} \fi % The @error{} command. % Adapted from the TeXbook's \boxit. -% +% \newbox\errorbox % {\tentt \global\dimen0 = 3em}% Width of the box. @@ -4232,14 +4468,14 @@ width0pt\relax} \fi \def\tex{\begingroup \catcode `\\=0 \catcode `\{=1 \catcode `\}=2 \catcode `\$=3 \catcode `\&=4 \catcode `\#=6 - \catcode `\^=7 \catcode `\_=8 \catcode `\~=13 \let~=\tie + \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie \catcode `\%=14 - \catcode 43=12 % plus - \catcode`\"=12 - \catcode`\==12 - \catcode`\|=12 - \catcode`\<=12 - \catcode`\>=12 + \catcode `\+=\other + \catcode `\"=\other + \catcode `\==\other + \catcode `\|=\other + \catcode `\<=\other + \catcode `\>=\other \escapechar=`\\ % \let\b=\ptexb @@ -4251,9 +4487,11 @@ width0pt\relax} \fi \let\equiv=\ptexequiv \let\!=\ptexexclam \let\i=\ptexi + \let\indent=\ptexindent \let\{=\ptexlbrace \let\+=\tabalign \let\}=\ptexrbrace + \let\/=\ptexslash \let\*=\ptexstar \let\t=\ptext % @@ -4336,7 +4574,8 @@ width0pt\relax} \fi % \newskip\lskip\newskip\rskip -\long\def\cartouche{% +\def\cartouche{% +\par % can't be in the midst of a paragraph. \begingroup \lskip=\leftskip \rskip=\rightskip \leftskip=0pt\rightskip=0pt %we want these *outside*. @@ -4421,27 +4660,16 @@ width0pt\relax} \fi % @example: Same as @lisp. \def\example{\begingroup \def\Eexample{\nonfillfinish\endgroup}\lisp} -% @small... is usually equivalent to the non-small (@smallbook -% redefines). We must call \example (or whatever) last in the -% definition, since it reads the return following the @example (or -% whatever) command. -% -% This actually allows (for example) @end display inside an -% @smalldisplay. Too bad, but makeinfo will catch the error anyway. -% -\def\smalldisplay{\begingroup\def\Esmalldisplay{\nonfillfinish\endgroup}\display} -\def\smallexample{\begingroup\def\Esmallexample{\nonfillfinish\endgroup}\lisp} -\def\smallformat{\begingroup\def\Esmallformat{\nonfillfinish\endgroup}\format} -\def\smalllisp{\begingroup\def\Esmalllisp{\nonfillfinish\endgroup}\lisp} - -% Real @smallexample and @smalllisp (when @smallbook): use smaller fonts. +% @smallexample and @smalllisp: use smaller fonts. % Originally contributed by Pavel@xerox. -\def\smalllispx{\begingroup +\def\smalllisp{\begingroup \def\Esmalllisp{\nonfillfinish\endgroup}% \def\Esmallexample{\nonfillfinish\endgroup}% \smallexamplefonts \lisp } +\let\smallexample = \smalllisp + % @display: same as @lisp except keep current font. % @@ -4451,9 +4679,9 @@ width0pt\relax} \fi \gobble } % -% @smalldisplay (when @smallbook): @display plus smaller fonts. +% @smalldisplay: @display plus smaller fonts. % -\def\smalldisplayx{\begingroup +\def\smalldisplay{\begingroup \def\Esmalldisplay{\nonfillfinish\endgroup}% \smallexamplefonts \rm \display @@ -4468,9 +4696,9 @@ width0pt\relax} \fi \gobble } % -% @smallformat (when @smallbook): @format plus smaller fonts. +% @smallformat: @format plus smaller fonts. % -\def\smallformatx{\begingroup +\def\smallformat{\begingroup \def\Esmallformat{\nonfillfinish\endgroup}% \smallexamplefonts \rm \format @@ -4513,7 +4741,7 @@ width0pt\relax} \fi % LaTeX-like @verbatim...@end verbatim and @verb{<char>...<char>} -% If we want to allow any <char> as delimiter, +% If we want to allow any <char> as delimiter, % we need the curly braces so that makeinfo sees the @verb command, eg: % `@verbx...x' would look like the '@verbx' command. --janneke@gnu.org % @@ -4591,8 +4819,8 @@ width0pt\relax} \fi \everypar{\starttabbox}% } -% Do the @verb magic: verbatim text is quoted by unique -% delimiter characters. Before first delimiter expect a +% Do the @verb magic: verbatim text is quoted by unique +% delimiter characters. Before first delimiter expect a % right brace, after last delimiter expect closing brace: % % \def\doverb'{'<char>#1<char>'}'{#1} @@ -4611,7 +4839,7 @@ width0pt\relax} \fi % % \def\doverbatim#1@end verbatim{#1} % -% For Texinfo it's a lot easier than for LaTeX, +% For Texinfo it's a lot easier than for LaTeX, % because texinfo's \verbatim doesn't stop at '\end{verbatim}': % we need not redefine '\', '{' and '}'. % @@ -4646,14 +4874,14 @@ width0pt\relax} \fi % Allow normal characters that we make active in the argument (a file name). \def\verbatiminclude{% \begingroup - \catcode`\\=12 - \catcode`~=12 - \catcode`^=12 - \catcode`_=12 - \catcode`|=12 - \catcode`<=12 - \catcode`>=12 - \catcode`+=12 + \catcode`\\=\other + \catcode`~=\other + \catcode`^=\other + \catcode`_=\other + \catcode`|=\other + \catcode`<=\other + \catcode`>=\other + \catcode`+=\other \parsearg\doverbatiminclude } \def\setupverbatiminclude{% @@ -4667,22 +4895,25 @@ width0pt\relax} \fi % Restore active chars for included file. \endgroup \begingroup - \def\thisfile{#1}% - \expandafter\expandafter\setupverbatiminclude\input\thisfile - \endgroup\nonfillfinish\endgroup + \let\value=\expandablevalue + \def\thisfile{#1}% + \expandafter\expandafter\setupverbatiminclude\input\thisfile + \endgroup + \nonfillfinish + \endgroup } % @copying ... @end copying. % Save the text away for @insertcopying later. Many commands won't be % allowed in this context, but that's ok. -% +% % We save the uninterpreted tokens, rather than creating a box. % Saving the text in a box would be much easier, but then all the % typesetting commands (@smallbook, font changes, etc.) have to be done % beforehand -- and a) we want @copying to be done first in the source % file; b) letting users define the frontmatter in as flexible order as % possible is very desirable. -% +% \def\copying{\begingroup % Define a command to swallow text until we reach `@end copying'. % \ is the escape char in this texinfo.tex file, so it is the @@ -4705,15 +4936,15 @@ width0pt\relax} \fi % end-of-line to be a \par, as would happen with the normal active % definition of ^^M. On the third hand, two ^^M's in a row should still % generate a \par. -% +% % Our approach is to make ^^M insert a space and a penalty1 normally; % then it can also check if \lastpenalty=1. If it does, then manually % do \par. -% +% % This messes up the normal definitions of @c[omment], so we redefine % it. Similarly for @ignore. (These commands are used in the gcc % manual for man page generation.) -% +% % Seems pretty fragile, most line-oriented commands will presumably % fail, but for the limited use of getting the copying text (which % should be quite simple) inserted, we can hope it's ok. @@ -4754,7 +4985,7 @@ width0pt\relax} \fi \newcount\parencount % We want ()&[] to print specially on the defun line. -% +% \def\activeparens{% \catcode`\(=\active \catcode`\)=\active \catcode`\&=\active @@ -4806,7 +5037,7 @@ width0pt\relax} \fi % Active &'s sneak into the index arguments, so make sure it's defined. { - \catcode`& = 13 + \catcode`& = \active \global\let& = \ampnr } @@ -4857,14 +5088,17 @@ width0pt\relax} \fi % #1 is the \E... control sequence to end the definition (which we define). % #2 is the \...x control sequence (which our caller defines). % #3 is the control sequence to process the header, such as \defunheader. -% +% \def\parsebodycommon#1#2#3{% \begingroup\inENV % If there are two @def commands in a row, we'll have a \nobreak, % which is there to keep the function description together with its % header. But if there's nothing but headers, we want to allow a - % break after all. - \ifnum\lastpenalty=10000 \penalty0 \fi + % break after all. Check for penalty 10002 (inserted by + % \defargscommonending) instead of 10000, since the sectioning + % commands insert a \penalty10000, and we don't want to allow a break + % between a section heading and a defun. + \ifnum\lastpenalty=10002 \penalty0 \fi \medbreak % % Define the \E... end token that this defining construct specifies @@ -4877,7 +5111,7 @@ width0pt\relax} \fi } % Common part of the \...x definitions. -% +% \def\defxbodycommon{% % As with \parsebodycommon above, allow line break if we have multiple % x headers in a row. It's not a great place, though. @@ -4891,7 +5125,7 @@ width0pt\relax} \fi \def\defparsebody#1#2#3{% \parsebodycommon{#1}{#2}{#3}% \def#2{\defxbodycommon \activeparens \spacesplit#3}% - \catcode61=\active % 61 is `=' + \catcode\equalChar=\active \begingroup\obeylines\activeparens \spacesplit#3% } @@ -4928,7 +5162,7 @@ width0pt\relax} \fi % to account for this both in the \...x definition and in parsing the % input at hand. Thus also need a control sequence (passed as #5) for % the \E... definition to assign the category name to. -% +% \def\deftypeopparsebody#1#2#3#4#5 #6 {% \parsebodycommon{#1}{#2}{#3}% \def#2##1 ##2 ##3 {\def#4{##1}% @@ -4953,7 +5187,7 @@ width0pt\relax} \fi \def\defvarparsebody #1#2#3{% \parsebodycommon{#1}{#2}{#3}% \def#2{\defxbodycommon \spacesplit#3}% - \catcode61=\active % + \catcode\equalChar=\active \begingroup\obeylines \spacesplit#3% } @@ -5022,9 +5256,18 @@ width0pt\relax} \fi % Define @defun. -% First, define the processing that is wanted for arguments of \defun -% Use this to expand the args and terminate the paragraph they make up +% This is called to end the arguments processing for all the @def... commands. +% +\def\defargscommonending{% + \interlinepenalty = 10000 + \advance\rightskip by 0pt plus 1fil + \endgraf + \nobreak\vskip -\parskip + \penalty 10002 % signal to \parsebodycommon. +} +% This expands the args and terminates the paragraph they comprise. +% \def\defunargs#1{\functionparens \sl % Expand, preventing hyphenation at `-' chars. % Note that groups don't affect changes in \hyphenchar. @@ -5033,9 +5276,7 @@ width0pt\relax} \fi #1% {\tensl\hyphenchar\font=45}% \ifnum\parencount=0 \else \errmessage{Unbalanced parentheses in @def}\fi% -\interlinepenalty=10000 -\advance\rightskip by 0pt plus 1fil -\endgraf\nobreak\vskip -\parskip\nobreak + \defargscommonending } \def\deftypefunargs #1{% @@ -5044,9 +5285,7 @@ width0pt\relax} \fi % Use \boldbraxnoamp, not \functionparens, so that & is not special. \boldbraxnoamp \tclose{#1}% avoid \code because of side effects on active chars -\interlinepenalty=10000 -\advance\rightskip by 0pt plus 1fil -\endgraf\nobreak\vskip -\parskip\nobreak + \defargscommonending } % Do complete processing of one @defun or @defunx line already parsed. @@ -5057,7 +5296,7 @@ width0pt\relax} \fi \def\deffnheader #1#2#3{\doind {fn}{\code{#2}}% \begingroup\defname {#2}{#1}\defunargs{#3}\endgroup % -\catcode 61=\other % Turn off change made in \defparsebody +\catcode\equalChar=\other % Turn off change made in \defparsebody } % @defun == @deffn Function @@ -5067,7 +5306,7 @@ width0pt\relax} \fi \def\defunheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index \begingroup\defname {#1}{\putwordDeffunc}% \defunargs {#2}\endgroup % -\catcode 61=\other % Turn off change made in \defparsebody +\catcode\equalChar=\other % Turn off change made in \defparsebody } % @deftypefun int foobar (int @var{foo}, float @var{bar}) @@ -5081,7 +5320,7 @@ width0pt\relax} \fi \doind {fn}{\code{#2}}% Make entry in function index \begingroup\defname {\defheaderxcond#1\relax$.$#2}{\putwordDeftypefun}% \deftypefunargs {#3}\endgroup % -\catcode 61=\other % Turn off change made in \defparsebody +\catcode\equalChar=\other % Turn off change made in \defparsebody } % @deftypefn {Library Function} int foobar (int @var{foo}, float @var{bar}) @@ -5102,7 +5341,7 @@ width0pt\relax} \fi % at least some C++ text from working \defname {\defheaderxcond#2\relax$.$#3}{#1}% \deftypefunargs {#4}\endgroup % -\catcode 61=\other % Turn off change made in \defparsebody +\catcode\equalChar=\other % Turn off change made in \defparsebody } % @defmac == @deffn Macro @@ -5112,7 +5351,7 @@ width0pt\relax} \fi \def\defmacheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index \begingroup\defname {#1}{\putwordDefmac}% \defunargs {#2}\endgroup % -\catcode 61=\other % Turn off change made in \defparsebody +\catcode\equalChar=\other % Turn off change made in \defparsebody } % @defspec == @deffn Special Form @@ -5122,7 +5361,7 @@ width0pt\relax} \fi \def\defspecheader #1#2{\doind {fn}{\code{#1}}% Make entry in function index \begingroup\defname {#1}{\putwordDefspec}% \defunargs {#2}\endgroup % -\catcode 61=\other % Turn off change made in \defparsebody +\catcode\equalChar=\other % Turn off change made in \defparsebody } % @defop CATEGORY CLASS OPERATION ARG... @@ -5131,9 +5370,11 @@ width0pt\relax} \fi \defopparsebody\Edefop\defopx\defopheader\defoptype} % \def\defopheader#1#2#3{% -\dosubind {fn}{\code{#2}}{\putwordon\ #1}% Make entry in function index -\begingroup\defname {#2}{\defoptype\ \putwordon\ #1}% -\defunargs {#3}\endgroup % + \dosubind{fn}{\code{#2}}{\putwordon\ \code{#1}}% function index entry + \begingroup + \defname{#2}{\defoptype\ \putwordon\ #1}% + \defunargs{#3}% + \endgroup } % @deftypeop CATEGORY CLASS TYPE OPERATION ARG... @@ -5200,9 +5441,11 @@ width0pt\relax} \fi \defopvarparsebody\Edefcv\defcvx\defcvarheader\defcvtype} \def\defcvarheader #1#2#3{% -\dosubind {vr}{\code{#2}}{\putwordof\ #1}% Make entry in var index -\begingroup\defname {#2}{\defcvtype\ \putwordof\ #1}% -\defvarargs {#3}\endgroup % + \dosubind{vr}{\code{#2}}{\putwordof\ \code{#1}}% variable index entry + \begingroup + \defname{#2}{\defcvtype\ \putwordof\ #1}% + \defvarargs{#3}% + \endgroup } % @defivar CLASS VARNAME == @defcv {Instance Variable} CLASS VARNAME @@ -5210,7 +5453,7 @@ width0pt\relax} \fi \def\defivar{\defvrparsebody\Edefivar\defivarx\defivarheader} % \def\defivarheader#1#2#3{% - \dosubind {vr}{\code{#2}}{\putwordof\ #1}% entry in var index + \dosubind{vr}{\code{#2}}{\putwordof\ \code{#1}}% entry in var index \begingroup \defname{#2}{\putwordInstanceVariableof\ #1}% \defvarargs{#3}% @@ -5222,8 +5465,8 @@ width0pt\relax} \fi % This is actually simple: just print them in roman. % This must expand the args and terminate the paragraph they make up \def\defvarargs #1{\normalparens #1% -\interlinepenalty=10000 -\endgraf\nobreak\vskip -\parskip\nobreak} + \defargscommonending +} % @defvr Counter foo-count @@ -5259,8 +5502,7 @@ width0pt\relax} \fi \def\deftypevarheader #1#2{% \dovarind#2 \relax% Make entry in variables index \begingroup\defname {\defheaderxcond#1\relax$.$#2}{\putwordDeftypevar}% -\interlinepenalty=10000 -\endgraf\nobreak\vskip -\parskip\nobreak + \defargscommonending \endgroup} \def\dovarind#1 #2\relax{\doind{vr}{\code{#1}}} @@ -5270,8 +5512,7 @@ width0pt\relax} \fi \def\deftypevrheader #1#2#3{\dovarind#3 \relax% \begingroup\defname {\defheaderxcond#2\relax$.$#3}{#1} -\interlinepenalty=10000 -\endgraf\nobreak\vskip -\parskip\nobreak + \defargscommonending \endgroup} % Now define @deftp @@ -5288,7 +5529,7 @@ width0pt\relax} \fi % These definitions are used if you use @defunx (etc.) % anywhere other than immediately after a @defun or @defunx. -% +% \def\defcvx#1 {\errmessage{@defcvx in invalid context}} \def\deffnx#1 {\errmessage{@deffnx in invalid context}} \def\defivarx#1 {\errmessage{@defivarx in invalid context}} @@ -5320,7 +5561,7 @@ width0pt\relax} \fi \def\scanmacro#1{% \begingroup \newlinechar`\^^M % Undo catcode changes of \startcontents and \doprintindex - \catcode`\@=0 \catcode`\\=12 \escapechar=`\@ + \catcode`\@=0 \catcode`\\=\other \escapechar=`\@ % Append \endinput to make sure that TeX does not see the ending newline. \toks0={#1\endinput}% \immediate\openout\macscribble=\jobname.tmp @@ -5334,7 +5575,7 @@ width0pt\relax} \fi \def\scanmacro#1{% \begingroup \newlinechar`\^^M % Undo catcode changes of \startcontents and \doprintindex -\catcode`\@=0 \catcode`\\=12 \escapechar=`\@ +\catcode`\@=0 \catcode`\\=\other \escapechar=`\@ \let\xeatspaces\eatspaces\scantokens{#1\endinput}\endgroup} \fi @@ -5364,7 +5605,7 @@ width0pt\relax} \fi } % Trim a single trailing ^^M off a string. -{\catcode`\^^M=12\catcode`\Q=3% +{\catcode`\^^M=\other \catcode`\Q=3% \gdef\eatcr #1{\eatcra #1Q^^MQ}% \gdef\eatcra#1^^MQ{\eatcrb#1Q}% \gdef\eatcrb#1Q#2Q{#1}% @@ -5379,29 +5620,29 @@ width0pt\relax} \fi % body, and then making it the \newlinechar in \scanmacro. \def\macrobodyctxt{% - \catcode`\~=12 - \catcode`\^=12 - \catcode`\_=12 - \catcode`\|=12 - \catcode`\<=12 - \catcode`\>=12 - \catcode`\+=12 - \catcode`\{=12 - \catcode`\}=12 - \catcode`\@=12 - \catcode`\^^M=12 + \catcode`\~=\other + \catcode`\^=\other + \catcode`\_=\other + \catcode`\|=\other + \catcode`\<=\other + \catcode`\>=\other + \catcode`\+=\other + \catcode`\{=\other + \catcode`\}=\other + \catcode`\@=\other + \catcode`\^^M=\other \usembodybackslash} \def\macroargctxt{% - \catcode`\~=12 - \catcode`\^=12 - \catcode`\_=12 - \catcode`\|=12 - \catcode`\<=12 - \catcode`\>=12 - \catcode`\+=12 - \catcode`\@=12 - \catcode`\\=12} + \catcode`\~=\other + \catcode`\^=\other + \catcode`\_=\other + \catcode`\|=\other + \catcode`\<=\other + \catcode`\>=\other + \catcode`\+=\other + \catcode`\@=\other + \catcode`\\=\other} % \mbodybackslash is the definition of \ in @macro bodies. % It maps \foo\ => \csname macarg.foo\endcsname => #N @@ -5442,32 +5683,33 @@ width0pt\relax} \fi \else \expandafter\parsemacbody \fi} -\def\unmacro{\parsearg\unmacroxxx} -\def\unmacroxxx#1{% +\def\unmacro{\parsearg\dounmacro} +\def\dounmacro#1{% \if1\csname ismacro.#1\endcsname \global\cslet{#1}{macsave.#1}% \global\expandafter\let \csname ismacro.#1\endcsname=0% - % Remove the macro name from \macrolist + % Remove the macro name from \macrolist: \begingroup - \edef\tempa{\expandafter\noexpand\csname#1\endcsname}% - \def\do##1{% - \def\tempb{##1}% - \ifx\tempa\tempb - % remove this - \else - \toks0 = \expandafter{\newmacrolist\do}% - \edef\newmacrolist{\the\toks0\expandafter\noexpand\tempa}% - \fi}% - \def\newmacrolist{}% - % Execute macro list to define \newmacrolist - \macrolist - \global\let\macrolist\newmacrolist + \expandafter\let\csname#1\endcsname \relax + \let\do\unmacrodo + \xdef\macrolist{\macrolist}% \endgroup \else \errmessage{Macro #1 not defined}% \fi } +% Called by \do from \dounmacro on each macro. The idea is to omit any +% macro definitions that have been changed to \relax. +% +\def\unmacrodo#1{% + \ifx#1\relax + % remove this + \else + \noexpand\do \noexpand #1% + \fi +} + % This makes use of the obscure feature that if the last token of a % <parameter list> is #, then the preceding argument is delimited by % an opening brace, and that opening brace is not consumed. @@ -5615,8 +5857,8 @@ width0pt\relax} \fi % @node's job is to define \lastnode. \def\node{\ENVcheck\parsearg\nodezzz} -\def\nodezzz#1{\nodexxx [#1,]} -\def\nodexxx[#1,#2]{\gdef\lastnode{#1}} +\def\nodezzz#1{\nodexxx #1,\finishnodeparse} +\def\nodexxx#1,#2\finishnodeparse{\gdef\lastnode{#1}} \let\nwnode=\node \let\lastnode=\relax @@ -5650,15 +5892,23 @@ width0pt\relax} \fi \gdef\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi} \gdef\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces} -% \setref{NAME}{SNT} defines a cross-reference point NAME, namely -% NAME-title, NAME-pg, and NAME-SNT. Called from \foonoderef. We have -% to set \indexdummies so commands such as @code in a section title -% aren't expanded. It would be nicer not to expand the titles in the -% first place, but there's so many layers that that is hard to do. +% \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an +% anchor), namely NAME-title (the corresponding @chapter/etc. name), +% NAME-pg (the page number), and NAME-snt (section number and type). +% Called from \foonoderef. +% +% We have to set \indexdummies so commands such as @code in a section +% title aren't expanded. It would be nicer not to expand the titles in +% the first place, but there's so many layers that that is hard to do. +% +% Likewise, use \turnoffactive so that punctuation chars such as underscore +% and backslash work in node names. % \def\setref#1#2{{% - \indexdummies + \atdummies \pdfmkdest{#1}% + % + \turnoffactive \dosetq{#1-title}{Ytitle}% \dosetq{#1-pg}{Ypagenumber}% \dosetq{#1-snt}{#2}% @@ -5710,7 +5960,7 @@ width0pt\relax} \fi \ifpdf \leavevmode \getfilename{#4}% - {\normalturnoffactive + {\turnoffactive \otherbackslash \ifnum\filenamelength>0 \startlink attr{/Border [0 0 0]}% goto file{\the\filename.pdf} name{#1}% @@ -5730,82 +5980,94 @@ width0pt\relax} \fi % into the usual \leavevmode...\vrule stuff for purposes of % printing. So we \turnoffactive for the \refx-snt, back on for the % printing, back off for the \refx-pg. - {\normalturnoffactive + {\turnoffactive \otherbackslash % Only output a following space if the -snt ref is nonempty; for % @unnumbered and @anchor, it won't be. \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}% \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi }% - % [mynode], - [\printednodename],\space - % page 3 - \turnoffactive \putwordpage\tie\refx{#1-pg}{}% + % output the `[mynode]' via a macro. + \xrefprintnodename\printednodename + % + % But we always want a comma and a space: + ,\space + % + % output the `page 3'. + \turnoffactive \otherbackslash \putwordpage\tie\refx{#1-pg}{}% \fi \endlink \endgroup} -% \dosetq is the interface for calls from other macros +% This macro is called from \xrefX for the `[nodename]' part of xref +% output. It's a separate macro only so it can be changed more easily, +% since not square brackets don't work in some documents. Particularly +% one that Bob is working on :). +% +\def\xrefprintnodename#1{[#1]} -% Use \normalturnoffactive so that punctuation chars such as underscore -% and backslash work in node names. (\turnoffactive doesn't do \.) +% \dosetq is called from \setref to do the actual \write (\iflinks). +% \def\dosetq#1#2{% {\let\folio=0% - \normalturnoffactive \edef\next{\write\auxfile{\internalsetq{#1}{#2}}}% - \iflinks - \next - \fi + \iflinks \next \fi }% } -% \internalsetq {foo}{page} expands into -% CHARACTERS 'xrdef {foo}{...expansion of \Ypage...} -% When the aux file is read, ' is the escape character - -\def\internalsetq #1#2{'xrdef {#1}{\csname #2\endcsname}} - -% Things to be expanded by \internalsetq +% \internalsetq{foo}{page} expands into +% CHARACTERS @xrdef{foo}{...expansion of \page...} +\def\internalsetq#1#2{@xrdef{#1}{\csname #2\endcsname}} +% Things to be expanded by \internalsetq. +% \def\Ypagenumber{\folio} - \def\Ytitle{\thissection} - \def\Ynothing{} - \def\Ysectionnumberandtype{% -\ifnum\secno=0 \putwordChapter\xreftie\the\chapno % -\else \ifnum \subsecno=0 \putwordSection\xreftie\the\chapno.\the\secno % -\else \ifnum \subsubsecno=0 % -\putwordSection\xreftie\the\chapno.\the\secno.\the\subsecno % -\else % -\putwordSection\xreftie\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno % -\fi \fi \fi } + \ifnum\secno=0 + \putwordChapter@tie \the\chapno + \else \ifnum\subsecno=0 + \putwordSection@tie \the\chapno.\the\secno + \else \ifnum\subsubsecno=0 + \putwordSection@tie \the\chapno.\the\secno.\the\subsecno + \else + \putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno + \fi\fi\fi +} \def\Yappendixletterandtype{% -\ifnum\secno=0 \putwordAppendix\xreftie'char\the\appendixno{}% -\else \ifnum \subsecno=0 \putwordSection\xreftie'char\the\appendixno.\the\secno % -\else \ifnum \subsubsecno=0 % -\putwordSection\xreftie'char\the\appendixno.\the\secno.\the\subsecno % -\else % -\putwordSection\xreftie'char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno % -\fi \fi \fi } - -\gdef\xreftie{'tie} + \ifnum\secno=0 + \putwordAppendix@tie @char\the\appendixno{}% + \else \ifnum\subsecno=0 + \putwordSection@tie @char\the\appendixno.\the\secno + \else \ifnum\subsubsecno=0 + \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno + \else + \putwordSection@tie + @char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno + \fi\fi\fi +} % Use TeX 3.0's \inputlineno to get the line number, for better error % messages, but if we're using an old version of TeX, don't do anything. % \ifx\inputlineno\thisisundefined - \let\linenumber = \empty % Non-3.0. + \let\linenumber = \empty % Pre-3.0. \else \def\linenumber{\the\inputlineno:\space} \fi % Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME. % If its value is nonempty, SUFFIX is output afterward. - +% \def\refx#1#2{% - \expandafter\ifx\csname X#1\endcsname\relax + {% + \indexnofonts + \otherbackslash + \expandafter\global\expandafter\let\expandafter\thisrefX + \csname X#1\endcsname + }% + \ifx\thisrefX\relax % If not defined, say something at least. \angleleft un\-de\-fined\angleright \iflinks @@ -5820,19 +6082,14 @@ width0pt\relax} \fi \fi \else % It's defined, so just use it. - \csname X#1\endcsname + \thisrefX \fi #2% Output the suffix in any case. } % This is the macro invoked by entries in the aux file. % -\def\xrdef#1{\begingroup - % Reenable \ as an escape while reading the second argument. - \catcode`\\ = 0 - \afterassignment\endgroup - \expandafter\gdef\csname X#1\endcsname -} +\def\xrdef#1{\expandafter\gdef\csname X#1\endcsname} % Read the last existing aux file, if any. No error if none exists. \def\readauxfile{\begingroup @@ -5863,9 +6120,7 @@ width0pt\relax} \fi \catcode`\^^]=\other \catcode`\^^^=\other \catcode`\^^_=\other - \catcode`\@=\other - \catcode`\^=\other - % It was suggested to define this as 7, which would allow ^^e4 etc. + % It was suggested to set the catcode of ^ to 7, which would allow ^^e4 etc. % in xref tags, i.e., node names. But since ^^e4 notation isn't % supported in the main text, it doesn't seem desirable. Furthermore, % that is not enough: for node names that actually contain a ^ @@ -5878,6 +6133,9 @@ width0pt\relax} \fi % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter % and then to call \auxhat in \setq. % + \catcode`\^=\other + % + % Special characters. Should be turned off anyway, but... \catcode`\~=\other \catcode`\[=\other \catcode`\]=\other @@ -5889,7 +6147,9 @@ width0pt\relax} \fi \catcode`\$=\other \catcode`\#=\other \catcode`\&=\other + \catcode`\%=\other \catcode`+=\other % avoid \+ for paranoia even though we've turned it off + % % Make the characters 128-255 be printing characters {% \count 1=128 @@ -5899,17 +6159,18 @@ width0pt\relax} \fi \ifnum \count 1<256 \loop \fi }% }% - % The aux file uses ' as the escape (for now). + % % Turn off \ as an escape so we do not lose on % entries which were dumped with control sequences in their names. - % For example, 'xrdef {$\leq $-fun}{page ...} made by @defun ^^ + % For example, @xrdef{$\leq $-fun}{page ...} made by @defun ^^ % Reference to such entries still does not work the way one would wish, % but at least they do not bomb out when the aux file is read in. + \catcode`\\=\other + % + % @ is our escape character in .aux files. \catcode`\{=1 \catcode`\}=2 - \catcode`\%=\other - \catcode`\'=0 - \catcode`\\=\other + \catcode`\@=0 % \openin 1 \jobname.aux \ifeof 1 \else @@ -5943,18 +6204,19 @@ width0pt\relax} \fi % % Auto-number footnotes. Otherwise like plain. \gdef\footnote{% + \let\indent=\ptexindent \global\advance\footnoteno by \@ne \edef\thisfootno{$^{\the\footnoteno}$}% % % In case the footnote comes at the end of a sentence, preserve the % extra spacing after we do the footnote number. \let\@sf\empty - \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\/\fi + \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\ptexslash\fi % % Remove inadvertent blank space before typesetting the footnote number. \unskip \thisfootno\@sf - \footnotezzz + \dofootnote }% % Don't bother with the trickery in plain.tex to not require the @@ -5964,10 +6226,17 @@ width0pt\relax} \fi % \parseargline fail inside footnotes because the tokens are fixed when % the footnote is read. --karl, 16nov96. % -\long\gdef\footnotezzz{\insert\footins\bgroup +% The start of the footnote looks usually like this: +\gdef\startfootins{\insert\footins\bgroup} +% +% ... but this macro is redefined inside @multitable. +% +\gdef\dofootnote{% + \startfootins % We want to typeset this text as a normal paragraph, even if the % footnote reference occurs in (for example) a display environment. % So reset some parameters. + \hsize=\pagewidth \interlinepenalty\interfootnotelinepenalty \splittopskip\ht\strutbox % top baseline for broken footnotes \splitmaxdepth\dp\strutbox @@ -5997,12 +6266,6 @@ width0pt\relax} \fi \footstrut \futurelet\next\fo@t } -\def\fo@t{\ifcat\bgroup\noexpand\next \let\next\f@@t - \else\let\next\f@t\fi \next} -\def\f@@t{\bgroup\aftergroup\@foot\let\next} -\def\f@t#1{#1\@foot} -\def\@foot{\strut\par\egroup} - }%end \catcode `\@=11 % @| inserts a changebar to the left of the current line. It should @@ -6049,8 +6312,8 @@ width0pt\relax} \fi \openin 1 = epsf.tex \ifeof 1 \else \closein 1 - % Do not bother showing banner with post-v2.7 epsf.tex (available in - % doc/epsf.tex until it shows up on ctan). + % Do not bother showing banner with epsf.tex v2.7k (available in + % doc/epsf.tex and on ctan). \def\epsfannounce{\toks0 = }% \input epsf.tex \fi @@ -6089,7 +6352,7 @@ width0pt\relax} \fi \nobreak\bigskip % Usually we'll have text after the image which will insert % \parskip glue, so insert it here too to equalize the space - % above and below. + % above and below. \nobreak\vskip\parskip \nobreak \line\bgroup\hss @@ -6177,7 +6440,7 @@ should work if nowhere else does.} % Parameters in order: 1) textheight; 2) textwidth; 3) voffset; % 4) hoffset; 5) binding offset; 6) topskip; 7) physical page height; 8) % physical page width. -% +% % We also call \setleading{\textleading}, so the caller should define % \textleading. The caller should also set \parskip. % @@ -6211,15 +6474,6 @@ should work if nowhere else does.} \setemergencystretch } -% Use `small' versions. -% -\def\smallenvironments{% - \let\smalldisplay = \smalldisplayx - \let\smallexample = \smalllispx - \let\smallformat = \smallformatx - \let\smalllisp = \smalllispx -} - % @letterpaper (the default). \def\letterpaper{{\globaldefs = 1 \parskip = 3pt plus 2pt minus 1pt @@ -6247,7 +6501,6 @@ should work if nowhere else does.} \hfuzz = 1pt \contentsrightmargin = 0pt \defbodyindent = .5cm - \smallenvironments }} % Use @afourpaper to print on European A4 paper. @@ -6255,7 +6508,7 @@ should work if nowhere else does.} \parskip = 3pt plus 2pt minus 1pt \textleading = 13.2pt % - % Double-side printing via postscript on Laserjet 4050 + % Double-side printing via postscript on Laserjet 4050 % prints double-sided nicely when \bindingoffset=10mm and \hoffset=-6mm. % To change the settings for a different printer or situation, adjust % \normaloffset until the front-side and back-side texts align. Then @@ -6294,11 +6547,9 @@ should work if nowhere else does.} \contentsrightmargin = 0pt \defbodyindent = 2mm \tableindent = 12mm - % - \smallenvironments }} -% A specific text layout, 24x15cm overall, intended for A4 paper. +% A specific text layout, 24x15cm overall, intended for A4 paper. \def\afourlatex{{\globaldefs = 1 \afourpaper \internalpagesizes{237mm}{150mm}% @@ -6406,7 +6657,7 @@ should work if nowhere else does.} \catcode`\_=\active \def_{\ifusingtt\normalunderscore\_} % Subroutine for the previous macro. -\def\_{\leavevmode \kern.06em \vbox{\hrule width.3em height.1ex}} +\def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em } \catcode`\|=\active \def|{{\tt\char124}} @@ -6420,8 +6671,6 @@ should work if nowhere else does.} \def+{{\tt \char 43}} \catcode`\$=\active \def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix -%\catcode 27=\active -%\def^^[{$\diamondsuit$} % Set up an active definition for =, but don't enable it most of the time. {\catcode`\==\active @@ -6438,35 +6687,45 @@ should work if nowhere else does.} \catcode`\@=0 -% \rawbackslashxx output one backslash character in current font +% \rawbackslashxx outputs one backslash character in current font, +% as in \char`\\. \global\chardef\rawbackslashxx=`\\ -%{\catcode`\\=\other -%@gdef@rawbackslashxx{\}} -% \rawbackslash redefines \ as input to do \rawbackslashxx. +% \rawbackslash defines an active \ to do \rawbackslashxx. +% \otherbackslash defines an active \ to be a literal `\' character with +% catcode other. {\catcode`\\=\active -@gdef@rawbackslash{@let\=@rawbackslashxx }} + @gdef@rawbackslash{@let\=@rawbackslashxx} + @gdef@otherbackslash{@let\=@realbackslash} +} + +% \realbackslash is an actual character `\' with catcode other. +{\catcode`\\=\other @gdef@realbackslash{\}} % \normalbackslash outputs one backslash in fixed width font. \def\normalbackslash{{\tt\rawbackslashxx}} -% \catcode 17=0 % Define control-q \catcode`\\=\active % Used sometimes to turn off (effectively) the active characters % even after parsing them. -@def@turnoffactive{@let"=@normaldoublequote -@let\=@realbackslash -@let~=@normaltilde -@let^=@normalcaret -@let_=@normalunderscore -@let|=@normalverticalbar -@let<=@normalless -@let>=@normalgreater -@let+=@normalplus -@let$=@normaldollar}%$ font-lock fix - -% Same as @turnoffactive except for \. +@def@turnoffactive{% + @let"=@normaldoublequote + @let\=@realbackslash + @let~=@normaltilde + @let^=@normalcaret + @let_=@normalunderscore + @let|=@normalverticalbar + @let<=@normalless + @let>=@normalgreater + @let+=@normalplus + @let$=@normaldollar %$ font-lock fix +} + +% Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of +% the literal character `\'. (Thus, \ is not expandable when this is in +% effect.) +% @def@normalturnoffactive{@turnoffactive @let\=@normalbackslash} % Make _ and + \other characters, temporarily. @@ -6495,7 +6754,7 @@ should work if nowhere else does.} % Say @foo, not \foo, in error messages. @escapechar = `@@ -% These look ok in all fonts, so just make them not special. +% These look ok in all fonts, so just make them not special. @catcode`@& = @other @catcode`@# = @other @catcode`@% = @other diff --git a/contrib/gcc/doc/invoke.texi b/contrib/gcc/doc/invoke.texi index d69d896..a99440f 100644 --- a/contrib/gcc/doc/invoke.texi +++ b/contrib/gcc/doc/invoke.texi @@ -343,7 +343,7 @@ in the following sections. -mapp-regs -mbroken-saverestore -mcypress @gol -mfaster-structs -mflat @gol -mfpu -mhard-float -mhard-quad-float @gol --mimpure-text -mlive-g0 -mno-app-regs @gol +-mimpure-text -mlittle-endian -mlive-g0 -mno-app-regs @gol -mno-faster-structs -mno-flat -mno-fpu @gol -mno-impure-text -mno-stack-bias -mno-unaligned-doubles @gol -msoft-float -msoft-quad-float -msparclite -mstack-bias @gol @@ -1575,14 +1575,14 @@ Instantiations of these templates may be mangled incorrectly. @item -Wctor-dtor-privacy @r{(C++ only)} @opindex Wctor-dtor-privacy -Warn when a class seems unusable, because all the constructors or -destructors in a class are private and the class has no friends or +Warn when a class seems unusable because all the constructors or +destructors in that class are private, and it has neither friends nor public static member functions. This warning is enabled by default. @item -Wnon-virtual-dtor @r{(C++ only)} @opindex Wnon-virtual-dtor -Warn when a class declares a non-virtual destructor that should probably -be virtual, because it looks like the class will be used polymorphically. +Warn when a class appears to be polymorphic, thereby requiring a virtual +destructor, yet it declares a non-virtual one. This warning is enabled by @option{-Wall}. @item -Wreorder @r{(C++ only)} @@ -1600,9 +1600,9 @@ struct A @{ @}; @end smallexample -Here the compiler will warn that the member initializers for @samp{i} -and @samp{j} will be rearranged to match the declaration order of the -members. This warning is enabled by @option{-Wall}. +The compiler will rearrange the member initializers for @samp{i} +and @samp{j} to match the declaration order of the members, emitting +a warning to that effect. This warning is enabled by @option{-Wall}. @end table The following @option{-W@dots{}} options are not affected by @option{-Wall}. @@ -1632,8 +1632,8 @@ Item 23: Don't try to return a reference when you must return an object. @end itemize -and about violations of the following style guidelines from Scott Meyers' -@cite{More Effective C++} book: +Also warn about violations of the following style guidelines from +Scott Meyers' @cite{More Effective C++} book: @itemize @bullet @item @@ -1645,8 +1645,8 @@ Item 7: Never overload @code{&&}, @code{||}, or @code{,}. @end itemize -If you use this option, you should be aware that the standard library -headers do not obey all of these guidelines; you can use @samp{grep -v} +When selecting this option, be aware that the standard library +headers do not obey all of these guidelines; use @samp{grep -v} to filter out those warnings. @item -Wno-deprecated @r{(C++ only)} @@ -1656,7 +1656,7 @@ Do not warn about usage of deprecated features. @xref{Deprecated Features}. @item -Wno-non-template-friend @r{(C++ only)} @opindex Wno-non-template-friend Disable warnings when non-templatized friend functions are declared -within a template. With the advent of explicit template specification +within a template. Since the advent of explicit template specification support in G++, if the name of the friend is an unqualified-id (i.e., @samp{friend foo(int)}), the C++ language specification demands that the friend declare or define an ordinary, nontemplate function. (Section @@ -1664,7 +1664,7 @@ friend declare or define an ordinary, nontemplate function. (Section could be interpreted as a particular specialization of a templatized function. Because this non-conforming behavior is no longer the default behavior for G++, @option{-Wnon-template-friend} allows the compiler to -check existing code for potential trouble spots, and is on by default. +check existing code for potential trouble spots and is on by default. This new compiler behavior can be turned off with @option{-Wno-non-template-friend} which keeps the conformant compiler code but disables the helpful warning. @@ -1674,7 +1674,7 @@ but disables the helpful warning. Warn if an old-style (C-style) cast to a non-void type is used within a C++ program. The new-style casts (@samp{static_cast}, @samp{reinterpret_cast}, and @samp{const_cast}) are less vulnerable to -unintended effects, and much easier to grep for. +unintended effects and much easier to search for. @item -Woverloaded-virtual @r{(C++ only)} @opindex Woverloaded-virtual @@ -1694,7 +1694,7 @@ struct B: public A @{ @end smallexample the @code{A} class version of @code{f} is hidden in @code{B}, and code -like this: +like: @smallexample B* b; @@ -1711,7 +1711,7 @@ to a plain pointer. @item -Wsign-promo @r{(C++ only)} @opindex Wsign-promo Warn when overload resolution chooses a promotion from unsigned or -enumeral type to a signed type over a conversion to an unsigned type of +enumeral type to a signed type, over a conversion to an unsigned type of the same size. Previous versions of G++ would try to preserve unsignedness, but the standard mandates the current behavior. @@ -1746,7 +1746,7 @@ In this example, G++ will synthesize a default @samp{A& operator = @cindex Objective-C options, command line @cindex options, Objective-C This section describes the command-line options that are only meaningful -for Objective-C programs; but you can also use most of the GNU compiler +for Objective-C programs, but you can also use most of the GNU compiler options regardless of what language your program is in. For example, you might compile a file @code{some_class.m} like this: @@ -1755,7 +1755,7 @@ gcc -g -fgnu-runtime -O -c some_class.m @end example @noindent -In this example, only @option{-fgnu-runtime} is an option meant only for +In this example, @option{-fgnu-runtime} is an option meant only for Objective-C programs; you can use the other options with any language supported by GCC@. @@ -1801,8 +1801,8 @@ and no warning is issued for them. Warn if multiple methods of different types for the same selector are found during compilation. The check is performed on the list of methods in the final stage of compilation. Additionally, a check is performed -that for each selector appearing in a @code{@@selector(@dots{})} -expression, a corresponding method with that selector has been found +for each selector appearing in a @code{@@selector(@dots{})} +expression, and a corresponding method for that selector has been found during compilation. Because these checks scan the method table only at the end of compilation, these warnings are not produced if the final stage of compilation is not reached, for example because an error is @@ -1813,13 +1813,13 @@ being used. @opindex Wundeclared-selector Warn if a @code{@@selector(@dots{})} expression referring to an undeclared selector is found. A selector is considered undeclared if no -method with that name has been declared (explicitly, in an -@code{@@interface} or @code{@@protocol} declaration, or implicitly, in -an @code{@@implementation} section) before the -@code{@@selector(@dots{})} expression. This option always performs its -checks as soon as a @code{@@selector(@dots{})} expression is found -(while @code{-Wselector} only performs its checks in the final stage of -compilation), and so additionally enforces the coding style convention +method with that name has been declared before the +@code{@@selector(@dots{})} expression, either explicitly in an +@code{@@interface} or @code{@@protocol} declaration, or implicitly in +an @code{@@implementation} section. This option always performs its +checks as soon as a @code{@@selector(@dots{})} expression is found, +while @code{-Wselector} only performs its checks in the final stage of +compilation. This also enforces the coding style convention that methods and selectors must be declared before being used. @c not documented because only avail via -Wp @@ -2386,7 +2386,7 @@ For example, an expression such as @samp{x[i,j]} will cause a warning, but @samp{x[(void)i,j]} will not. @item -An unsigned value is compared against zero with @samp{<} or @samp{<=}. +An unsigned value is compared against zero with @samp{<} or @samp{>=}. @item A comparison like @samp{x<=y<=z} appears; this is equivalent to @@ -3447,7 +3447,7 @@ optimizations designed to reduce code size. @option{-Os} disables the following optimization flags: @gccoptlist{-falign-functions -falign-jumps -falign-loops @gol --falign-labels -freorder-blocks -fprefetch-loop-arrays} +-falign-labels -freorder-blocks -fprefetch-loop-arrays} If you use multiple @option{-O} options, with or without level numbers, the last such option is the one that is effective. @@ -3559,7 +3559,7 @@ specified individually by using @option{--param @var{name}=@var{value}}. The @option{-finline-limit=@var{n}} option sets some of these parameters as follows: - @table @gcctabopt +@table @gcctabopt @item max-inline-insns is set to @var{n}. @item max-inline-insns-single @@ -3570,7 +3570,7 @@ as follows: is set to 130 or @var{n}/4, whichever is smaller. @item max-inline-insns-rtl is set to @var{n}. - @end table +@end table Using @option{-finline-limit=600} thus results in the default settings for these parameters. See below for a documentation of the individual @@ -4259,7 +4259,6 @@ using the ELF object format and SPARC processors running Solaris 2 have linkers with such optimizations. AIX may have these optimizations in the future. - Only use these options when there are significant benefits from doing so. When you specify these options, the assembler and linker will create larger object and executable files and will also be slower. @@ -5016,7 +5015,7 @@ for each @samp{%g.s} and another for each @samp{%U.s}. Previously, @samp{%U} wa simply substituted with a file name chosen for the previous @samp{%u}, without regard to any appended suffix. -@item %j@var{SUFFIX} +@item %j@var{suffix} Substitutes the name of the @code{HOST_BIT_BUCKET}, if any, and if it is writable, and if save-temps is off; otherwise, substitute the name of a temporary file, just like @samp{%u}. This temporary file is not @@ -5780,6 +5779,22 @@ ABI@. Thus, it's intended only for use on targets where the developer acknowledges that their resulting code will not be directly in line with the rules of the ABI@. +@item -mimpure-text +@opindex mimpure-text +@option{-mimpure-text}, used in addition to @option{-shared}, tells +the compiler to not pass @option{-z text} to the linker when linking a +shared object. Using this option, you can link position-dependent +code into a shared object. + +@option{-mimpure-text} suppresses the ``relocations remain against +allocatable but non-writable sections'' linker error message. +However, the necessary relocations will trigger copy-on-write, and the +shared object is not actually shared across processes. Instead of +using @option{-mimpure-text}, you should compile all source code with +@option{-fpic} or @option{-fPIC}. + +This option is only available on SunOS and Solaris. + @item -mv8 @itemx -msparclite @opindex mv8 @@ -5888,7 +5903,8 @@ on SPARC V9 processors in 64-bit environments. @table @gcctabopt @item -mlittle-endian @opindex mlittle-endian -Generate code for a processor running in little-endian mode. +Generate code for a processor running in little-endian mode. It is only +available for a few configurations and most notably not on Solaris. @item -m32 @itemx -m64 @@ -7222,7 +7238,7 @@ This option sets flags for both the preprocessor and linker. @cindex Darwin options These options are defined for all architectures running the Darwin operating -system. These are useful for compatibility with other Mac OS compilers. +system. They are useful for compatibility with other Mac OS compilers. @table @gcctabopt @item -all_load @@ -7961,22 +7977,33 @@ the published application binary interface specifications for the 386 and will not be binary compatible with structures in code compiled without that switch. +@item -m96bit-long-double @item -m128bit-long-double +@opindex m96bit-long-double @opindex m128bit-long-double -Control the size of @code{long double} type. i386 application binary interface -specify the size to be 12 bytes, while modern architectures (Pentium and newer) -prefer @code{long double} aligned to 8 or 16 byte boundary. This is -impossible to reach with 12 byte long doubles in the array accesses. +These switches control the size of @code{long double} type. The i386 +application binary interface specifies the size to be 96 bits, +so @option{-m96bit-long-double} is the default in 32 bit mode. + +Modern architectures (Pentium and newer) would prefer @code{long double} +to be aligned to an 8 or 16 byte boundary. In arrays or structures +conforming to the ABI, this would not be possible. So specifying a +@option{-m128bit-long-double} will align @code{long double} +to a 16 byte boundary by padding the @code{long double} with an additional +32 bit zero. + +In the x86-64 compiler, @option{-m128bit-long-double} is the default choice as +its ABI specifies that @code{long double} is to be aligned on 16 byte boundary. + +Notice that neither of these options enable any extra precision over the x87 +standard of 80 bits for a @code{long double}. -@strong{Warning:} if you use the @option{-m128bit-long-double} switch, the +@strong{Warning:} if you override the default value for your target ABI, the structures and arrays containing @code{long double} will change their size as well as function calling convention for function taking @code{long double} -will be modified. +will be modified. Hence they will not be binary compatible with arrays or +structures in code compiled without that switch. -@item -m96bit-long-double -@opindex m96bit-long-double -Set the size of @code{long double} to 96 bits as required by the i386 -application binary interface. This is the default. @item -msvr3-shlib @itemx -mno-svr3-shlib @@ -9156,11 +9183,11 @@ option is on by default if you optimize. @itemx -mprolog-function @opindex mno-prolog-function @opindex mprolog-function -Do not use (do use) external functions to save and restore registers at -the prolog and epilog of a function. The external functions are slower, -but use less code space if more than one function saves the same number -of registers. The @option{-mprolog-function} option is on by default if -you optimize. +Do not use (do use) external functions to save and restore registers +at the prologue and epilogue of a function. The external functions +are slower, but use less code space if more than one function saves +the same number of registers. The @option{-mprolog-function} option +is on by default if you optimize. @item -mspace @opindex mspace diff --git a/contrib/gcc/doc/md.texi b/contrib/gcc/doc/md.texi index 6184fc3..822ec14 100644 --- a/contrib/gcc/doc/md.texi +++ b/contrib/gcc/doc/md.texi @@ -1,5 +1,5 @@ -@c Copyright (C) 1988, 1989, 1992, 1993, 1994, 1996, 1998, 1999, 2000, 2001, 2002 -@c Free Software Foundation, Inc. +@c Copyright (C) 1988, 1989, 1992, 1993, 1994, 1996, 1998, 1999, 2000, 2001, +@c 2002, 2003 Free Software Foundation, Inc. @c This is part of the GCC manual. @c For copying conditions, see the file gcc.texi. @@ -5514,8 +5514,8 @@ in such processors and suggestions for their representation. @cindex automaton based pipeline description This section describes constructions of the automaton based processor -pipeline description. The order of all mentioned below constructions -in the machine description file is not important. +pipeline description. The order of constructions within the machine +description file is not important. @findex define_automaton @cindex pipeline hazard recognizer @@ -5523,7 +5523,7 @@ The following optional construction describes names of automata generated and used for the pipeline hazards recognition. Sometimes the generated finite state automaton used by the pipeline hazard recognizer is large. If we use more than one automaton and bind functional -units to the automata, the summary size of the automata usually is +units to the automata, the total size of the automata is usually less than the size of the single automaton. If there is no one such construction, only one finite state automaton is generated. @@ -5533,12 +5533,12 @@ construction, only one finite state automaton is generated. @var{automata-names} is a string giving names of the automata. The names are separated by commas. All the automata should have unique names. -The automaton name is used in construction @code{define_cpu_unit} and +The automaton name is used in the constructions @code{define_cpu_unit} and @code{define_query_cpu_unit}. @findex define_cpu_unit @cindex processor functional units -Each processor functional unit used in description of instruction +Each processor functional unit used in the description of instruction reservations should be described by the following construction. @smallexample @@ -5599,7 +5599,7 @@ is negative, the cost is considered to be zero). You can always change the default costs for any description by using the target hook @code{TARGET_SCHED_ADJUST_COST} (@pxref{Scheduling}). -@var{insn-names} is a string giving the internal name of the insn. The +@var{insn-name} is a string giving the internal name of the insn. The internal names are used in constructions @code{define_bypass} and in the automaton description file generated for debugging. The internal name has nothing in common with the names in @code{define_insn}. It is a @@ -5685,7 +5685,7 @@ the common part by the following construction @var{reservation-name} is a string giving name of @var{regexp}. Functional unit names and reservation names are in the same name space. So the reservation names should be different from the -functional unit names and can not be reserved name @samp{nothing}. +functional unit names and can not be the reserved name @samp{nothing}. @findex define_bypass @cindex instruction latency time @@ -5772,8 +5772,8 @@ code. Currently there are the following options: @itemize @bullet @item @dfn{no-minimization} makes no minimization of the automaton. This is -only worth to do when we are going to query CPU functional unit -reservations in an automaton state. +only worth to do when we are debugging the description and need to +look more accurately at reservations of states. @item @dfn{time} means printing additional time statistics about diff --git a/contrib/gcc/doc/portability.texi b/contrib/gcc/doc/portability.texi index c3d8e39..b05698d 100644 --- a/contrib/gcc/doc/portability.texi +++ b/contrib/gcc/doc/portability.texi @@ -1,5 +1,5 @@ @c Copyright (C) 1988, 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998, -@c 1999, 2000, 2001 Free Software Foundation, Inc. +@c 1999, 2000, 2001, 2002 Free Software Foundation, Inc. @c This is part of the GCC manual. @c For copying conditions, see the file gcc.texi. @@ -8,10 +8,11 @@ @cindex portability @cindex GCC and portability -The main goal of GCC was to make a good, fast compiler for machines in -the class that the GNU system aims to run on: 32-bit machines that address -8-bit bytes and have several general registers. Elegance, theoretical -power and simplicity are only secondary. +GCC itself aims to be portable to any machine where @code{int} is at least +a 32-bit type. It aims to target machines with a flat (non-segmented) byte +addressed data address space (the code address space can be separate). +Target ABIs may have 8, 16, 32 or 64-bit @code{int} type. @code{char} +can be wider than 8 bits. GCC gets most of the information about the target machine from a machine description which gives an algebraic formula for each of the machine's diff --git a/contrib/gcc/doc/rtl.texi b/contrib/gcc/doc/rtl.texi index 302957c..605aad0 100644 --- a/contrib/gcc/doc/rtl.texi +++ b/contrib/gcc/doc/rtl.texi @@ -608,9 +608,22 @@ Stored in the @code{integrated} field and printed as @samp{/i}. @cindex @code{concat} and @samp{/u} @cindex @code{unchanging}, in @code{reg} and @code{mem} @item RTX_UNCHANGING_P (@var{x}) -Nonzero in a @code{reg}, @code{mem}, or @code{concat} if the memory -is set at most once, -anywhere. This does not mean that it is function invariant. +Nonzero in a @code{reg}, @code{mem}, or @code{concat} if the register or +memory is set at most once, anywhere. This does not mean that it is +function invariant. + +GCC uses this flag to determine whether two references conflict. As +implemented by @code{true_dependence} in @file{alias.c} for memory +references, unchanging memory can't conflict with non-unchanging memory; +a non-unchanging read can conflict with a non-unchanging write; an +unchanging read can conflict with an unchanging write (since there may +be a single store to this address to initialize it); and an unchanging +store can conflict with a non-unchanging read. This means we must make +conservative assumptions when choosing the value of this flag for a +memory reference to an object containing both unchanging and +non-unchanging fields: we must set the flag when writing to the object +and clear it when reading from the object. + Stored in the @code{unchanging} field and printed as @samp{/u}. @findex SCHED_GROUP_P @@ -687,13 +700,6 @@ Promoted variables are always either sign- or zero-extended to the wider mode on every assignment. Stored in the @code{in_struct} field and printed as @samp{/s}. -@findex SYMBOL_REF_FLAG -@cindex @code{symbol_ref} and @samp{/v} -@cindex @code{volatil}, in @code{symbol_ref} -@item SYMBOL_REF_FLAG (@var{x}) -In a @code{symbol_ref}, this is used as a flag for machine-specific purposes. -Stored in the @code{volatil} field and printed as @samp{/v}. - @findex SYMBOL_REF_USED @cindex @code{used}, in @code{symbol_ref} @item SYMBOL_REF_USED (@var{x}) @@ -707,6 +713,17 @@ once. Stored in the @code{used} field. @item SYMBOL_REF_WEAK (@var{x}) In a @code{symbol_ref}, indicates that @var{x} has been declared weak. Stored in the @code{integrated} field and printed as @samp{/i}. + +@findex SYMBOL_REF_FLAG +@cindex @code{symbol_ref} and @samp{/v} +@cindex @code{volatil}, in @code{symbol_ref} +@item SYMBOL_REF_FLAG (@var{x}) +In a @code{symbol_ref}, this is used as a flag for machine-specific purposes. +Stored in the @code{volatil} field and printed as @samp{/v}. + +Most uses of @code{SYMBOL_REF_FLAG} are historic and may be subsumed +by @code{SYMBOL_REF_FLAGS}. Certainly use of @code{SYMBOL_REF_FLAGS} +is mandatory if the target requires more than one bit of storage. @end table These are the fields to which the above macros refer: @@ -2195,9 +2212,9 @@ the operands of these. @item (set @var{lval} @var{x}) Represents the action of storing the value of @var{x} into the place represented by @var{lval}. @var{lval} must be an expression -representing a place that can be stored in: @code{reg} (or @code{subreg} -or @code{strict_low_part}), @code{mem}, @code{pc}, @code{parallel}, or -@code{cc0}. +representing a place that can be stored in: @code{reg} (or @code{subreg}, +@code{strict_low_part} or @code{zero_extract}), @code{mem}, @code{pc}, +@code{parallel}, or @code{cc0}. If @var{lval} is a @code{reg}, @code{subreg} or @code{mem}, it has a machine mode; then @var{x} must be valid for that mode. @@ -2210,10 +2227,10 @@ rest of the register receives an undefined value. Likewise, if the mode of the register, the rest of the register can be changed in an undefined way. -If @var{lval} is a @code{strict_low_part} of a @code{subreg}, then the -part of the register specified by the machine mode of the -@code{subreg} is given the value @var{x} and the rest of the register -is not changed. +If @var{lval} is a @code{strict_low_part} or @code{zero_extract} +of a @code{subreg}, then the part of the register specified by the +machine mode of the @code{subreg} is given the value @var{x} and +the rest of the register is not changed. If @var{lval} is @code{(cc0)}, it has no machine mode, and @var{x} may be either a @code{compare} expression or a value that may have any mode. diff --git a/contrib/gcc/doc/sourcebuild.texi b/contrib/gcc/doc/sourcebuild.texi index c60dcfa..c2222c0 100644 --- a/contrib/gcc/doc/sourcebuild.texi +++ b/contrib/gcc/doc/sourcebuild.texi @@ -1,4 +1,4 @@ -@c Copyright (C) 2002 Free Software Foundation, Inc. +@c Copyright (C) 2002, 2003 Free Software Foundation, Inc. @c This is part of the GCC manual. @c For copying conditions, see the file gcc.texi. @@ -466,10 +466,9 @@ following are also necessary: @itemize @bullet @item -At least one GNATS category for bugs in that front end and runtime +At least one Bugzilla component for bugs in that front end and runtime libraries. This category needs to be mentioned in -@file{gcc/gccbug.in}, and in @file{gnats.html} on the GCC web site, as -well as being added to the GNATS database. +@file{gcc/gccbug.in}, as well as being added to the Bugzilla database. @item Normally, one or more maintainers of that front end listed in @file{MAINTAINERS}. @@ -931,9 +930,9 @@ test cases and magic comments more. @node libgcj Tests @subsection The Java library test suites. -Runtime tests are executed via @samp{make check} from the @samp{testsuite} -directory of the libjava hierarchy in the build tree. Additional runtime -tests can be checked into this testsuite. +Runtime tests are executed via @samp{make check} in the +@file{@var{target}/libjava/testsuite} directory in the build +tree. Additional runtime tests can be checked into this testsuite. Regression testing of the core packages in libgcj is also covered by the Mauve test suite. The @uref{http://sources.redhat.com/mauve/,,Mauve Project} diff --git a/contrib/gcc/doc/trouble.texi b/contrib/gcc/doc/trouble.texi index 4a8f0c3..a7e4200 100644 --- a/contrib/gcc/doc/trouble.texi +++ b/contrib/gcc/doc/trouble.texi @@ -993,7 +993,7 @@ inside @samp{func} in the example). g++ implements the ``intuitive'' algorithm for copy-assignment: assign all direct bases, then assign all members. In that algorithm, the virtual -base subobject can be encountered many times. In the example, copying +base subobject can be encountered more than once. In the example, copying proceeds in the following order: @samp{val}, @samp{name} (via @code{strdup}), @samp{bval}, and @samp{name} again. diff --git a/contrib/gcc/dwarf2out.c b/contrib/gcc/dwarf2out.c index e624bc9..75e842c 100644 --- a/contrib/gcc/dwarf2out.c +++ b/contrib/gcc/dwarf2out.c @@ -10383,14 +10383,15 @@ gen_enumeration_type_die (type, context_die) add_name_attribute (enum_die, IDENTIFIER_POINTER (TREE_PURPOSE (link))); - if (host_integerp (TREE_VALUE (link), 0)) + if (host_integerp (TREE_VALUE (link), + TREE_UNSIGNED (TREE_TYPE (TREE_VALUE (link))))) { if (tree_int_cst_sgn (TREE_VALUE (link)) < 0) add_AT_int (enum_die, DW_AT_const_value, tree_low_cst (TREE_VALUE (link), 0)); else add_AT_unsigned (enum_die, DW_AT_const_value, - tree_low_cst (TREE_VALUE (link), 0)); + tree_low_cst (TREE_VALUE (link), 1)); } } } diff --git a/contrib/gcc/expr.c b/contrib/gcc/expr.c index de68218..f0e63bc 100644 --- a/contrib/gcc/expr.c +++ b/contrib/gcc/expr.c @@ -153,7 +153,7 @@ static rtx clear_storage_via_libcall PARAMS ((rtx, rtx)); static tree clear_storage_libcall_fn PARAMS ((int)); static rtx compress_float_constant PARAMS ((rtx, rtx)); static rtx get_subtarget PARAMS ((rtx)); -static int is_zeros_p PARAMS ((tree)); +static int is_zeros_p PARAMS ((tree)); static int mostly_zeros_p PARAMS ((tree)); static void store_constructor_field PARAMS ((rtx, unsigned HOST_WIDE_INT, HOST_WIDE_INT, enum machine_mode, @@ -177,6 +177,7 @@ static rtx do_store_flag PARAMS ((tree, rtx, enum machine_mode, int)); static void emit_single_push_insn PARAMS ((enum machine_mode, rtx, tree)); #endif static void do_tablejump PARAMS ((rtx, enum machine_mode, rtx, rtx, rtx)); +static rtx const_vector_from_tree PARAMS ((tree)); /* Record for each mode whether we can move a register directly to or from an object of that mode in memory. If we can't, we won't try @@ -2659,6 +2660,9 @@ can_store_by_pieces (len, constfun, constfundata, align) int reverse; rtx cst; + if (len == 0) + return 1; + if (! MOVE_BY_PIECES_P (len, align)) return 0; @@ -2734,6 +2738,9 @@ store_by_pieces (to, len, constfun, constfundata, align) { struct store_by_pieces data; + if (len == 0) + return; + if (! MOVE_BY_PIECES_P (len, align)) abort (); to = protect_from_queue (to, 1); @@ -2756,6 +2763,9 @@ clear_by_pieces (to, len, align) { struct store_by_pieces data; + if (len == 0) + return; + data.constfun = clear_by_pieces_1; data.constfundata = NULL; data.len = len; @@ -2926,7 +2936,9 @@ clear_storage (object, size) object = protect_from_queue (object, 1); size = protect_from_queue (size, 0); - if (GET_CODE (size) == CONST_INT + if (GET_CODE (size) == CONST_INT && INTVAL (size) == 0) + ; + else if (GET_CODE (size) == CONST_INT && CLEAR_BY_PIECES_P (INTVAL (size), align)) clear_by_pieces (object, INTVAL (size), align); else if (clear_storage_via_clrstr (object, size, align)) @@ -4802,11 +4814,13 @@ store_constructor (exp, target, cleared, size) { tree elt; + /* If size is zero or the target is already cleared, do nothing. */ + if (size == 0 || cleared) + cleared = 1; /* We either clear the aggregate or indicate the value is dead. */ - if ((TREE_CODE (type) == UNION_TYPE - || TREE_CODE (type) == QUAL_UNION_TYPE) - && ! cleared - && ! CONSTRUCTOR_ELTS (exp)) + else if ((TREE_CODE (type) == UNION_TYPE + || TREE_CODE (type) == QUAL_UNION_TYPE) + && ! CONSTRUCTOR_ELTS (exp)) /* If the constructor is empty, clear the union. */ { clear_storage (target, expr_size (exp)); @@ -4817,7 +4831,7 @@ store_constructor (exp, target, cleared, size) set the initial value as zero so we can fold the value into a constant. But if more than one register is involved, this probably loses. */ - else if (! cleared && GET_CODE (target) == REG && TREE_STATIC (exp) + else if (GET_CODE (target) == REG && TREE_STATIC (exp) && GET_MODE_SIZE (GET_MODE (target)) <= UNITS_PER_WORD) { emit_move_insn (target, CONST0_RTX (GET_MODE (target))); @@ -4829,10 +4843,8 @@ store_constructor (exp, target, cleared, size) clear the whole structure first. Don't do this if TARGET is a register whose mode size isn't equal to SIZE since clear_storage can't handle this case. */ - else if (! cleared && size > 0 - && ((list_length (CONSTRUCTOR_ELTS (exp)) - != fields_length (type)) - || mostly_zeros_p (exp)) + else if (((list_length (CONSTRUCTOR_ELTS (exp)) != fields_length (type)) + || mostly_zeros_p (exp)) && (GET_CODE (target) != REG || ((HOST_WIDE_INT) GET_MODE_SIZE (GET_MODE (target)) == size))) @@ -6782,6 +6794,9 @@ expand_expr (exp, target, tmode, modifier) return temp; + case VECTOR_CST: + return const_vector_from_tree (exp); + case CONST_DECL: return expand_expr (DECL_INITIAL (exp), target, VOIDmode, modifier); @@ -11232,4 +11247,41 @@ vector_mode_valid_p (mode) return mov_optab->handlers[innermode].insn_code != CODE_FOR_nothing; } +/* Return a CONST_VECTOR rtx for a VECTOR_CST tree. */ +static rtx +const_vector_from_tree (exp) + tree exp; +{ + rtvec v; + int units, i; + tree link, elt; + enum machine_mode inner, mode; + + mode = TYPE_MODE (TREE_TYPE (exp)); + + if (is_zeros_p (exp)) + return CONST0_RTX (mode); + + units = GET_MODE_NUNITS (mode); + inner = GET_MODE_INNER (mode); + + v = rtvec_alloc (units); + + link = TREE_VECTOR_CST_ELTS (exp); + for (i = 0; link; link = TREE_CHAIN (link), ++i) + { + elt = TREE_VALUE (link); + + if (TREE_CODE (elt) == REAL_CST) + RTVEC_ELT (v, i) = CONST_DOUBLE_FROM_REAL_VALUE (TREE_REAL_CST (elt), + inner); + else + RTVEC_ELT (v, i) = immed_double_const (TREE_INT_CST_LOW (elt), + TREE_INT_CST_HIGH (elt), + inner); + } + + return gen_rtx_raw_CONST_VECTOR (mode, v); +} + #include "gt-expr.h" diff --git a/contrib/gcc/f/ChangeLog b/contrib/gcc/f/ChangeLog index 57838b0..0fb213d 100644 --- a/contrib/gcc/f/ChangeLog +++ b/contrib/gcc/f/ChangeLog @@ -1,3 +1,11 @@ +2003-08-04 Release Manager + + * GCC 3.3.1 Released. + +2003-08-04 Release Manager + + * GCC 3.3.1 Released. + 2003-07-09 Toon Moene <toon@moene.indiv.nluug.nl> PR Fortran/11301 diff --git a/contrib/gcc/flow.c b/contrib/gcc/flow.c index 3389766..7882b25 100644 --- a/contrib/gcc/flow.c +++ b/contrib/gcc/flow.c @@ -1757,8 +1757,10 @@ propagate_one_insn (pbi, insn) if (GET_CODE (insn) == CALL_INSN) { - int i; + regset live_at_end; + bool sibcall_p; rtx note, cond; + int i; cond = NULL_RTX; if (GET_CODE (PATTERN (insn)) == COND_EXEC) @@ -1783,9 +1785,19 @@ propagate_one_insn (pbi, insn) mark_set_1 (pbi, CLOBBER, XEXP (XEXP (note, 0), 0), cond, insn, pbi->flags); - /* Calls change all call-used and global registers. */ + /* Calls change all call-used and global registers; sibcalls do not + clobber anything that must be preserved at end-of-function, + except for return values. */ + + sibcall_p = SIBLING_CALL_P (insn); + live_at_end = EXIT_BLOCK_PTR->global_live_at_start; for (i = 0; i < FIRST_PSEUDO_REGISTER; i++) - if (TEST_HARD_REG_BIT (regs_invalidated_by_call, i)) + if (TEST_HARD_REG_BIT (regs_invalidated_by_call, i) + && ! (sibcall_p + && REGNO_REG_SET_P (live_at_end, i) + && ! refers_to_regno_p (i, i+1, + current_function_return_rtx, + (rtx *) 0))) { /* We do not want REG_UNUSED notes for these registers. */ mark_set_1 (pbi, CLOBBER, regno_reg_rtx[i], cond, insn, diff --git a/contrib/gcc/gcse.c b/contrib/gcc/gcse.c index 8c4e71b..241357e 100644 --- a/contrib/gcc/gcse.c +++ b/contrib/gcc/gcse.c @@ -3954,9 +3954,12 @@ try_replace_reg (from, to, insn) && validate_change (insn, &SET_SRC (set), src, 0)) success = 1; - /* If we've failed to do replacement, have a single SET, and don't already - have a note, add a REG_EQUAL note to not lose information. */ - if (!success && note == 0 && set != 0) + /* If we've failed to do replacement, have a single SET, don't already + have a note, and have no special SET, add a REG_EQUAL note to not + lose information. */ + if (!success && note == 0 && set != 0 + && GET_CODE (XEXP (set, 0)) != ZERO_EXTRACT + && GET_CODE (XEXP (set, 0)) != SIGN_EXTRACT) note = set_unique_reg_note (insn, REG_EQUAL, copy_rtx (src)); } diff --git a/contrib/gcc/integrate.c b/contrib/gcc/integrate.c index d1be237..7e36070f 100644 --- a/contrib/gcc/integrate.c +++ b/contrib/gcc/integrate.c @@ -380,6 +380,8 @@ copy_decl_for_inlining (decl, from_fn, to_fn) else { copy = copy_node (decl); + /* The COPY is not abstract; it will be generated in TO_FN. */ + DECL_ABSTRACT (copy) = 0; (*lang_hooks.dup_lang_specific_decl) (copy); /* TREE_ADDRESSABLE isn't used to indicate that a label's diff --git a/contrib/gcc/libgcc-std.ver b/contrib/gcc/libgcc-std.ver index fc686c4..b0bd365 100644 --- a/contrib/gcc/libgcc-std.ver +++ b/contrib/gcc/libgcc-std.ver @@ -184,3 +184,9 @@ GCC_3.3 { _Unwind_Resume_or_Rethrow _Unwind_SjLj_Resume_or_Rethrow } + +%inherit GCC_3.3.1 GCC_3.3 +GCC_3.3.1 { + __gcc_personality_sj0 + __gcc_personality_v0 +} diff --git a/contrib/gcc/loop.c b/contrib/gcc/loop.c index 8e6f9b5..284d891 100644 --- a/contrib/gcc/loop.c +++ b/contrib/gcc/loop.c @@ -7865,11 +7865,12 @@ loop_iv_add_mult_emit_before (loop, b, m, a, reg, before_bb, before_insn) update_reg_last_use (b, before_insn); update_reg_last_use (m, before_insn); - loop_insn_emit_before (loop, before_bb, before_insn, seq); - /* It is possible that the expansion created lots of new registers. - Iterate over the sequence we just created and record them all. */ + Iterate over the sequence we just created and record them all. We + must do this before inserting the sequence. */ loop_regs_update (loop, seq); + + loop_insn_emit_before (loop, before_bb, before_insn, seq); } @@ -7894,11 +7895,12 @@ loop_iv_add_mult_sink (loop, b, m, a, reg) update_reg_last_use (b, loop->sink); update_reg_last_use (m, loop->sink); - loop_insn_sink (loop, seq); - /* It is possible that the expansion created lots of new registers. - Iterate over the sequence we just created and record them all. */ + Iterate over the sequence we just created and record them all. We + must do this before inserting the sequence. */ loop_regs_update (loop, seq); + + loop_insn_sink (loop, seq); } @@ -7917,11 +7919,12 @@ loop_iv_add_mult_hoist (loop, b, m, a, reg) /* Use copy_rtx to prevent unexpected sharing of these rtx. */ seq = gen_add_mult (copy_rtx (b), copy_rtx (m), copy_rtx (a), reg); - loop_insn_hoist (loop, seq); - /* It is possible that the expansion created lots of new registers. - Iterate over the sequence we just created and record them all. */ + Iterate over the sequence we just created and record them all. We + must do this before inserting the sequence. */ loop_regs_update (loop, seq); + + loop_insn_hoist (loop, seq); } diff --git a/contrib/gcc/optabs.c b/contrib/gcc/optabs.c index c9eb3e6..d4eb640 100644 --- a/contrib/gcc/optabs.c +++ b/contrib/gcc/optabs.c @@ -3532,7 +3532,12 @@ prepare_operand (icode, x, opnum, mode, wider_mode, unsignedp) if (! (*insn_data[icode].operand[opnum].predicate) (x, insn_data[icode].operand[opnum].mode)) - x = copy_to_mode_reg (insn_data[icode].operand[opnum].mode, x); + { + if (no_new_pseudos) + return NULL_RTX; + x = copy_to_mode_reg (insn_data[icode].operand[opnum].mode, x); + } + return x; } @@ -5483,7 +5488,12 @@ gen_cond_trap (code, op1, op2, tcode) start_sequence (); op1 = prepare_operand (icode, op1, 0, mode, mode, 0); - op2 = prepare_operand (icode, op2, 0, mode, mode, 0); + op2 = prepare_operand (icode, op2, 1, mode, mode, 0); + if (!op1 || !op2) + { + end_sequence (); + return 0; + } emit_insn (GEN_FCN (icode) (op1, op2)); PUT_CODE (trap_rtx, code); diff --git a/contrib/gcc/sched-deps.c b/contrib/gcc/sched-deps.c index 98b0732..e261608 100644 --- a/contrib/gcc/sched-deps.c +++ b/contrib/gcc/sched-deps.c @@ -977,12 +977,17 @@ sched_analyze_insn (deps, x, insn, loop_notes) else { rtx pending, pending_mem; - regset_head tmp; - INIT_REG_SET (&tmp); + regset_head tmp_uses, tmp_sets; + INIT_REG_SET (&tmp_uses); + INIT_REG_SET (&tmp_sets); - (*current_sched_info->compute_jump_reg_dependencies) (insn, &tmp); - IOR_REG_SET (reg_pending_uses, &tmp); - CLEAR_REG_SET (&tmp); + (*current_sched_info->compute_jump_reg_dependencies) + (insn, &deps->reg_conditional_sets, &tmp_uses, &tmp_sets); + IOR_REG_SET (reg_pending_uses, &tmp_uses); + IOR_REG_SET (reg_pending_sets, &tmp_sets); + + CLEAR_REG_SET (&tmp_uses); + CLEAR_REG_SET (&tmp_sets); /* All memory writes and volatile reads must happen before the jump. Non-volatile reads must happen before the jump iff @@ -1079,6 +1084,7 @@ sched_analyze_insn (deps, x, insn, loop_notes) } flush_pending_lists (deps, insn, true, true); + CLEAR_REG_SET (&deps->reg_conditional_sets); reg_pending_barrier = false; } else @@ -1110,6 +1116,7 @@ sched_analyze_insn (deps, x, insn, loop_notes) add_dependence_list (insn, reg_last->clobbers, REG_DEP_OUTPUT); add_dependence_list (insn, reg_last->uses, REG_DEP_ANTI); reg_last->sets = alloc_INSN_LIST (insn, reg_last->sets); + SET_REGNO_REG_SET (&deps->reg_conditional_sets, i); }); } else @@ -1158,6 +1165,7 @@ sched_analyze_insn (deps, x, insn, loop_notes) reg_last->sets = alloc_INSN_LIST (insn, reg_last->sets); reg_last->uses_length = 0; reg_last->clobbers_length = 0; + CLEAR_REGNO_REG_SET (&deps->reg_conditional_sets, i); }); } @@ -1484,6 +1492,7 @@ init_deps (deps) deps->reg_last = (struct deps_reg *) xcalloc (max_reg, sizeof (struct deps_reg)); INIT_REG_SET (&deps->reg_last_in_use); + INIT_REG_SET (&deps->reg_conditional_sets); deps->pending_read_insns = 0; deps->pending_read_mems = 0; @@ -1526,6 +1535,7 @@ free_deps (deps) free_INSN_LIST_list (®_last->clobbers); }); CLEAR_REG_SET (&deps->reg_last_in_use); + CLEAR_REG_SET (&deps->reg_conditional_sets); free (deps->reg_last); } diff --git a/contrib/gcc/sched-ebb.c b/contrib/gcc/sched-ebb.c index e9d7482..47dd83f 100644 --- a/contrib/gcc/sched-ebb.c +++ b/contrib/gcc/sched-ebb.c @@ -52,7 +52,8 @@ static int schedule_more_p PARAMS ((void)); static const char *ebb_print_insn PARAMS ((rtx, int)); static int rank PARAMS ((rtx, rtx)); static int contributes_to_priority PARAMS ((rtx, rtx)); -static void compute_jump_reg_dependencies PARAMS ((rtx, regset)); +static void compute_jump_reg_dependencies PARAMS ((rtx, regset, regset, + regset)); static void schedule_ebb PARAMS ((rtx, rtx)); /* Return nonzero if there are more insns that should be scheduled. */ @@ -160,22 +161,30 @@ contributes_to_priority (next, insn) return 1; } -/* INSN is a JUMP_INSN. Store the set of registers that must be considered - to be set by this jump in SET. */ +/* INSN is a JUMP_INSN, COND_SET is the set of registers that are + conditionally set before INSN. Store the set of registers that + must be considered as used by this jump in USED and that of + registers that must be considered as set in SET. */ static void -compute_jump_reg_dependencies (insn, set) +compute_jump_reg_dependencies (insn, cond_set, used, set) rtx insn; - regset set; + regset cond_set, used, set; { basic_block b = BLOCK_FOR_INSN (insn); edge e; for (e = b->succ; e; e = e->succ_next) - if ((e->flags & EDGE_FALLTHRU) == 0) - { - bitmap_operation (set, set, e->dest->global_live_at_start, - BITMAP_IOR); - } + if (e->flags & EDGE_FALLTHRU) + /* The jump may be a by-product of a branch that has been merged + in the main codepath after being conditionalized. Therefore + it may guard the fallthrough block from using a value that has + conditionally overwritten that of the main codepath. So we + consider that it restores the value of the main codepath. */ + bitmap_operation (set, e->dest->global_live_at_start, cond_set, + BITMAP_AND); + else + bitmap_operation (used, used, e->dest->global_live_at_start, + BITMAP_IOR); } /* Used in schedule_insns to initialize current_sched_info for scheduling diff --git a/contrib/gcc/sched-int.h b/contrib/gcc/sched-int.h index 1b19656..765e1eb 100644 --- a/contrib/gcc/sched-int.h +++ b/contrib/gcc/sched-int.h @@ -112,6 +112,9 @@ struct deps /* Element N is set for each register that has any nonzero element in reg_last[N].{uses,sets,clobbers}. */ regset_head reg_last_in_use; + + /* Element N is set for each register that is conditionally set. */ + regset_head reg_conditional_sets; }; /* This structure holds some state of the current scheduling pass, and @@ -146,9 +149,9 @@ struct sched_info calculations. */ int (*contributes_to_priority) PARAMS ((rtx, rtx)); /* Called when computing dependencies for a JUMP_INSN. This function - should store the set of registers that must be considered as set by - the jump in the regset. */ - void (*compute_jump_reg_dependencies) PARAMS ((rtx, regset)); + should store the set of registers that must be considered as used + and the set of registers that must be considered as set by the jump. */ + void (*compute_jump_reg_dependencies) PARAMS ((rtx, regset, regset, regset)); /* The boundaries of the set of insns to be scheduled. */ rtx prev_head, next_tail; diff --git a/contrib/gcc/sched-rgn.c b/contrib/gcc/sched-rgn.c index 88545b2..935b8e2 100644 --- a/contrib/gcc/sched-rgn.c +++ b/contrib/gcc/sched-rgn.c @@ -1967,7 +1967,8 @@ static int schedule_more_p PARAMS ((void)); static const char *rgn_print_insn PARAMS ((rtx, int)); static int rgn_rank PARAMS ((rtx, rtx)); static int contributes_to_priority PARAMS ((rtx, rtx)); -static void compute_jump_reg_dependencies PARAMS ((rtx, regset)); +static void compute_jump_reg_dependencies PARAMS ((rtx, regset, regset, + regset)); /* Return nonzero if there are more insns that should be scheduled. */ @@ -2254,12 +2255,16 @@ contributes_to_priority (next, insn) return BLOCK_NUM (next) == BLOCK_NUM (insn); } -/* INSN is a JUMP_INSN. Store the set of registers that must be considered - to be set by this jump in SET. */ +/* INSN is a JUMP_INSN, COND_SET is the set of registers that are + conditionally set before INSN. Store the set of registers that + must be considered as used by this jump in USED and that of + registers that must be considered as set in SET. */ static void -compute_jump_reg_dependencies (insn, set) +compute_jump_reg_dependencies (insn, cond_set, used, set) rtx insn ATTRIBUTE_UNUSED; + regset cond_set ATTRIBUTE_UNUSED; + regset used ATTRIBUTE_UNUSED; regset set ATTRIBUTE_UNUSED; { /* Nothing to do here, since we postprocess jumps in diff --git a/contrib/gcc/toplev.c b/contrib/gcc/toplev.c index f213f2d..5abcf7f 100644 --- a/contrib/gcc/toplev.c +++ b/contrib/gcc/toplev.c @@ -2847,8 +2847,8 @@ rest_of_compilation (decl) open_dump_file (DFI_addressof, decl); purge_addressof (insns); - if (optimize) - purge_all_dead_edges (0); + if (optimize && purge_all_dead_edges (0)) + delete_unreachable_blocks (); reg_scan (insns, max_reg_num (), 1); close_dump_file (DFI_addressof, print_rtl, insns); diff --git a/contrib/gcc/tree-inline.c b/contrib/gcc/tree-inline.c index 28ceda1..4dc7e67 100644 --- a/contrib/gcc/tree-inline.c +++ b/contrib/gcc/tree-inline.c @@ -1003,7 +1003,8 @@ inlinable_function_p (fn, id) /* In case we don't disregard the inlining limits and we basically can inline this function, investigate further. */ if (! (*lang_hooks.tree_inlining.disregard_inline_limits) (fn) - && inlinable) + && inlinable + && currfn_insns > MIN_INLINE_INSNS) { int sum_insns = (id ? id->inlined_stmts : 0) * INSNS_PER_STMT + currfn_insns; @@ -1016,8 +1017,7 @@ inlinable_function_p (fn, id) with slope -1/MAX_INLINE_SLOPE to exceedingly decrease the allowable size. We always allow a size of MIN_INLINE_INSNS though. */ - else if ((sum_insns > MAX_INLINE_INSNS) - && (currfn_insns > MIN_INLINE_INSNS)) + else if (sum_insns > MAX_INLINE_INSNS) { int max_curr = MAX_INLINE_INSNS_SINGLE - (sum_insns - MAX_INLINE_INSNS) / MAX_INLINE_SLOPE; diff --git a/contrib/gcc/unroll.c b/contrib/gcc/unroll.c index 7f5a983..590cc94 100644 --- a/contrib/gcc/unroll.c +++ b/contrib/gcc/unroll.c @@ -3676,7 +3676,7 @@ loop_iterations (loop) if (find_common_reg_term (temp, reg2)) initial_value = temp; - else + else if (loop_invariant_p (loop, reg2)) { /* Find what reg2 is equivalent to. Hopefully it will either be reg1 or reg1 plus a constant. Let's ignore diff --git a/contrib/gcc/unwind-c.c b/contrib/gcc/unwind-c.c index 9ce0956..2730536 100644 --- a/contrib/gcc/unwind-c.c +++ b/contrib/gcc/unwind-c.c @@ -77,7 +77,6 @@ parse_lsda_header (struct _Unwind_Context *context, const unsigned char *p, #else #define PERSONALITY_FUNCTION __gcc_personality_v0 #endif -#define PERSONALITY_FUNCTION __gcc_personality_v0 _Unwind_Reason_Code PERSONALITY_FUNCTION (int, _Unwind_Action, _Unwind_Exception_Class, diff --git a/contrib/gcc/varasm.c b/contrib/gcc/varasm.c index 94be2d4..a7c84cd 100644 --- a/contrib/gcc/varasm.c +++ b/contrib/gcc/varasm.c @@ -4050,6 +4050,23 @@ output_constant (exp, size, align) thissize = MIN (TREE_STRING_LENGTH (exp), size); assemble_string (TREE_STRING_POINTER (exp), thissize); } + else if (TREE_CODE (exp) == VECTOR_CST) + { + int elt_size; + tree link; + unsigned int nalign; + enum machine_mode inner; + + inner = GET_MODE_INNER (TYPE_MODE (TREE_TYPE (exp))); + nalign = MIN (align, GET_MODE_ALIGNMENT (inner)); + + elt_size = GET_MODE_UNIT_SIZE (TYPE_MODE (TREE_TYPE (exp))); + + link = TREE_VECTOR_CST_ELTS (exp); + output_constant (TREE_VALUE (link), elt_size, align); + while ((link = TREE_CHAIN (link)) != NULL) + output_constant (TREE_VALUE (link), elt_size, nalign); + } else abort (); break; diff --git a/contrib/gcc/version.c b/contrib/gcc/version.c index 0fd5556..fadd8b1 100644 --- a/contrib/gcc/version.c +++ b/contrib/gcc/version.c @@ -6,7 +6,7 @@ please modify this string to indicate that, e.g. by putting your organization's name in parentheses at the end of the string. */ -const char version_string[] = "3.3.1 20030711 (prerelease)"; +const char version_string[] = "3.3.1"; /* This is the location of the online document giving instructions for reporting bugs. If you distribute a modified version of GCC, |