diff options
123 files changed, 3058 insertions, 1103 deletions
diff --git a/ChangeLog b/ChangeLog index e573aecf276..f62e3c18a94 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2010-11-02 Alan Modra <amodra@gmail.com> + + PR binutils/12110 + * configure.ac: Error when source path contains spaces. + * configure: Regenerate. + 2010-10-23 James E. Wilson <wilson@codesourcery.com> * MAINTAINERS: Update my email address. diff --git a/configure b/configure index b1fbfaa73d0..6c3d5d6f68a 100755 --- a/configure +++ b/configure @@ -1393,6 +1393,11 @@ fi case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac +case $srcdir in + *" "*) + as_fn_error "path to source, $srcdir, contains spaces" + ;; +esac ac_subdirs_all=`cd $srcdir && echo */configure | sed 's,/configure,,g'` for ac_var in $ac_precious_vars; do diff --git a/configure.ac b/configure.ac index bf5fe3ad832..ac44863917d 100644 --- a/configure.ac +++ b/configure.ac @@ -221,7 +221,14 @@ target_configdirs=`echo ${target_libraries} ${target_tools}` build_configdirs=`echo ${build_libs} ${build_tools}` m4_divert_text([PARSE_ARGS], -[ac_subdirs_all=`cd $srcdir && echo */configure | sed 's,/configure,,g'` +[case $srcdir in + *" "*) +m4_pushdef([AS_MESSAGE_LOG_FD], [])dnl + AC_MSG_ERROR([path to source, $srcdir, contains spaces]) +m4_popdef([AS_MESSAGE_LOG_FD])dnl + ;; +esac +ac_subdirs_all=`cd $srcdir && echo */configure | sed 's,/configure,,g'` ]) ################################################################################ diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9ed2904ff59..eedc19b3831 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,155 @@ +2010-11-01 Jason Merrill <jason@redhat.com> + + * fold-const.c (fold_indirect_ref_1): Handle folding + POINTER_PLUS_EXPR to ARRAY_REF. + +2010-11-01 Kaz Kojima <kkojima@gcc.gnu.org> + + * config/sh/sh.c (TARGET_DELEGITIMIZE_ADDRESS): Redefine. + (sh_delegitimize_address): New function. + +2010-11-01 Joseph Myers <joseph@codesourcery.com> + + * config/alpha/alpha.h (WORD_SWITCH_TAKES_ARG): Remove. + * config/cris/cris.h (WORD_SWITCH_TAKES_ARG): Remove. + (CC1_SPEC): Don't handle -target. + * config/darwin.h (WORD_SWITCH_TAKES_ARG): Remove single-argument + options. + * config/darwin.opt (Zallowable_client, Zbundle_loader, + Zdylib_file, Zexported_symbols_list, Zfn_seg_addr_table_filename, + Zimage_base, Zinit, Zinstall_name, Zmultiply_defined, + Zmultiplydefinedunused, Zseg_addr_table, Zsegs_read_only_addr, + Zsegs_read_write_addr, Zumbrella, Zunexported_symbols_list, + Zweak_reference_mismatches, client_name, compatibility_version, + current_version, dylinker_install_name, pagezero_size, + read_only_relocs, seg1addr, segs_read_only_addr, + segs_read_write_addr, sub_library, sub_umbrella): New. + * config/freebsd-spec.h (BSD_WORD_SWITCH_TAKES_ARG): Remove. + * config/freebsd.h (WORD_SWITCH_TAKES_ARG): Remove. + * config/freebsd.opt: New. + * config/interix.h (WORD_SWITCH_TAKES_ARG): Remove. + * config/mips/iris6.h (WORD_SWITCH_TAKES_ARG): Remove. + * config/rpath.opt: New. + * config.gcc (*-*-freebsd*): Use rpath.opt and freebsd.opt. + (alpha*-dec-osf5.1*, i[34567]86-*-interix3*, mips-sgi-irix6.5*): + Use rpath.opt. + +2010-11-01 Joseph Myers <joseph@codesourcery.com> + + * common.opt (R, T, Tbss, Tdata, Ttext, h, z): New. + * defaults.h (DEFAULT_SWITCH_TAKES_ARG, SWITCH_TAKES_ARG): Remove. + (DEFAULT_WORD_SWITCH_TAKES_ARG): Define to 0. + * doc/tm.texi.in (SWITCH_TAKES_ARG): Remove. + (WORD_SWITCH_TAKES_ARG): Don't refer to SWITCH_TAKES_ARG. + Document that options in .opt files do not need to be included. + * doc/tm.texi: Regenerate. + * gcc.c (LINK_COMMAND_SPEC): Don't include %{x}. + * opts-common.c: Update comment on tm.h include. + (decode_cmdline_option): Don't use SWITCH_TAKES_ARG. + * system.h (SWITCH_TAKES_ARG): Poison. + * config/alpha/alpha.h (SWITCH_TAKES_ARG): Remove. + * config/darwin.h (WORD_SWITCH_TAKES_ARG): Remove options included + in darwin.opt. + (LINK_COMMAND_SPEC_A): Don't include %{x}. + * config/fr30/fr30.h (SWITCH_TAKES_ARG, WORD_SWITCH_TAKES_ARG): + Remove. + * config/freebsd-spec.h (FBSD_SWITCH_TAKES_ARG): Remove. + * config/freebsd.h (SWITCH_TAKES_ARG): Remove. + * config/frv/frv.h (SWITCH_TAKES_ARG, WORD_SWITCH_TAKES_ARG): + Remove. + * config/i386/djgpp.h (LINK_COMMAND_SPEC): Don't include %{x}. + * config/ia64/ia64.h (SWITCH_TAKES_ARG): Remove. + * config/interix.h (WORD_SWITCH_TAKES_ARG): Don't handle -T + options. + * config/lm32/lm32.h (SWITCH_TAKES_ARG): Remove. + * config/m32r/m32r.h (SWITCH_TAKES_ARG, WORD_SWITCH_TAKES_ARG): + Remove. + * config/microblaze/microblaze.h (SWITCH_TAKES_ARG): Remove. + * config/mips/mips.h (SWITCH_TAKES_ARG): Remove. + * config/mips/netbsd.h (SWITCH_TAKES_ARG): Remove. + * config/mips/vxworks.h (SWITCH_TAKES_ARG): Remove. + * config/netbsd-aout.h (SWITCH_TAKES_ARG): Remove. + * config/netbsd-elf.h (SWITCH_TAKES_ARG): Remove. + * config/openbsd.h (SWITCH_TAKES_ARG): Remove. + * config/rs6000/sysv4.h (SWITCH_TAKES_ARG): Remove. + * config/score/score.h (SWITCH_TAKES_ARG): Remove. + * config/sol2.h (SWITCH_TAKES_ARG): Remove. + * config/sparc/sp-elf.h (SWITCH_TAKES_ARG): Remove. + * config/sparc/sp64-elf.h (SWITCH_TAKES_ARG): Remove. + * config/sparc/sparc.h (ASM_SPEC): Don't include %{R}. + * config/svr4.h (SWITCH_TAKES_ARG, WORD_SWITCH_TAKES_ARG): Remove. + +2010-11-01 Paul Koning <ni1d@arrl.net> + + * config/pdp11/pdp11.md: Use iterators. + (addqi3, subqi3, iorsi3, xorsi3): Delete. + +2010-11-01 Steve Ellcey <sje@cup.hp.com> + + * defaults.h (TARGET_VTABLE_USES_DESCRIPTORS): Move under ifdef + GCC_INSN_FLAGS_H. + * libgcov.c (__gcov_indirect_call_profiler): Set + VTABLE_USES_DESCRIPTORS if TARGET_VTABLE_USES_DESCRIPTORS is + defined and use in place of TARGET_VTABLE_USES_DESCRIPTORS. + +2010-11-01 Nathan Froyd <froydnj@codesourcery.com> + + PR tree-optimization/46259 + + Revert: + + 2010-10-30 Nathan Froyd <froydnj@codesourcery.com> + + * tree-vect-stmts.c (vect_get_vec_def_for_operand): Use + build_vector_from_val. + +2010-11-01 DJ Delorie <dj@redhat.com> + + * config/rx/rx.h (TARGET_CPU_CPP_BUILTINS): Add define for RX610 + as well as an assertion. + +2010-11-01 Paul Koning <ni1d@arrl.net> + + * config/pdp11/pdp11.c (pdp11_return_in_memory): Return vector and + complex modes in memory. + +2010-11-01 Nathan Froyd <froydnj@codesourcery.com> + + * tree.c (build_vector_from_val): Use useless_type_conversion_p. + +2010-11-01 Jakub Jelinek <jakub@redhat.com> + + PR target/45250 + * var-tracking.c (cfa_base_rtx): Move definition earlier in the file. + (cfa_base_offset): New variable. + (compute_cfa_pointer): Use cfa_base_rtx and cfa_base_offset. + (adjust_mems): Don't do any sp or hfp replacements if cfa_base_rtx + is NULL. + (vt_init_cfa_base): Initialize cfa_base_offset. + +2010-11-01 Alan Modra <amodra@gmail.com> + + PR target/46030 + * config/rs6000/rs6000.c (struct rs6000_stack): Add reload_completed + and savres_strategy. + (stack_info): New file scope var. + (rs6000_init_machine_status): Init stack_info. + (SAVRES_INLINE_FPRS, SAVRES_INLINE_GPRS, + SAVRES_NOINLINE_GPRS_SAVES_LR, SAVRES_NOINLINE_FPRS_SAVES_LR, + SAVRES_NOINLINE_FPRS_DOESNT_RESTORE_LR): Replace with.. + (SAVE_INLINE_FPRS, SAVE_INLINE_GPRS, REST_INLINE_FPRS, REST_INLINE_GPRS, + SAVE_NOINLINE_GPRS_SAVES_LR, SAVE_NOINLINE_FPRS_SAVES_LR + REST_NOINLINE_FPRS_DOESNT_RESTORE_LR): ..this. Update all refs. + (rs6000_savres_strategy): Rewrite. + (rs6000_stack_info): Use "stack_info" in place of local "info". + Return cached stack info when reload_completed unless ENABLE_CHECKING + in which case confirm newly calculated stack info matches old info. + Delay calculation of lr_save_p, set it for out of line gp save/restore + as well as fp. Call rs6000_savres_strategy from here.. + (rs6000_emit_prologue, rs6000_emit_epilogue): ..rather than here. + (rs6000_output_function_prologue): Use info->savres_strategy to + determine whether fp save/restore externs need to be emitted. + 2010-10-31 Jason Merrill <jason@redhat.com> * tree.h (EXPR_LOC_OR_HERE): New macro. @@ -3396,14 +3548,6 @@ 'unsigned int' can also be used instead of 'unsigned long' in countByEnumeratingWithState:objects:count:. -2009-12-15 Gabriel Dos Reis <gdr@cse.tamu.edu> - - * tree.h (VAR_DECL_P): New predicate macro. - (FUNCTION_DECL_P): Likewise. - (tree_base::lang_flag_7): New language flag. - (tree_base::spare): Decrease precision by one. - (TREE_LANG_FLAG_7): New. - 2010-10-07 Martin Jambor <mjambor@suse.cz> * tree-sra.c (struct access): New field grp_assignment_write. diff --git a/gcc/DATESTAMP b/gcc/DATESTAMP index 99f516105df..32efcfd54d4 100644 --- a/gcc/DATESTAMP +++ b/gcc/DATESTAMP @@ -1 +1 @@ -20101101 +20101102 diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 897b808be81..b2c90110fef 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,9 @@ +2010-11-01 Nicola Pero <nicola.pero@meta-innovation.com> + + Implemented format and noreturn attributes for Objective-C methods. + * c-common.c (handle_noreturn_attribute): Recognize 'noreturn' + attribute for Objective-C methods. + 2010-10-31 Jason Merrill <jason@redhat.com> * c-common.c (conversion_warning, warn_for_collisions_1): Use @@ -177,12 +183,6 @@ * c-opts.c (c_common_init_options_struct): New. Split out from c_common_init_options. -2010-10-20 Jason Merrill <jason@redhat.com> - - * c-common.c (check_case_value): Remove special C++ handling. - - * c-common.c (c_common_reswords): Add __is_literal_type. - 2010-10-06 Nicola Pero <nicola.pero@meta-innovation.com> Implemented fast enumeration for Objective-C. diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c index 923c63afa13..ab050ab2e68 100644 --- a/gcc/c-family/c-common.c +++ b/gcc/c-family/c-common.c @@ -5729,7 +5729,8 @@ handle_noreturn_attribute (tree *node, tree name, tree ARG_UNUSED (args), tree type = TREE_TYPE (*node); /* See FIXME comment in c_common_attribute_table. */ - if (TREE_CODE (*node) == FUNCTION_DECL) + if (TREE_CODE (*node) == FUNCTION_DECL + || objc_method_decl (TREE_CODE (*node))) TREE_THIS_VOLATILE (*node) = 1; else if (TREE_CODE (type) == POINTER_TYPE && TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE) diff --git a/gcc/common.opt b/gcc/common.opt index a74d60da620..cd8b0adfff1 100644 --- a/gcc/common.opt +++ b/gcc/common.opt @@ -290,9 +290,24 @@ Ofast Common Optimization Optimize for speed disregarding exact standards compliance +R +Driver Joined Separate + S Driver +T +Driver Joined Separate + +Tbss +Driver Separate + +Tdata +Driver Separate + +Ttext +Driver Separate + W Common RejectNegative Warning Alias(Wextra) This switch is deprecated; use -Wextra instead @@ -1885,6 +1900,9 @@ gxcoff+ Common JoinedOrMissing Negative(gcoff) Generate debug information in extended XCOFF format +h +Driver Joined Separate + iplugindir= Common Joined Var(plugindir_string) Init(0) -iplugindir=<dir> Set <dir> to be the default plugin directory @@ -2026,4 +2044,7 @@ pie Common RejectNegative Negative(shared) Create a position independent executable +z +Driver Joined Separate + ; This comment is to ensure we retain the blank line above. diff --git a/gcc/config.gcc b/gcc/config.gcc index b353fa00c20..64eaaefa3d2 100644 --- a/gcc/config.gcc +++ b/gcc/config.gcc @@ -528,6 +528,7 @@ case ${target} in ;; esac fbsd_tm_file="${fbsd_tm_file} freebsd-spec.h freebsd.h freebsd-stdint.h" + extra_options="$extra_options rpath.opt freebsd.opt" case ${target} in *-*-freebsd[345].*) :;; @@ -727,6 +728,7 @@ alpha*-dec-osf5.1*) tmake_file="alpha/t-alpha alpha/t-ieee alpha/t-crtfm alpha/t-osf5" tm_file="${tm_file} alpha/osf5.h" tm_defines="${tm_defines} TARGET_SUPPORT_ARCH=1" + extra_options="${extra_options} rpath.opt" extra_headers=va_list.h use_gcc_stdint=provide case ${enable_threads} in @@ -1518,6 +1520,7 @@ i[34567]86-*-mingw* | x86_64-*-mingw*) i[34567]86-*-interix3*) tm_file="${tm_file} i386/unix.h i386/bsd.h i386/gas.h i386/i386-interix.h i386/i386-interix3.h interix.h interix3.h" tmake_file="${tmake_file} i386/t-interix" + extra_options="${extra_options} rpath.opt" extra_objs=winnt.o target_gtfiles="\$(srcdir)/config/i386/winnt.c" if test x$enable_threads = xyes ; then @@ -1784,6 +1787,7 @@ microblaze*-*-*) mips-sgi-irix6.5*) tm_file="elfos.h ${tm_file} mips/iris6.h" tmake_file="mips/t-iris mips/t-iris6 mips/t-slibgcc-irix" + extra_options="${extra_options} rpath.opt" target_cpu_default="MASK_ABICALLS" tm_defines="${tm_defines} MIPS_ISA_DEFAULT=3 MIPS_ABI_DEFAULT=ABI_N32" # Only IRIX Development Foundation 1.3 for IRIX 6.5 provides stdint.h. diff --git a/gcc/config/alpha/alpha.h b/gcc/config/alpha/alpha.h index 21db01c8ec5..5426a6414ec 100644 --- a/gcc/config/alpha/alpha.h +++ b/gcc/config/alpha/alpha.h @@ -96,12 +96,6 @@ along with GCC; see the file COPYING3. If not see while (0) #endif -#define SWITCH_TAKES_ARG(CHAR) \ - (DEFAULT_SWITCH_TAKES_ARG (CHAR) || (CHAR) == 'G') - -#define WORD_SWITCH_TAKES_ARG(STR) \ - (!strcmp (STR, "rpath") || DEFAULT_WORD_SWITCH_TAKES_ARG(STR)) - /* Print subsidiary information on the compiler version in use. */ #define TARGET_VERSION diff --git a/gcc/config/cris/cris.h b/gcc/config/cris/cris.h index 776c44e2c81..a7b7e4d1e62 100644 --- a/gcc/config/cris/cris.h +++ b/gcc/config/cris/cris.h @@ -96,14 +96,6 @@ extern int cris_cpu_version; /* Node: Driver */ -/* When using make with defaults.mak for Sun this will handily remove - any "-target sun*" switches. */ -/* We need to override any previous definitions (linux.h) */ -#undef WORD_SWITCH_TAKES_ARG -#define WORD_SWITCH_TAKES_ARG(STR) \ - (DEFAULT_WORD_SWITCH_TAKES_ARG (STR) \ - || !strcmp (STR, "target")) - /* Also provide canonical vN definitions when user specifies an alias. Note that -melf overrides -maout. */ @@ -168,12 +160,10 @@ extern int cris_cpu_version; " -D__CRIS_arch_tune=" CRIS_DEFAULT_TUNE "}}}}}"\ CRIS_ARCH_CPP_DEFAULT -/* Remove those Sun-make "target" switches. */ /* Override previous definitions (linux.h). */ #undef CC1_SPEC #define CC1_SPEC \ - "%{target*:}\ - %{metrax4:-march=v3}\ + "%{metrax4:-march=v3}\ %{metrax100:-march=v8}\ %(cc1_subtarget)" diff --git a/gcc/config/darwin.h b/gcc/config/darwin.h index f6b88f97c98..c488db22103 100644 --- a/gcc/config/darwin.h +++ b/gcc/config/darwin.h @@ -198,45 +198,13 @@ extern GTY(()) int darwin_ms_struct; #undef WORD_SWITCH_TAKES_ARG #define WORD_SWITCH_TAKES_ARG(STR) \ (DEFAULT_WORD_SWITCH_TAKES_ARG (STR) ? 1 : \ - !strcmp (STR, "Zallowable_client") ? 1 : \ - !strcmp (STR, "arch") ? 1 : \ - !strcmp (STR, "arch_only") ? 1 : \ - !strcmp (STR, "Zbundle_loader") ? 1 : \ - !strcmp (STR, "client_name") ? 1 : \ - !strcmp (STR, "compatibility_version") ? 1 : \ - !strcmp (STR, "current_version") ? 1 : \ - !strcmp (STR, "Zdylib_file") ? 1 : \ - !strcmp (STR, "Zexported_symbols_list") ? 1 : \ - !strcmp (STR, "Zimage_base") ? 1 : \ - !strcmp (STR, "Zinit") ? 1 : \ - !strcmp (STR, "Zinstall_name") ? 1 : \ - !strcmp (STR, "Zmultiplydefinedunused") ? 1 : \ - !strcmp (STR, "Zmultiply_defined") ? 1 : \ - !strcmp (STR, "precomp-trustfile") ? 1 : \ - !strcmp (STR, "read_only_relocs") ? 1 : \ !strcmp (STR, "sectcreate") ? 3 : \ !strcmp (STR, "sectorder") ? 3 : \ !strcmp (STR, "Zsegaddr") ? 2 : \ - !strcmp (STR, "Zsegs_read_only_addr") ? 1 : \ - !strcmp (STR, "Zsegs_read_write_addr") ? 1 : \ - !strcmp (STR, "Zseg_addr_table") ? 1 : \ - !strcmp (STR, "Zfn_seg_addr_table_filename") ? 1 :\ - !strcmp (STR, "seg1addr") ? 1 : \ !strcmp (STR, "segprot") ? 3 : \ - !strcmp (STR, "sub_library") ? 1 : \ - !strcmp (STR, "sub_umbrella") ? 1 : \ - !strcmp (STR, "Zumbrella") ? 1 : \ - !strcmp (STR, "undefined") ? 1 : \ - !strcmp (STR, "Zunexported_symbols_list") ? 1 : \ - !strcmp (STR, "Zweak_reference_mismatches") ? 1 : \ - !strcmp (STR, "pagezero_size") ? 1 : \ - !strcmp (STR, "segs_read_only_addr") ? 1 : \ - !strcmp (STR, "segs_read_write_addr") ? 1 : \ !strcmp (STR, "sectalign") ? 3 : \ !strcmp (STR, "sectobjectsymbols") ? 2 : \ !strcmp (STR, "segcreate") ? 3 : \ - !strcmp (STR, "dylinker_install_name") ? 1 : \ - !strcmp (STR, "iframework") ? 1 : \ 0) #define SUBTARGET_C_COMMON_OVERRIDE_OPTIONS do { \ @@ -271,7 +239,7 @@ extern GTY(()) int darwin_ms_struct; #define LINK_COMMAND_SPEC_A \ "%{!fdump=*:%{!fsyntax-only:%{!c:%{!M:%{!MM:%{!E:%{!S:\ %(linker) %l %X %{d} %{s} %{t} %{Z} %{u*} \ - %{A} %{e*} %{m} %{r} %{x} \ + %{A} %{e*} %{m} %{r} \ %{o*}%{!o:-o a.out} \ %{!A:%{!nostdlib:%{!nostartfiles:%S}}} \ %{L*} %(link_libgcc) %o %{fprofile-arcs|fprofile-generate*|coverage:-lgcov} \ diff --git a/gcc/config/darwin.opt b/gcc/config/darwin.opt index afb122849f4..4435fea0987 100644 --- a/gcc/config/darwin.opt +++ b/gcc/config/darwin.opt @@ -1,6 +1,6 @@ ; Processor-independent options for Darwin. -; Copyright (C) 2005, 2007 Free Software Foundation, Inc. +; Copyright (C) 2005, 2007, 2010 Free Software Foundation, Inc. ; ; This file is part of GCC. ; @@ -54,5 +54,86 @@ iframework Target RejectNegative C ObjC C++ ObjC++ Joined Separate -iframework <dir> Add <dir> to the end of the system framework include path +Zallowable_client +Driver Separate + +Zbundle_loader +Driver Separate + +Zdylib_file +Driver Separate + +Zexported_symbols_list +Driver Separate + +Zfn_seg_addr_table_filename +Driver Separate + +Zimage_base +Driver Separate + +Zinit +Driver Separate + +Zinstall_name +Driver Separate + +Zmultiply_defined +Driver Separate + +Zmultiplydefinedunused +Driver Separate + +Zseg_addr_table +Driver Separate + +Zsegs_read_only_addr +Driver Separate + +Zsegs_read_write_addr +Driver Separate + +Zumbrella +Driver Separate + +Zunexported_symbols_list +Driver Separate + +Zweak_reference_mismatches +Driver Separate + +client_name +Driver Separate + +compatibility_version +Driver Separate + +current_version +Driver Separate + +dylinker_install_name +Driver Separate + +pagezero_size +Driver Separate + +read_only_relocs +Driver Separate + +seg1addr +Driver Separate + +segs_read_only_addr +Driver Separate + +segs_read_write_addr +Driver Separate + +sub_library +Driver Separate + +sub_umbrella +Driver Separate + undefined Driver Separate diff --git a/gcc/config/fr30/fr30.h b/gcc/config/fr30/fr30.h index 0ea72fd8c7c..ac42145f314 100644 --- a/gcc/config/fr30/fr30.h +++ b/gcc/config/fr30/fr30.h @@ -22,15 +22,6 @@ along with GCC; see the file COPYING3. If not see <http://www.gnu.org/licenses/>. */ /*}}}*/ -/*{{{ Driver configuration. */ - -/* Defined in svr4.h. */ -#undef SWITCH_TAKES_ARG - -/* Defined in svr4.h. */ -#undef WORD_SWITCH_TAKES_ARG - -/*}}}*/ /*{{{ Run-time target specifications. */ #undef ASM_SPEC diff --git a/gcc/config/freebsd-spec.h b/gcc/config/freebsd-spec.h index 84d81278af8..00b7407b1f4 100644 --- a/gcc/config/freebsd-spec.h +++ b/gcc/config/freebsd-spec.h @@ -1,5 +1,6 @@ /* Base configuration file for all FreeBSD targets. - Copyright (C) 1999, 2000, 2001, 2004, 2005, 2007, 2009 Free Software Foundation, Inc. + Copyright (C) 1999, 2000, 2001, 2004, 2005, 2007, 2009, 2010 + Free Software Foundation, Inc. This file is part of GCC. @@ -33,25 +34,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see /* In case we need to know. */ #define USING_CONFIG_FREEBSD_SPEC 1 -/* This defines which switch letters take arguments. On FreeBSD, most of - the normal cases (defined in gcc.c) apply, and we also have -h* and - -z* options (for the linker) (coming from SVR4). - We also have -R (alias --rpath), no -z, --soname (-h), --assert etc. */ - -#define FBSD_SWITCH_TAKES_ARG(CHAR) \ - (DEFAULT_SWITCH_TAKES_ARG (CHAR) \ - || (CHAR) == 'h' \ - || (CHAR) == 'z' /* ignored by ld */ \ - || (CHAR) == 'R') - -/* This defines which multi-letter switches take arguments. */ - -#define FBSD_WORD_SWITCH_TAKES_ARG(STR) \ - (DEFAULT_WORD_SWITCH_TAKES_ARG (STR) \ - || !strcmp ((STR), "rpath") || !strcmp ((STR), "rpath-link") \ - || !strcmp ((STR), "soname") || !strcmp ((STR), "defsym") \ - || !strcmp ((STR), "assert") || !strcmp ((STR), "dynamic-linker")) - #define FBSD_TARGET_OS_CPP_BUILTINS() \ do \ { \ diff --git a/gcc/config/freebsd.h b/gcc/config/freebsd.h index 591ce1a6667..1a7dac9630d 100644 --- a/gcc/config/freebsd.h +++ b/gcc/config/freebsd.h @@ -30,17 +30,6 @@ along with GCC; see the file COPYING3. If not see /* In case we need to know. */ #define USING_CONFIG_FREEBSD 1 -/* This defines which switch letters take arguments. On FreeBSD, most of - the normal cases (defined in gcc.c) apply, and we also have -h* and - -z* options (for the linker) (coming from SVR4). - We also have -R (alias --rpath), no -z, --soname (-h), --assert etc. */ - -#undef SWITCH_TAKES_ARG -#define SWITCH_TAKES_ARG(CHAR) (FBSD_SWITCH_TAKES_ARG(CHAR)) - -#undef WORD_SWITCH_TAKES_ARG -#define WORD_SWITCH_TAKES_ARG(STR) (FBSD_WORD_SWITCH_TAKES_ARG(STR)) - #undef TARGET_OS_CPP_BUILTINS #define TARGET_OS_CPP_BUILTINS() FBSD_TARGET_OS_CPP_BUILTINS() diff --git a/gcc/config/freebsd.opt b/gcc/config/freebsd.opt new file mode 100644 index 00000000000..26dc9dfdaa5 --- /dev/null +++ b/gcc/config/freebsd.opt @@ -0,0 +1,38 @@ +; FreeBSD options. + +; Copyright (C) 2010 +; Free Software Foundation, Inc. +; +; This file is part of GCC. +; +; 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 3, or (at your option) any later +; version. +; +; 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 GCC; see the file COPYING3. If not see +; <http://www.gnu.org/licenses/>. + +; See the GCC internals manual (options.texi) for a description of this file's format. + +; Please try to keep this file in ASCII collating order. + +assert +Driver Separate + +defsym +Driver Separate + +rpath-link +Driver Separate + +soname +Driver Separate + +; This comment is to ensure we retain the blank line above. diff --git a/gcc/config/frv/frv.h b/gcc/config/frv/frv.h index fc0f2930dc3..8a2907d682c 100644 --- a/gcc/config/frv/frv.h +++ b/gcc/config/frv/frv.h @@ -35,33 +35,6 @@ /* Driver configuration. */ -/* A C expression which determines whether the option `-CHAR' takes arguments. - The value should be the number of arguments that option takes-zero, for many - options. - - By default, this macro is defined to handle the standard options properly. - You need not define it unless you wish to add additional options which take - arguments. - - Defined in svr4.h. */ -#undef SWITCH_TAKES_ARG -#define SWITCH_TAKES_ARG(CHAR) \ - (DEFAULT_SWITCH_TAKES_ARG (CHAR) || (CHAR) == 'G') - -/* A C expression which determines whether the option `-NAME' takes arguments. - The value should be the number of arguments that option takes-zero, for many - options. This macro rather than `SWITCH_TAKES_ARG' is used for - multi-character option names. - - By default, this macro is defined as `DEFAULT_WORD_SWITCH_TAKES_ARG', which - handles the standard options properly. You need not define - `WORD_SWITCH_TAKES_ARG' unless you wish to add additional options which take - arguments. Any redefinition should call `DEFAULT_WORD_SWITCH_TAKES_ARG' and - then check for additional options. - - Defined in svr4.h. */ -#undef WORD_SWITCH_TAKES_ARG - /* -fpic and -fPIC used to imply the -mlibrary-pic multilib, but with FDPIC which multilib to use depends on whether FDPIC is in use or not. The trick we use is to introduce -multilib-library-pic as a diff --git a/gcc/config/i386/djgpp.h b/gcc/config/i386/djgpp.h index e95ee49365b..2a8cef6842b 100644 --- a/gcc/config/i386/djgpp.h +++ b/gcc/config/i386/djgpp.h @@ -102,7 +102,7 @@ along with GCC; see the file COPYING3. If not see #define LINK_COMMAND_SPEC \ "%{!fsyntax-only: \ %{!c:%{!M:%{!MM:%{!E:%{!S:%(linker) %l %X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} \ -\t%{r} %{s} %{t} %{u*} %{x} %{z} %{Z}\ +\t%{r} %{s} %{t} %{u*} %{z} %{Z}\ \t%{!A:%{!nostdlib:%{!nostartfiles:%S}}}\ \t%{static:} %{L*} %D %o\ \t%{!nostdlib:%{!nodefaultlibs:%G %L %G}}\ diff --git a/gcc/config/ia64/ia64.h b/gcc/config/ia64/ia64.h index fbee1e719b6..fdac455c6df 100644 --- a/gcc/config/ia64/ia64.h +++ b/gcc/config/ia64/ia64.h @@ -53,9 +53,6 @@ do { \ #define ASM_EXTRA_SPEC "" -#define SWITCH_TAKES_ARG(CHAR) \ - (DEFAULT_SWITCH_TAKES_ARG (CHAR) || (CHAR) == 'G') - /* Variables which are this size or smaller are put in the sdata/sbss sections. */ extern unsigned int ia64_section_threshold; diff --git a/gcc/config/interix.h b/gcc/config/interix.h index b94f35726de..658c534277a 100644 --- a/gcc/config/interix.h +++ b/gcc/config/interix.h @@ -1,6 +1,6 @@ /* Operating system specific defines to be used when targeting GCC for Interix - Copyright (C) 1994, 1995, 1999, 2002, 2004, 2007 + Copyright (C) 1994, 1995, 1999, 2002, 2004, 2007, 2010 Free Software Foundation, Inc. Donn Terry, Softway Systems, Inc. (donn@softway.com) Modified from code @@ -58,13 +58,6 @@ for windows/multi thread */ #define STARTFILE_SPEC \ "%{!shared:%{pg:gcrt0%O%s}%{!pg:%{p:mcrt0%O%s}%{!p:crt0%O%s}}} %{shared:crti%O%s}" -#undef WORD_SWITCH_TAKES_ARG -#define WORD_SWITCH_TAKES_ARG(STR) \ - ((DEFAULT_WORD_SWITCH_TAKES_ARG (STR) \ - || !strcmp(STR, "rpath")) \ - && strcmp (STR, "Tdata") && strcmp (STR, "Ttext") \ - && strcmp (STR, "Tbss")) - #define STDC_0_IN_SYSTEM_HEADERS 1 diff --git a/gcc/config/lm32/lm32.h b/gcc/config/lm32/lm32.h index bcea41aa3a1..c87c3bb705a 100644 --- a/gcc/config/lm32/lm32.h +++ b/gcc/config/lm32/lm32.h @@ -68,12 +68,6 @@ #undef LIB_SPEC #define LIB_SPEC "%{!T*:-T sim.ld}" -/* Add -G xx support. */ - -#undef SWITCH_TAKES_ARG -#define SWITCH_TAKES_ARG(CHAR) \ -(DEFAULT_SWITCH_TAKES_ARG (CHAR) || (CHAR) == 'G') - #undef CC1_SPEC #define CC1_SPEC "%{G*}" diff --git a/gcc/config/m32r/m32r.h b/gcc/config/m32r/m32r.h index a645518cbc1..785d85b5ea5 100644 --- a/gcc/config/m32r/m32r.h +++ b/gcc/config/m32r/m32r.h @@ -22,8 +22,6 @@ - longlong.h? */ -#undef SWITCH_TAKES_ARG -#undef WORD_SWITCH_TAKES_ARG #undef HANDLE_SYSV_PRAGMA #undef SIZE_TYPE #undef PTRDIFF_TYPE @@ -94,12 +92,6 @@ #define TARGET_VERSION fprintf (stderr, " (m32r)") #endif -/* Switch Recognition by gcc.c. Add -G xx support. */ - -#undef SWITCH_TAKES_ARG -#define SWITCH_TAKES_ARG(CHAR) \ -(DEFAULT_SWITCH_TAKES_ARG (CHAR) || (CHAR) == 'G') - /* Names to predefine in the preprocessor for this target machine. */ /* __M32R__ is defined by the existing compiler so we use that. */ #define TARGET_CPU_CPP_BUILTINS() \ diff --git a/gcc/config/microblaze/microblaze.h b/gcc/config/microblaze/microblaze.h index 0145cb35952..2ce22f1e030 100644 --- a/gcc/config/microblaze/microblaze.h +++ b/gcc/config/microblaze/microblaze.h @@ -57,10 +57,6 @@ extern enum pipeline_type microblaze_pipe; /* Macros to decide whether certain features are available or not, depending on the instruction set architecture level. */ -#undef SWITCH_TAKES_ARG -#define SWITCH_TAKES_ARG(CHAR) \ - (DEFAULT_SWITCH_TAKES_ARG (CHAR) || (CHAR) == 'G') - #define DRIVER_SELF_SPECS \ "%{mxl-soft-mul:%<mno-xl-soft-mul}", \ "%{mno-xl-barrel-shift:%<mxl-barrel-shift}", \ diff --git a/gcc/config/mips/iris6.h b/gcc/config/mips/iris6.h index 6fa8ffc0616..dd8eb1158af 100644 --- a/gcc/config/mips/iris6.h +++ b/gcc/config/mips/iris6.h @@ -146,10 +146,6 @@ along with GCC; see the file COPYING3. If not see #undef DEFAULT_SIGNED_CHAR #define DEFAULT_SIGNED_CHAR 0 -#define WORD_SWITCH_TAKES_ARG(STR) \ - (DEFAULT_WORD_SWITCH_TAKES_ARG (STR) \ - || strcmp (STR, "rpath") == 0) - #define TARGET_OS_CPP_BUILTINS() \ do \ { \ diff --git a/gcc/config/mips/mips.h b/gcc/config/mips/mips.h index d6d909b7756..a3675039462 100644 --- a/gcc/config/mips/mips.h +++ b/gcc/config/mips/mips.h @@ -1075,12 +1075,6 @@ enum mips_code_readable_setting { /* The CACHE instruction is available. */ #define ISA_HAS_CACHE (TARGET_CACHE_BUILTIN && !TARGET_MIPS16) -/* Add -G xx support. */ - -#undef SWITCH_TAKES_ARG -#define SWITCH_TAKES_ARG(CHAR) \ - (DEFAULT_SWITCH_TAKES_ARG (CHAR) || (CHAR) == 'G') - #define CONDITIONAL_REGISTER_USAGE mips_conditional_register_usage () /* Tell collect what flags to pass to nm. */ diff --git a/gcc/config/mips/netbsd.h b/gcc/config/mips/netbsd.h index 636e3ade6cc..ff328580181 100644 --- a/gcc/config/mips/netbsd.h +++ b/gcc/config/mips/netbsd.h @@ -1,6 +1,6 @@ /* Definitions of target machine for GNU compiler, for MIPS NetBSD systems. Copyright (C) 1993, 1995, 1996, 1997, 1999, 2000, 2001, 2002, 2003, 2004, - 2007 Free Software Foundation, Inc. + 2007, 2010 Free Software Foundation, Inc. This file is part of GCC. @@ -170,16 +170,6 @@ along with GCC; see the file COPYING3. If not see #define MIPS_DEFAULT_GVALUE 0 -/* This defines which switch letters take arguments. -G is a MIPS - special. */ - -#undef SWITCH_TAKES_ARG -#define SWITCH_TAKES_ARG(CHAR) \ - (DEFAULT_SWITCH_TAKES_ARG (CHAR) \ - || (CHAR) == 'R' \ - || (CHAR) == 'G') - - #undef ASM_FINAL_SPEC #undef SET_ASM_OP diff --git a/gcc/config/mips/vxworks.h b/gcc/config/mips/vxworks.h index f77d62b2be5..3c2d94fe104 100644 --- a/gcc/config/mips/vxworks.h +++ b/gcc/config/mips/vxworks.h @@ -1,4 +1,5 @@ -/* Copyright (C) 1999, 2003, 2004, 2007, 2008 Free Software Foundation, Inc. +/* Copyright (C) 1999, 2003, 2004, 2007, 2008, 2010 + Free Software Foundation, Inc. This file is part of GCC. @@ -19,15 +20,6 @@ along with GCC; see the file COPYING3. If not see #undef TARGET_VERSION #define TARGET_VERSION fprintf (stderr, " (MIPS, VxWorks syntax)"); -/* Combination of mips.h and svr4.h. */ -#undef SWITCH_TAKES_ARG -#define SWITCH_TAKES_ARG(CHAR) \ - (DEFAULT_SWITCH_TAKES_ARG (CHAR) \ - || (CHAR) == 'G' \ - || (CHAR) == 'h' \ - || (CHAR) == 'x' \ - || (CHAR) == 'z') - #undef ASM_SPEC #define ASM_SPEC "\ %{!G:-G 0} %{G*} %(endian_spec) %{mips1} %{mips2} %{mips3} %{mips4} \ diff --git a/gcc/config/netbsd-aout.h b/gcc/config/netbsd-aout.h index 914212b877f..bf2bb9e5ddb 100644 --- a/gcc/config/netbsd-aout.h +++ b/gcc/config/netbsd-aout.h @@ -1,5 +1,5 @@ /* Common configuration file for NetBSD a.out targets. - Copyright (C) 2002, 2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2007, 2010 Free Software Foundation, Inc. Contributed by Wasabi Systems, Inc. This file is part of GCC. @@ -26,13 +26,6 @@ along with GCC; see the file COPYING3. If not see } \ while (0) -/* This defines which switch letters take arguments. */ - -#undef SWITCH_TAKES_ARG -#define SWITCH_TAKES_ARG(CHAR) \ - (DEFAULT_SWITCH_TAKES_ARG(CHAR) \ - || (CHAR) == 'R') - /* Provide an ASM_SPEC appropriate for NetBSD. Currently we only deal with the options for generating PIC code. */ diff --git a/gcc/config/netbsd-elf.h b/gcc/config/netbsd-elf.h index 37f504b8435..f98cbe87bc9 100644 --- a/gcc/config/netbsd-elf.h +++ b/gcc/config/netbsd-elf.h @@ -1,5 +1,5 @@ /* Common configuration file for NetBSD ELF targets. - Copyright (C) 2002, 2007 Free Software Foundation, Inc. + Copyright (C) 2002, 2007, 2010 Free Software Foundation, Inc. Contributed by Wasabi Systems, Inc. This file is part of GCC. @@ -26,18 +26,6 @@ along with GCC; see the file COPYING3. If not see } \ while (0) -/* This defines which switch letters take arguments. On NetBSD, most - of the normal cases (defined by gcc.c) apply, and we also have -h* - and -z* options (for the linker) (coming from SVR4). */ - -#undef SWITCH_TAKES_ARG -#define SWITCH_TAKES_ARG(CHAR) \ - (DEFAULT_SWITCH_TAKES_ARG (CHAR) \ - || (CHAR) == 'h' \ - || (CHAR) == 'z' \ - || (CHAR) == 'R') - - /* Provide a STARTFILE_SPEC appropriate for NetBSD ELF. Here we provide support for the special GCC option -static. On ELF targets, we also add the crtbegin.o file, which provides part diff --git a/gcc/config/openbsd.h b/gcc/config/openbsd.h index 30e1c252c5a..d15dff15f98 100644 --- a/gcc/config/openbsd.h +++ b/gcc/config/openbsd.h @@ -1,5 +1,6 @@ /* Base configuration file for all OpenBSD targets. - Copyright (C) 1999, 2000, 2004, 2005, 2007 Free Software Foundation, Inc. + Copyright (C) 1999, 2000, 2004, 2005, 2007, 2009, 2010 + Free Software Foundation, Inc. This file is part of GCC. @@ -118,13 +119,6 @@ while (0) #ifndef OBSD_HAS_CORRECT_SPECS -#ifndef OBSD_NO_DYNAMIC_LIBRARIES -#undef SWITCH_TAKES_ARG -#define SWITCH_TAKES_ARG(CHAR) \ - (DEFAULT_SWITCH_TAKES_ARG (CHAR) \ - || (CHAR) == 'R') -#endif - #undef CPP_SPEC #define CPP_SPEC OBSD_CPP_SPEC diff --git a/gcc/config/pdp11/pdp11.c b/gcc/config/pdp11/pdp11.c index 946d7ed973b..5b5ebebe0e5 100644 --- a/gcc/config/pdp11/pdp11.c +++ b/gcc/config/pdp11/pdp11.c @@ -1816,14 +1816,12 @@ output_addr_const_pdp11 (FILE *file, rtx x) static bool pdp11_return_in_memory (const_tree type, const_tree fntype ATTRIBUTE_UNUSED) { - /* Should probably return DImode and DFmode in memory, lest - we fill up all regs! - - have to, else we crash - exception: maybe return result in - ac0 if DFmode and FPU present - compatibility problem with - libraries for non-floating point.... */ + /* Integers 32 bits and under, and scalar floats (if FPU), are returned + in registers. The rest go into memory. */ return (TYPE_MODE (type) == DImode - || (FLOAT_MODE_P (TYPE_MODE (type)) && ! TARGET_AC0)); + || (FLOAT_MODE_P (TYPE_MODE (type)) && ! TARGET_AC0) + || TREE_CODE (type) == VECTOR_TYPE + || COMPLEX_MODE_P (TYPE_MODE (type))); } /* Worker function for TARGET_FUNCTION_VALUE. diff --git a/gcc/config/pdp11/pdp11.md b/gcc/config/pdp11/pdp11.md index 2f73390a501..27893a6a8f2 100644 --- a/gcc/config/pdp11/pdp11.md +++ b/gcc/config/pdp11/pdp11.md @@ -122,35 +122,20 @@ }" [(set_attr "length" "4,4,6,6,12")]) -(define_insn "*cmphi" +(define_insn "*cmp<mode>" [(set (cc0) - (compare (match_operand:HI 0 "general_operand" "rR,rR,rR,Q,Qi,Qi") - (match_operand:HI 1 "general_operand" "N,rR,Qi,N,rR,Qi")))] + (compare (match_operand:PDPint 0 "general_operand" "rR,rR,rR,Q,Qi,Qi") + (match_operand:PDPint 1 "general_operand" "N,rR,Qi,N,rR,Qi")))] "" "@ - tst %0 - cmp %0,%1 - cmp %0,%1 - tst %0 - cmp %0,%1 - cmp %0,%1" + tst<PDPint:isfx> %0 + cmp<PDPint:isfx> %0,%1 + cmp<PDPint:isfx> %0,%1 + tst<PDPint:isfx> %0 + cmp<PDPint:isfx> %0,%1 + cmp<PDPint:isfx> %0,%1" [(set_attr "length" "2,2,4,4,4,6")]) -(define_insn "*cmpqi" - [(set (cc0) - (compare (match_operand:QI 0 "general_operand" "rR,rR,rR,Q,Qi,Qi") - (match_operand:QI 1 "general_operand" "N,rR,Qi,N,rR,Qi")))] - "" - "@ - tstb %0 - cmpb %0,%1 - cmpb %0,%1 - tstb %0 - cmpb %0,%1 - cmpb %0,%1" - [(set_attr "length" "2,2,4,4,4,6")]) - - ;; sob instruction - we need an assembler which can make this instruction ;; valid under _all_ circumstances! @@ -211,22 +196,10 @@ "TARGET_FPU" "") -(define_expand "cbranchhi4" - [(set (cc0) - (compare (match_operand:HI 1 "general_operand") - (match_operand:HI 2 "general_operand"))) - (set (pc) - (if_then_else (match_operator 0 "ordered_comparison_operator" - [(cc0) (const_int 0)]) - (label_ref (match_operand 3 "" "")) - (pc)))] - "" - "") - -(define_expand "cbranchqi4" +(define_expand "cbranch<mode>4" [(set (cc0) - (compare (match_operand:QI 1 "general_operand") - (match_operand:QI 2 "general_operand"))) + (compare (match_operand:PDPint 1 "general_operand") + (match_operand:PDPint 2 "general_operand"))) (set (pc) (if_then_else (match_operator 0 "ordered_comparison_operator" [(cc0) (const_int 0)]) @@ -298,29 +271,16 @@ ;; we could split it up and make several sub-cases... [(set_attr "length" "4,6,8,16,16")]) -(define_insn "movhi" - [(set (match_operand:HI 0 "nonimmediate_operand" "=rR,rR,Q,Q") - (match_operand:HI 1 "general_operand" "rRN,Qi,rRN,Qi"))] - "" - "* -{ - if (operands[1] == const0_rtx) - return \"clr %0\"; - - return \"mov %1, %0\"; -}" - [(set_attr "length" "2,4,4,6")]) - -(define_insn "movqi" - [(set (match_operand:QI 0 "nonimmediate_operand" "=rR,rR,Q,Q") - (match_operand:QI 1 "general_operand" "rRN,Qi,rRN,Qi"))] +(define_insn "mov<mode>" + [(set (match_operand:PDPint 0 "nonimmediate_operand" "=rR,rR,Q,Q") + (match_operand:PDPint 1 "general_operand" "rRN,Qi,rRN,Qi"))] "" "* { if (operands[1] == const0_rtx) - return \"clrb %0\"; + return \"clr<PDPint:isfx> %0\"; - return \"movb %1, %0\"; + return \"mov<PDPint:isfx> %1, %0\"; }" [(set_attr "length" "2,4,4,6")]) @@ -718,25 +678,6 @@ }" [(set_attr "length" "2,4,4,6")]) -(define_insn "addqi3" - [(set (match_operand:QI 0 "nonimmediate_operand" "=rR,rR,Q,Q") - (plus:QI (match_operand:QI 1 "general_operand" "%0,0,0,0") - (match_operand:QI 2 "general_operand" "rRLM,Qi,rRLM,Qi")))] - "" - "* -{ - if (GET_CODE (operands[2]) == CONST_INT) - { - if (INTVAL(operands[2]) == 1) - return \"incb %0\"; - else if (INTVAL(operands[2]) == -1) - return \"decb %0\"; - } - - return \"add %2, %0\"; -}" - [(set_attr "length" "2,4,4,6")]) - ;;- subtract instructions ;; we don't have to care for constant second @@ -798,19 +739,6 @@ }" [(set_attr "length" "2,4,4,6")]) -(define_insn "subqi3" - [(set (match_operand:QI 0 "nonimmediate_operand" "=rR,rR,Q,Q") - (minus:QI (match_operand:QI 1 "general_operand" "0,0,0,0") - (match_operand:QI 2 "general_operand" "rR,Qi,rR,Qi")))] - "" - "* -{ - gcc_assert (GET_CODE (operands[2]) != CONST_INT); - - return \"sub %2, %0\"; -}" - [(set_attr "length" "2,4,4,6")]) - ;;;;- and instructions ;; Bit-and on the pdp (like on the VAX) is done with a clear-bits insn. @@ -850,95 +778,15 @@ [(set_attr "length" "2,4,4,6")]) ;;- Bit set (inclusive or) instructions -(define_insn "iorsi3" - [(set (match_operand:SI 0 "nonimmediate_operand" "=r,r,o,o,r,r,r,o,o,o") - (ior:SI (match_operand:SI 1 "general_operand" "%0,0,0,0,0,0,0,0,0,0") - (match_operand:SI 2 "general_operand" "r,o,r,o,I,J,K,I,J,K")))] - "" - "* -{ /* Here we trust that operands don't overlap - - or is lateoperands the low word?? - looks like it! */ - - rtx lateoperands[3]; - - lateoperands[0] = operands[0]; - - if (REG_P (operands[0])) - operands[0] = gen_rtx_REG (HImode, REGNO (operands[0]) + 1); - else - operands[0] = adjust_address (operands[0], HImode, 2); - - if (! CONSTANT_P(operands[2])) - { - lateoperands[2] = operands[2]; - - if (REG_P (operands[2])) - operands[2] = gen_rtx_REG (HImode, REGNO (operands[2]) + 1); - else - operands[2] = adjust_address (operands[2], HImode, 2); - - output_asm_insn (\"bis %2, %0\", operands); - output_asm_insn (\"bis %2, %0\", lateoperands); - return \"\"; - } - - lateoperands[2] = GEN_INT ((INTVAL (operands[2]) >> 16) & 0xffff); - operands[2] = GEN_INT (INTVAL (operands[2]) & 0xffff); - - /* these have different lengths, so we should have - different constraints! */ - if (INTVAL(operands[2])) - output_asm_insn (\"bis %2, %0\", operands); - - if (INTVAL(lateoperands[2])) - output_asm_insn (\"bis %2, %0\", lateoperands); - - return \"\"; -}" - [(set_attr "length" "4,8,8,12,4,4,8,6,6,12")]) - -(define_insn "iorhi3" - [(set (match_operand:HI 0 "nonimmediate_operand" "=rR,rR,Q,Q") - (ior:HI (match_operand:HI 1 "general_operand" "%0,0,0,0") - (match_operand:HI 2 "general_operand" "rR,Qi,rR,Qi")))] +(define_insn "ior<mode>3" + [(set (match_operand:PDPint 0 "nonimmediate_operand" "=rR,rR,Q,Q") + (ior:PDPint (match_operand:PDPint 1 "general_operand" "%0,0,0,0") + (match_operand:PDPint 2 "general_operand" "rR,Qi,rR,Qi")))] "" - "bis %2, %0" + "bis<PDPint:isfx> %2, %0" [(set_attr "length" "2,4,4,6")]) -(define_insn "iorqi3" - [(set (match_operand:QI 0 "nonimmediate_operand" "=rR,rR,Q,Q") - (ior:QI (match_operand:QI 1 "general_operand" "%0,0,0,0") - (match_operand:QI 2 "general_operand" "rR,Qi,rR,Qi")))] - "" - "bisb %2, %0") - ;;- xor instructions -(define_insn "xorsi3" - [(set (match_operand:SI 0 "register_operand" "=r") - (xor:SI (match_operand:SI 1 "register_operand" "%0") - (match_operand:SI 2 "register_operand" "r")))] - "TARGET_40_PLUS" - "* -{ /* Here we trust that operands don't overlap */ - - rtx lateoperands[3]; - - lateoperands[0] = operands[0]; - operands[0] = gen_rtx_REG (HImode, REGNO (operands[0]) + 1); - - if (REG_P(operands[2])) - { - lateoperands[2] = operands[2]; - operands[2] = gen_rtx_REG (HImode, REGNO (operands[2]) + 1); - - output_asm_insn (\"xor %2, %0\", operands); - output_asm_insn (\"xor %2, %0\", lateoperands); - } - return \"\"; -}" - [(set_attr "length" "4")]) - (define_insn "xorhi3" [(set (match_operand:HI 0 "nonimmediate_operand" "=rR,Q") (xor:HI (match_operand:HI 1 "general_operand" "%0,0") @@ -949,20 +797,11 @@ ;;- one complement instructions -(define_insn "one_cmplhi2" - [(set (match_operand:HI 0 "nonimmediate_operand" "=rR,Q") - (not:HI (match_operand:HI 1 "general_operand" "0,0")))] - "" - "com %0" - [(set_attr "length" "2,4")]) - -(define_insn "one_cmplqi2" - [(set (match_operand:QI 0 "nonimmediate_operand" "=rR,rR") - (not:QI (match_operand:QI 1 "general_operand" "0,g")))] +(define_insn "one_cmpl<mode>2" + [(set (match_operand:PDPint 0 "nonimmediate_operand" "=rR,Q") + (not:PDPint (match_operand:PDPint 1 "general_operand" "0,0")))] "" - "@ - comb %0 - movb %1, %0\; comb %0" + "com<PDPint:isfx> %0" [(set_attr "length" "2,4")]) ;;- arithmetic shift instructions diff --git a/gcc/config/rpath.opt b/gcc/config/rpath.opt new file mode 100644 index 00000000000..c76e2fc598c --- /dev/null +++ b/gcc/config/rpath.opt @@ -0,0 +1,29 @@ +; -rpath option to the driver. + +; Copyright (C) 2010 +; Free Software Foundation, Inc. +; +; This file is part of GCC. +; +; 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 3, or (at your option) any later +; version. +; +; 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 GCC; see the file COPYING3. If not see +; <http://www.gnu.org/licenses/>. + +; See the GCC internals manual (options.texi) for a description of this file's format. + +; Please try to keep this file in ASCII collating order. + +rpath +Driver Separate + +; This comment is to ensure we retain the blank line above. diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index f265dce42fe..6f7636bb298 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -73,6 +73,7 @@ /* Structure used to define the rs6000 stack */ typedef struct rs6000_stack { + int reload_completed; /* stack info won't change from here on */ int first_gp_reg_save; /* first callee saved GP register used */ int first_fp_reg_save; /* first callee saved FP register used */ int first_altivec_reg_save; /* first callee saved AltiVec register used */ @@ -109,6 +110,7 @@ typedef struct rs6000_stack { int spe_padding_size; HOST_WIDE_INT total_size; /* total bytes allocated for stack */ int spe_64bit_regs_used; + int savres_strategy; } rs6000_stack_t; /* A C structure for machine-specific, per-function data. @@ -994,7 +996,6 @@ static rtx rs6000_make_savres_rtx (rs6000_stack_t *, rtx, int, static bool rs6000_reg_live_or_pic_offset_p (int); static tree rs6000_builtin_vectorized_libmass (tree, tree, tree); static tree rs6000_builtin_vectorized_function (tree, tree, tree); -static int rs6000_savres_strategy (rs6000_stack_t *, bool, int, int); static void rs6000_restore_saved_cr (rtx, int); static bool rs6000_output_addr_const_extra (FILE *, rtx); static void rs6000_output_function_prologue (FILE *, HOST_WIDE_INT); @@ -15161,6 +15162,8 @@ rs6000_got_register (rtx value ATTRIBUTE_UNUSED) return pic_offset_table_rtx; } +static rs6000_stack_t stack_info; + /* Function to init struct machine_function. This will be called, via a pointer variable, from push_function_context. */ @@ -15168,6 +15171,7 @@ rs6000_got_register (rtx value ATTRIBUTE_UNUSED) static struct machine_function * rs6000_init_machine_status (void) { + stack_info.reload_completed = 0; return ggc_alloc_cleared_machine_function (); } @@ -18050,6 +18054,107 @@ is_altivec_return_reg (rtx reg, void *xyes) } +/* Determine the strategy for savings/restoring registers. */ + +enum { + SAVRES_MULTIPLE = 0x1, + SAVE_INLINE_FPRS = 0x2, + SAVE_INLINE_GPRS = 0x4, + REST_INLINE_FPRS = 0x8, + REST_INLINE_GPRS = 0x10, + SAVE_NOINLINE_GPRS_SAVES_LR = 0x20, + SAVE_NOINLINE_FPRS_SAVES_LR = 0x40, + REST_NOINLINE_FPRS_DOESNT_RESTORE_LR = 0x80 +}; + +static int +rs6000_savres_strategy (rs6000_stack_t *info, + bool using_static_chain_p) +{ + int strategy = 0; + + if (TARGET_MULTIPLE + && !TARGET_POWERPC64 + && !(TARGET_SPE_ABI && info->spe_64bit_regs_used) + && info->first_gp_reg_save < 31 + && no_global_regs_above (info->first_gp_reg_save, /*gpr=*/true)) + strategy |= SAVRES_MULTIPLE; + + if (crtl->calls_eh_return + || cfun->machine->ra_need_lr + || info->total_size > 32767) + strategy |= (SAVE_INLINE_FPRS | REST_INLINE_FPRS + | SAVE_INLINE_GPRS | REST_INLINE_GPRS); + + if (info->first_fp_reg_save == 64 + || FP_SAVE_INLINE (info->first_fp_reg_save) + /* The out-of-line FP routines use double-precision stores; + we can't use those routines if we don't have such stores. */ + || (TARGET_HARD_FLOAT && !TARGET_DOUBLE_FLOAT) + || !no_global_regs_above (info->first_fp_reg_save, /*gpr=*/false)) + strategy |= SAVE_INLINE_FPRS | REST_INLINE_FPRS; + + if (info->first_gp_reg_save == 32 + || GP_SAVE_INLINE (info->first_gp_reg_save) + || !((strategy & SAVRES_MULTIPLE) + || no_global_regs_above (info->first_gp_reg_save, /*gpr=*/true))) + strategy |= SAVE_INLINE_GPRS | REST_INLINE_GPRS; + + /* Don't bother to try to save things out-of-line if r11 is occupied + by the static chain. It would require too much fiddling and the + static chain is rarely used anyway. */ + if (using_static_chain_p) + strategy |= SAVE_INLINE_FPRS | SAVE_INLINE_GPRS; + + /* If we are going to use store multiple, then don't even bother + with the out-of-line routines, since the store-multiple + instruction will always be smaller. */ + if ((strategy & SAVRES_MULTIPLE)) + strategy |= SAVE_INLINE_GPRS; + + /* The situation is more complicated with load multiple. We'd + prefer to use the out-of-line routines for restores, since the + "exit" out-of-line routines can handle the restore of LR and the + frame teardown. However if doesn't make sense to use the + out-of-line routine if that is the only reason we'd need to save + LR, and we can't use the "exit" out-of-line gpr restore if we + have saved some fprs; In those cases it is advantageous to use + load multiple when available. */ + if ((strategy & SAVRES_MULTIPLE) + && (!info->lr_save_p + || info->first_fp_reg_save != 64)) + strategy |= REST_INLINE_GPRS; + + /* We can only use load multiple or the out-of-line routines to + restore if we've used store multiple or out-of-line routines + in the prologue, i.e. if we've saved all the registers from + first_gp_reg_save. Otherwise, we risk loading garbage. */ + if ((strategy & (SAVE_INLINE_GPRS | SAVRES_MULTIPLE)) == SAVE_INLINE_GPRS) + strategy |= REST_INLINE_GPRS; + + /* Saving CR interferes with the exit routines used on the SPE, so + just punt here. */ + if (TARGET_SPE_ABI + && info->spe_64bit_regs_used + && info->cr_save_p) + strategy |= REST_INLINE_GPRS; + +#ifdef POWERPC_LINUX + if (TARGET_64BIT) + { + if (!(strategy & SAVE_INLINE_FPRS)) + strategy |= SAVE_NOINLINE_FPRS_SAVES_LR; + else if (!(strategy & SAVE_INLINE_GPRS) + && info->first_fp_reg_save == 64) + strategy |= SAVE_NOINLINE_GPRS_SAVES_LR; + } +#else + if (TARGET_AIX && !(strategy & REST_INLINE_FPRS)) + strategy |= REST_NOINLINE_FPRS_DOESNT_RESTORE_LR; +#endif + return strategy; +} + /* Calculate the stack information for the current function. This is complicated by having two separate calling sequences, the AIX calling sequence and the V.4 calling sequence. @@ -18150,15 +18255,26 @@ is_altivec_return_reg (rtx reg, void *xyes) static rs6000_stack_t * rs6000_stack_info (void) { - static rs6000_stack_t info; - rs6000_stack_t *info_ptr = &info; +#ifdef ENABLE_CHECKING + static rs6000_stack_t info_save; +#endif + rs6000_stack_t *info_ptr = &stack_info; int reg_size = TARGET_32BIT ? 4 : 8; int ehrd_size; int save_align; int first_gp; HOST_WIDE_INT non_fixed_size; + bool using_static_chain_p; + +#ifdef ENABLE_CHECKING + memcpy (&info_save, &stack_info, sizeof stack_info); +#else + if (reload_completed && info_ptr->reload_completed) + return info_ptr; +#endif - memset (&info, 0, sizeof (info)); + memset (&stack_info, 0, sizeof (stack_info)); + info_ptr->reload_completed = reload_completed; if (TARGET_SPE) { @@ -18215,23 +18331,6 @@ rs6000_stack_info (void) info_ptr->calls_p = (! current_function_is_leaf || cfun->machine->ra_needs_full_frame); - /* Determine if we need to save the link register. */ - if ((DEFAULT_ABI == ABI_AIX - && crtl->profile - && !TARGET_PROFILE_KERNEL) -#ifdef TARGET_RELOCATABLE - || (TARGET_RELOCATABLE && (get_pool_size () != 0)) -#endif - || (info_ptr->first_fp_reg_save != 64 - && !FP_SAVE_INLINE (info_ptr->first_fp_reg_save)) - || (DEFAULT_ABI == ABI_V4 && cfun->calls_alloca) - || info_ptr->calls_p - || rs6000_ra_ever_killed ()) - { - info_ptr->lr_save_p = 1; - df_set_regs_ever_live (LR_REGNO, true); - } - /* Determine if we need to save the condition code registers. */ if (df_regs_ever_live_p (CR2_REGNO) || df_regs_ever_live_p (CR3_REGNO) @@ -18400,6 +18499,33 @@ rs6000_stack_info (void) info_ptr->total_size = RS6000_ALIGN (non_fixed_size + info_ptr->fixed_size, ABI_STACK_BOUNDARY / BITS_PER_UNIT); + /* Determine if we need to save the link register. */ + if (info_ptr->calls_p + || (DEFAULT_ABI == ABI_AIX + && crtl->profile + && !TARGET_PROFILE_KERNEL) + || (DEFAULT_ABI == ABI_V4 && cfun->calls_alloca) +#ifdef TARGET_RELOCATABLE + || (TARGET_RELOCATABLE && (get_pool_size () != 0)) +#endif + || rs6000_ra_ever_killed ()) + info_ptr->lr_save_p = 1; + + using_static_chain_p = (cfun->static_chain_decl != NULL_TREE + && df_regs_ever_live_p (STATIC_CHAIN_REGNUM) + && call_used_regs[STATIC_CHAIN_REGNUM]); + info_ptr->savres_strategy = rs6000_savres_strategy (info_ptr, + using_static_chain_p); + + if (!(info_ptr->savres_strategy & SAVE_INLINE_GPRS) + || !(info_ptr->savres_strategy & SAVE_INLINE_FPRS) + || !(info_ptr->savres_strategy & REST_INLINE_GPRS) + || !(info_ptr->savres_strategy & REST_INLINE_FPRS)) + info_ptr->lr_save_p = 1; + + if (info_ptr->lr_save_p) + df_set_regs_ever_live (LR_REGNO, true); + /* Determine if we need to allocate any stack frame: For AIX we need to push the stack if a frame pointer is needed @@ -18451,6 +18577,10 @@ rs6000_stack_info (void) if (! info_ptr->cr_save_p) info_ptr->cr_save_offset = 0; +#ifdef ENABLE_CHECKING + gcc_assert (!(reload_completed && info_save.reload_completed) + || memcmp (&info_save, &stack_info, sizeof stack_info) == 0); +#endif return info_ptr; } @@ -19714,106 +19844,6 @@ rs6000_reg_live_or_pic_offset_p (int reg) || (DEFAULT_ABI == ABI_DARWIN && flag_pic)))); } -enum { - SAVRES_MULTIPLE = 0x1, - SAVRES_INLINE_FPRS = 0x2, - SAVRES_INLINE_GPRS = 0x4, - SAVRES_NOINLINE_GPRS_SAVES_LR = 0x8, - SAVRES_NOINLINE_FPRS_SAVES_LR = 0x10, - SAVRES_NOINLINE_FPRS_DOESNT_RESTORE_LR = 0x20 -}; - -/* Determine the strategy for savings/restoring registers. */ - -static int -rs6000_savres_strategy (rs6000_stack_t *info, bool savep, - int using_static_chain_p, int sibcall) -{ - bool using_multiple_p; - bool common; - bool savres_fprs_inline; - bool savres_gprs_inline; - bool noclobber_global_gprs - = no_global_regs_above (info->first_gp_reg_save, /*gpr=*/true); - int strategy; - - using_multiple_p = (TARGET_MULTIPLE && ! TARGET_POWERPC64 - && (!TARGET_SPE_ABI - || info->spe_64bit_regs_used == 0) - && info->first_gp_reg_save < 31 - && noclobber_global_gprs); - /* Don't bother to try to save things out-of-line if r11 is occupied - by the static chain. It would require too much fiddling and the - static chain is rarely used anyway. */ - common = (using_static_chain_p - || sibcall - || crtl->calls_eh_return - || !info->lr_save_p - || cfun->machine->ra_need_lr - || info->total_size > 32767); - savres_fprs_inline = (common - || info->first_fp_reg_save == 64 - || !no_global_regs_above (info->first_fp_reg_save, - /*gpr=*/false) - /* The out-of-line FP routines use - double-precision stores; we can't use those - routines if we don't have such stores. */ - || (TARGET_HARD_FLOAT && !TARGET_DOUBLE_FLOAT) - || FP_SAVE_INLINE (info->first_fp_reg_save)); - savres_gprs_inline = (common - /* Saving CR interferes with the exit routines - used on the SPE, so just punt here. */ - || (!savep - && TARGET_SPE_ABI - && info->spe_64bit_regs_used != 0 - && info->cr_save_p != 0) - || info->first_gp_reg_save == 32 - || !noclobber_global_gprs - || GP_SAVE_INLINE (info->first_gp_reg_save)); - - if (savep) - /* If we are going to use store multiple, then don't even bother - with the out-of-line routines, since the store-multiple instruction - will always be smaller. */ - savres_gprs_inline = savres_gprs_inline || using_multiple_p; - else - { - /* The situation is more complicated with load multiple. We'd - prefer to use the out-of-line routines for restores, since the - "exit" out-of-line routines can handle the restore of LR and - the frame teardown. But we can only use the out-of-line - routines if we know that we've used store multiple or - out-of-line routines in the prologue, i.e. if we've saved all - the registers from first_gp_reg_save. Otherwise, we risk - loading garbage from the stack. Furthermore, we can only use - the "exit" out-of-line gpr restore if we haven't saved any - fprs. */ - bool saved_all = !savres_gprs_inline || using_multiple_p; - - if (saved_all && info->first_fp_reg_save != 64) - /* We can't use the exit routine; use load multiple if it's - available. */ - savres_gprs_inline = savres_gprs_inline || using_multiple_p; - } - - strategy = (using_multiple_p - | (savres_fprs_inline << 1) - | (savres_gprs_inline << 2)); -#ifdef POWERPC_LINUX - if (TARGET_64BIT) - { - if (!savres_fprs_inline) - strategy |= SAVRES_NOINLINE_FPRS_SAVES_LR; - else if (!savres_gprs_inline && info->first_fp_reg_save == 64) - strategy |= SAVRES_NOINLINE_GPRS_SAVES_LR; - } -#else - if (TARGET_AIX && !savres_fprs_inline) - strategy |= SAVRES_NOINLINE_FPRS_DOESNT_RESTORE_LR; -#endif - return strategy; -} - /* Emit function prologue as insns. */ void @@ -19862,12 +19892,10 @@ rs6000_emit_prologue (void) reg_size = 8; } - strategy = rs6000_savres_strategy (info, /*savep=*/true, - /*static_chain_p=*/using_static_chain_p, - /*sibcall=*/0); + strategy = info->savres_strategy; using_store_multiple = strategy & SAVRES_MULTIPLE; - saving_FPRs_inline = strategy & SAVRES_INLINE_FPRS; - saving_GPRs_inline = strategy & SAVRES_INLINE_GPRS; + saving_FPRs_inline = strategy & SAVE_INLINE_FPRS; + saving_GPRs_inline = strategy & SAVE_INLINE_GPRS; /* For V.4, update stack before we do any saving and set back pointer. */ if (! WORLD_SAVE_P (info) @@ -20037,8 +20065,8 @@ rs6000_emit_prologue (void) gen_rtx_REG (Pmode, LR_REGNO)); RTX_FRAME_RELATED_P (insn) = 1; - if (!(strategy & (SAVRES_NOINLINE_GPRS_SAVES_LR - | SAVRES_NOINLINE_FPRS_SAVES_LR))) + if (!(strategy & (SAVE_NOINLINE_GPRS_SAVES_LR + | SAVE_NOINLINE_FPRS_SAVES_LR))) { addr = gen_rtx_PLUS (Pmode, frame_reg_rtx, GEN_INT (info->lr_save_offset + sp_offset)); @@ -20098,7 +20126,7 @@ rs6000_emit_prologue (void) DFmode, /*savep=*/true, /*gpr=*/false, /*lr=*/(strategy - & SAVRES_NOINLINE_FPRS_SAVES_LR) + & SAVE_NOINLINE_FPRS_SAVES_LR) != 0); insn = emit_insn (par); rs6000_frame_related (insn, frame_ptr_rtx, info->total_size, @@ -20225,7 +20253,7 @@ rs6000_emit_prologue (void) reg_mode, /*savep=*/true, /*gpr=*/true, /*lr=*/(strategy - & SAVRES_NOINLINE_GPRS_SAVES_LR) + & SAVE_NOINLINE_GPRS_SAVES_LR) != 0); insn = emit_insn (par); rs6000_frame_related (insn, frame_ptr_rtx, info->total_size, @@ -20533,19 +20561,23 @@ rs6000_output_function_prologue (FILE *file, /* Write .extern for any function we will call to save and restore fp values. */ - if (info->first_fp_reg_save < 64 - && !FP_SAVE_INLINE (info->first_fp_reg_save)) + if (info->first_fp_reg_save < 64) { char *name; int regno = info->first_fp_reg_save - 32; - name = rs6000_savres_routine_name (info, regno, /*savep=*/true, - /*gpr=*/false, /*lr=*/false); - fprintf (file, "\t.extern %s\n", name); - - name = rs6000_savres_routine_name (info, regno, /*savep=*/false, - /*gpr=*/false, /*lr=*/true); - fprintf (file, "\t.extern %s\n", name); + if ((info->savres_strategy & SAVE_INLINE_FPRS) == 0) + { + name = rs6000_savres_routine_name (info, regno, /*savep=*/true, + /*gpr=*/false, /*lr=*/false); + fprintf (file, "\t.extern %s\n", name); + } + if ((info->savres_strategy & REST_INLINE_FPRS) == 0) + { + name = rs6000_savres_routine_name (info, regno, /*savep=*/false, + /*gpr=*/false, /*lr=*/true); + fprintf (file, "\t.extern %s\n", name); + } } /* Write .extern for AIX common mode routines, if needed. */ @@ -20691,11 +20723,10 @@ rs6000_emit_epilogue (int sibcall) reg_size = 8; } - strategy = rs6000_savres_strategy (info, /*savep=*/false, - /*static_chain_p=*/0, sibcall); + strategy = info->savres_strategy; using_load_multiple = strategy & SAVRES_MULTIPLE; - restoring_FPRs_inline = strategy & SAVRES_INLINE_FPRS; - restoring_GPRs_inline = strategy & SAVRES_INLINE_GPRS; + restoring_FPRs_inline = sibcall || (strategy & REST_INLINE_FPRS); + restoring_GPRs_inline = sibcall || (strategy & REST_INLINE_GPRS); using_mtcr_multiple = (rs6000_cpu == PROCESSOR_PPC601 || rs6000_cpu == PROCESSOR_PPC603 || rs6000_cpu == PROCESSOR_PPC750 @@ -20713,7 +20744,7 @@ rs6000_emit_epilogue (int sibcall) && !frame_pointer_needed)); restore_lr = (info->lr_save_p && (restoring_FPRs_inline - || (strategy & SAVRES_NOINLINE_FPRS_DOESNT_RESTORE_LR)) + || (strategy & REST_NOINLINE_FPRS_DOESNT_RESTORE_LR)) && (restoring_GPRs_inline || info->first_fp_reg_save < 64)); @@ -21352,7 +21383,7 @@ rs6000_emit_epilogue (int sibcall) if (!sibcall) { rtvec p; - bool lr = (strategy & SAVRES_NOINLINE_FPRS_DOESNT_RESTORE_LR) == 0; + bool lr = (strategy & REST_NOINLINE_FPRS_DOESNT_RESTORE_LR) == 0; if (! restoring_FPRs_inline) p = rtvec_alloc (4 + 64 - info->first_fp_reg_save); else diff --git a/gcc/config/rs6000/sysv4.h b/gcc/config/rs6000/sysv4.h index 6d88e324e88..04cc70e3adf 100644 --- a/gcc/config/rs6000/sysv4.h +++ b/gcc/config/rs6000/sysv4.h @@ -502,13 +502,6 @@ do { \ reg_names[1]); \ } while (0) -/* Switch Recognition by gcc.c. Add -G xx support. */ - -/* Override svr4.h definition. */ -#undef SWITCH_TAKES_ARG -#define SWITCH_TAKES_ARG(CHAR) \ - (DEFAULT_SWITCH_TAKES_ARG (CHAR) || (CHAR) == 'G') - extern int fixuplabelno; /* Handle constructors specially for -mrelocatable. */ diff --git a/gcc/config/rx/rx.h b/gcc/config/rx/rx.h index f320beb260a..5f89ebec21c 100644 --- a/gcc/config/rx/rx.h +++ b/gcc/config/rx/rx.h @@ -25,7 +25,10 @@ builtin_define ("__RX__"); \ builtin_assert ("cpu=RX"); \ if (rx_cpu_type == RX610) \ - builtin_assert ("machine=RX610"); \ + { \ + builtin_define ("__RX610__"); \ + builtin_assert ("machine=RX610"); \ + } \ else \ builtin_assert ("machine=RX600"); \ \ diff --git a/gcc/config/score/score.h b/gcc/config/score/score.h index 49887040014..1309a40e023 100644 --- a/gcc/config/score/score.h +++ b/gcc/config/score/score.h @@ -20,11 +20,6 @@ #include "score-conv.h" -/* Controlling the Compilation Driver. */ -#undef SWITCH_TAKES_ARG -#define SWITCH_TAKES_ARG(CHAR) \ - (DEFAULT_SWITCH_TAKES_ARG (CHAR) || (CHAR) == 'G') - #undef CPP_SPEC #define CPP_SPEC "%{mscore3:-D__score3__} %{G*}" diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c index 54e7be84947..a1eec59153e 100644 --- a/gcc/config/sh/sh.c +++ b/gcc/config/sh/sh.c @@ -255,6 +255,7 @@ static int sh_pr_n_sets (void); static rtx sh_allocate_initial_value (rtx); static bool sh_legitimate_address_p (enum machine_mode, rtx, bool); static rtx sh_legitimize_address (rtx, rtx, enum machine_mode); +static rtx sh_delegitimize_address (rtx); static int shmedia_target_regs_stack_space (HARD_REG_SET *); static int shmedia_reserve_space_for_target_registers_p (int, HARD_REG_SET *); static int shmedia_target_regs_stack_adjust (HARD_REG_SET *); @@ -459,6 +460,9 @@ static const struct default_options sh_option_optimization_table[] = #undef TARGET_SCHED_INIT #define TARGET_SCHED_INIT sh_md_init +#undef TARGET_DELEGITIMIZE_ADDRESS +#define TARGET_DELEGITIMIZE_ADDRESS sh_delegitimize_address + #undef TARGET_LEGITIMIZE_ADDRESS #define TARGET_LEGITIMIZE_ADDRESS sh_legitimize_address @@ -9873,6 +9877,45 @@ sh_legitimize_reload_address (rtx *p, enum machine_mode mode, int opnum, return true; } +/* In the name of slightly smaller debug output, and to cater to + general assembler lossage, recognize various UNSPEC sequences + and turn them back into a direct symbol reference. */ + +static rtx +sh_delegitimize_address (rtx orig_x) +{ + rtx x, y; + + orig_x = delegitimize_mem_from_attrs (orig_x); + + x = orig_x; + if (MEM_P (x)) + x = XEXP (x, 0); + if (GET_CODE (x) == CONST) + { + y = XEXP (x, 0); + if (GET_CODE (y) == UNSPEC) + { + if (XINT (y, 1) == UNSPEC_GOT + || XINT (y, 1) == UNSPEC_GOTOFF) + return XVECEXP (y, 0, 0); + else if (TARGET_SHMEDIA + && (XINT (y, 1) == UNSPEC_EXTRACT_S16 + || XINT (y, 1) == UNSPEC_EXTRACT_U16)) + { + rtx offset = XVECEXP (y, 0, 1); + + x = gen_rtx_PLUS (Pmode, XVECEXP (y, 0, 0), offset); + if (MEM_P (orig_x)) + x = replace_equiv_address_nv (orig_x, x); + return x; + } + } + } + + return orig_x; +} + /* Mark the use of a constant in the literal table. If the constant has multiple labels, make it unique. */ static rtx diff --git a/gcc/config/sol2.h b/gcc/config/sol2.h index 805b32fe89c..72efdbd339e 100644 --- a/gcc/config/sol2.h +++ b/gcc/config/sol2.h @@ -192,15 +192,6 @@ along with GCC; see the file COPYING3. If not see #undef SUPPORTS_INIT_PRIORITY #define SUPPORTS_INIT_PRIORITY 0 -/* This defines which switch letters take arguments. - It is as in svr4.h but with -R added. */ -#undef SWITCH_TAKES_ARG -#define SWITCH_TAKES_ARG(CHAR) \ - (DEFAULT_SWITCH_TAKES_ARG(CHAR) \ - || (CHAR) == 'R' \ - || (CHAR) == 'h' \ - || (CHAR) == 'z') - #define STDC_0_IN_SYSTEM_HEADERS 1 /* diff --git a/gcc/config/sparc/sp-elf.h b/gcc/config/sparc/sp-elf.h index 3c50f712c42..8f0e892971a 100644 --- a/gcc/config/sparc/sp-elf.h +++ b/gcc/config/sparc/sp-elf.h @@ -1,6 +1,6 @@ /* Definitions of target machine for GCC, for SPARC running in an embedded environment using the ELF file format. - Copyright (C) 2005, 2007 Free Software Foundation, Inc. + Copyright (C) 2005, 2007, 2010 Free Software Foundation, Inc. This file is part of GCC. @@ -45,15 +45,6 @@ along with GCC; see the file COPYING3. If not see /* Don't set the target flags, this is done by the linker script */ #undef LIB_SPEC #define LIB_SPEC "" - -/* This defines which switch letters take arguments. - It is as in svr4.h but with -R added. */ -#undef SWITCH_TAKES_ARG -#define SWITCH_TAKES_ARG(CHAR) \ - (DEFAULT_SWITCH_TAKES_ARG(CHAR) \ - || (CHAR) == 'R' \ - || (CHAR) == 'h' \ - || (CHAR) == 'z') #undef LOCAL_LABEL_PREFIX #define LOCAL_LABEL_PREFIX "." diff --git a/gcc/config/sparc/sp64-elf.h b/gcc/config/sparc/sp64-elf.h index a6ae0271e42..e1820e07641 100644 --- a/gcc/config/sparc/sp64-elf.h +++ b/gcc/config/sparc/sp64-elf.h @@ -1,5 +1,5 @@ /* Definitions of target machine for GCC, for SPARC64, ELF. - Copyright (C) 1994, 1995, 1996, 1997, 1998, 2000, 2004, 2005, 2007 + Copyright (C) 1994, 1995, 1996, 1997, 1998, 2000, 2004, 2005, 2007, 2010 Free Software Foundation, Inc. Contributed by Doug Evans, dje@cygnus.com. @@ -71,15 +71,6 @@ crtbegin.o%s \ /* Use the default (for now). */ #undef LIB_SPEC -/* This defines which switch letters take arguments. - It is as in svr4.h but with -R added. */ -#undef SWITCH_TAKES_ARG -#define SWITCH_TAKES_ARG(CHAR) \ - (DEFAULT_SWITCH_TAKES_ARG(CHAR) \ - || (CHAR) == 'R' \ - || (CHAR) == 'h' \ - || (CHAR) == 'z') - #undef BYTES_BIG_ENDIAN #define BYTES_BIG_ENDIAN (! TARGET_LITTLE_ENDIAN) diff --git a/gcc/config/sparc/sparc.h b/gcc/config/sparc/sparc.h index 3df147218a1..b7f0bd36226 100644 --- a/gcc/config/sparc/sparc.h +++ b/gcc/config/sparc/sparc.h @@ -450,7 +450,7 @@ extern enum cmodel sparc_cmodel; /* Special flags to the Sun-4 assembler when using pipe for input. */ #define ASM_SPEC "\ -%{R} %{!pg:%{!p:%{fpic|fPIC|fpie|fPIE:-k}}} %{keep-local-as-symbols:-L} \ +%{!pg:%{!p:%{fpic|fPIC|fpie|fPIE:-k}}} %{keep-local-as-symbols:-L} \ %(asm_cpu) %(asm_relax)" #define AS_NEEDS_DASH_FOR_PIPED_INPUT diff --git a/gcc/config/svr4.h b/gcc/config/svr4.h index 1a481301f18..f45706b4f76 100644 --- a/gcc/config/svr4.h +++ b/gcc/config/svr4.h @@ -1,7 +1,7 @@ /* Operating system specific defines to be used when targeting GCC for some generic System V Release 4 system. Copyright (C) 1991, 1994, 1995, 1996, 1997, 1998, 1999, - 2000, 2001, 2007, 2008, 2009 Free Software Foundation, Inc. + 2000, 2001, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. Contributed by Ron Guilmette (rfg@monkeys.com). This file is part of GCC. @@ -41,26 +41,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see /* Cpp, assembler, linker, library, and startfile spec's. */ -/* This defines which switch letters take arguments. On svr4, most of - the normal cases (defined in gcc.c) apply, and we also have -h* and - -z* options (for the linker). Note however that there is no such - thing as a -T option for svr4. */ - -#undef SWITCH_TAKES_ARG -#define SWITCH_TAKES_ARG(CHAR) \ - (DEFAULT_SWITCH_TAKES_ARG (CHAR) \ - || (CHAR) == 'h' \ - || (CHAR) == 'x' \ - || (CHAR) == 'z') - -/* This defines which multi-letter switches take arguments. On svr4, - there are no such switches except those implemented by GCC itself. */ - -#define WORD_SWITCH_TAKES_ARG(STR) \ - (DEFAULT_WORD_SWITCH_TAKES_ARG (STR) \ - && strcmp (STR, "Tdata") && strcmp (STR, "Ttext") \ - && strcmp (STR, "Tbss")) - /* Provide an ASM_SPEC appropriate for svr4. If we're not using GAS, we try to support as many of the specialized svr4 assembler options as seems reasonable, diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index b3253e96f85..df32c8a2702 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,129 @@ +2010-11-01 Jason Merrill <jason@redhat.com> + + * semantics.c (call_stack, call_stack_tick, cx_error_context): New. + (last_cx_error_tick, push_cx_call_context, pop_cx_call_context): New. + (cxx_eval_call_expression): Call push/pop_cx_call_context instead + of giving follow-on errors. + * error.c (maybe_print_constexpr_context): New. + (cp_diagnostic_starter): Call it. + * cp-tree.h: Declare cx_error_context. + + * semantics.c (cxx_eval_constant_expression): Explain + unacceptable use of variable better. + +2010-11-01 Gabriel Dos Reis <gdr@cse.tamu.edu> + Jason Merrill <jason@redhat.com> + + * call.c (null_ptr_cst_p): Use maybe_constant_value. + (set_up_extended_ref_temp): Support constant initialization. + (initialize_reference): Adjust. + * class.c (check_bitfield_decl): Use cxx_constant_value. + * cvt.c (ocp_convert): Don't use integral_constant_value when + converting to class type. + * decl.c (finish_case_label): Use maybe_constant_value. + (build_init_list_var_init): Support constant initialization. + (check_initializer): Likewise. Reorganize. + (cp_finish_decl): Likewise. + (expand_static_init): Likewise. + (compute_array_index_type): Use maybe_constant_value. + Add complain parm. + (create_array_type_for_decl, grokdeclarator): Pass it. + (build_enumerator): Use cxx_constant_value. + * decl2.c (grokfield): Use maybe_constant_init. + * except.c (check_noexcept_r): Handle constexpr. + (build_noexcept_spec): Use maybe_constant_value. + * init.c (expand_default_init): Support constant initialization. + (build_vec_init): Likewise. + (constant_value_1): Adjust. + (build_new_1): Adjust. + * parser.c (cp_parser_constant_expression): Allow non-integral + in C++0x mode. + (cp_parser_direct_declarator): Don't fold yet in C++0x mode. + (cp_parser_initializer_clause): Toss folded result if non-constant. + * pt.c (fold_decl_constant_value): Remove. + (convert_nontype_argument): Use maybe_constant_value. Give clearer + error about overflow. + (tsubst): Move array bounds handling into compute_array_index_type. + (value_dependent_expression_p): Handle constant CALL_EXPR. + (tsubst_decl): Don't set + DECL_INITIALIZED_BY_CONSTANT_EXPRESSION_P yet. + (tsubst_expr) [DECL_EXPR]: Pass it into cp_finish_decl. + (instantiate_decl): Here too. + * semantics.c (finish_static_assert): Use maybe_constant_value. + (ensure_literal_type_for_constexpr_object): Make sure type is complete. + (potential_constant_expression): Use maybe_constant_value. + * tree.c (cast_valid_in_integral_constant_expression_p): Any cast + is potentially valid in C++0x. + * typeck2.c (store_init_value): Handle constant init. + (check_narrowing): Use maybe_constant_value. + (build_functional_cast): Set TREE_CONSTANT on literal T(). + * cp-tree.h (DECL_INTEGRAL_CONSTANT_VAR_P): Remove. + (LOOKUP_ALREADY_DIGESTED): New. + (compute_array_index_type): Adjust prototype. + + * semantics.c (constexpr_call): New datatype. + (constexpr_call_table): New global table. + (constexpr_call_hash): New. + (constexpr_call_equal): Likewise. + (maybe_initialize_constexpr_call_table): Likewise. + (lookup_parameter_binding): Likewise. + (cxx_eval_builtin_function_call): Likewise. + (cxx_bind_parameters_in_call): Likewise. + (cxx_eval_call_expression): Likewise. + (cxx_eval_unary_expression): Likewise. + (cxx_eval_binary_expression): Likewise. + (cxx_eval_conditional_expression): Likewise. + (cxx_eval_array_reference): Likewise. + (cxx_eval_component_reference): Likewise. + (cxx_eval_logical_expression): Likewise. + (cxx_eval_object_construction): Likewise. + (cxx_eval_constant_expression): Likewise. + (cxx_eval_indirect_ref): Likewise. + (cxx_constant_value): Likewise. + (cxx_eval_bare_aggregate): Likewise. + (adjust_temp_type): New. + (reduced_constant_expression_p): New. + (verify_constant): New. + (cxx_eval_vec_init, cxx_eval_vec_init_1): New. + (cxx_eval_outermost_constant_expr): New. + (maybe_constant_value, maybe_constant_init): New. + (cxx_eval_constant_expression): Use them. + * pt.c (iterative_hash_template_arg): No longer static. + * cp-tree.h: Declare fns. + + * cp-tree.h (register_constexpr_fundef): Declare. + * decl.c (maybe_save_function_definition): New. + (finish_function): Use it. + * semantics.c (constexpr_fundef): New datatype. + (constexpr_fundef_table): New global table. + (constexpr_fundef_equal): New. + (constexpr_fundef_hash): Likewise. + (retrieve_constexpr_fundef): Likewise. + (validate_constexpr_fundecl): Store in the table. + (build_data_member_initialization): New fn. + (build_constexpr_constructor_member_initializers): New. + (register_constexpr_fundef): Define. + (is_this_parameter): New. + (get_function_named_in_call): Likewise. + (get_nth_callarg): Likewise. + (check_automatic_or_tls): New. + (morally_constexpr_builtin_function_p): New. + (potential_constant_expression): New. + +2010-11-01 Jason Merrill <jason@redhat.com> + + * decl2.c (decl_constant_var_p): New fn. + (decl_maybe_constant_var_p): New fn. + (mark_used): Rework instantiation of things needed for constant + expressions. + * cp-tree.h: Declare new fns. + * pt.c (instantiate_decl): Handle cp_unevaluated_operand. + (always_instantiate_p): Use decl_maybe_constant_var_p. + (instantiate_decl): Don't defer constexpr functions. + * repo.c (repo_emit_p): Use decl_maybe_constant_var_p. + * semantics.c (finish_id_expression): Use decl_constant_var_p. + Check for valid name in constant expr after mark_used. + 2010-10-31 Jason Merrill <jason@redhat.com> * class.c (is_really_empty_class): Work when type is not complete. @@ -2355,72 +2481,6 @@ * cp-tree.h (diagnose_uninitialized_cst_or_ref_member): Change the prototype. -2010-03-10 Gabriel Dos Reis <gdr@cse.tamu.edu> - - * parser.c (cp_parser_ctor_initializer_opt_and_function_body): - Check body of constexpr constructors. - * cp-tree.h (TYPE_ARRAY_P): New. - (hash_constexpr_args): Declare. - (register_constexpr_fundef): Likewise. - (cxx_constant_value): Likewise. - (generalized_constant_expression_allowed): New. - * decl.c (validate_constexpr_redeclaration): New. - (duplicate_decls): Use it. - (cp_finish_decl): Validate constexpr bit. - (grokdeclarator): Check uses of constexpr specifier. - (maybe_save_function_definition): New. - (finish_function): Use it. - * class.c (check_bases): Accumulate literal type property from - base classes. - (check_field_decls): Same for non-static data members. - (finalize_literal_type_property): New. - (check_bases_and_members): Use it. - (finish_struct_1): Assume the class being processed is literal. - * typeck2.c (store_init_value): Fold initializers of - constexpr variables. - * pt.c (hash_constexpr_args): Define. - * semantics.c (ensure_literal_type_for_constexpr_object): Tidy. - (constexpr_fundef): New datatype. - (constexpr_fundef_table): New global table. - (constexpr_fundef_equal): New. - (constexpr_fundef_hash): Likewise. - (retrieve_constexpr_fundef): Likewise. - (validate_constexpr_fundecl): Tidy. Allow constexpr function - declarations that are not definitions. - (build_constexpr_constructor_member_initializers): New. - (register_constexpr_fundef): Define. - (constexpr_call): New datatype. - (constexpr_call_table): New global table. - (constexpr_call_hash): New. - (constexpr_call_equal): Likewise. - (maybe_initialize_constexpr_call_table): Likewise. - (is_this_parameter): Likewise. - (get_function_named_in_call): Likewise. - (get_nth_callarg): Likewise. - (lookup_parameter_binding): Likewise. - (cxx_eval_builtin_function_call): Likewise. - (cxx_bind_parameters_in_call): Likewise. - (cxx_eval_call_expression): Likewise. - (cxx_eval_unary_expression): Likewise. - (cxx_eval_binary_expression): Likewise. - (cxx_eval_conditional_expression): Likewise. - (cxx_eval_array_reference): Likewise. - (cxx_eval_component_reference): Likewise. - (cxx_eval_logical_expression): Likewise. - (cxx_eval_object_construction): Likewise. - (cxx_eval_constant_expression): Likewise. - (cxx_constant_value): Define. - (has_automatic_or_tls): New. - (morally_constexpr_builtin_function_p): Likewise. - (potential_constant_expression): Likewise. - (valid_type_in_constexpr_fundecl_p): New. - (validate_constexpr_fundecl): Use it. - (valid_for_static_initialization_p): New. - (cxx_eval_bare_aggregate): Likewise. - (implicit_dereference_p): Likewise. - (implicit_address_p): Likewise. - (cxx_eval_constant_expression): Use them. - 2010-05-06 Magnus Fromreide <magfr@lysator.liu.se> Jason Merrill <jason@redhat.com> diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h index e408ef7ea6e..f57efb91acf 100644 --- a/gcc/cp/cp-tree.h +++ b/gcc/cp/cp-tree.h @@ -5246,6 +5246,7 @@ extern tree maybe_constant_value (tree); extern tree maybe_constant_init (tree); extern bool is_sub_constant_expr (tree); extern bool reduced_constant_expression_p (tree); +extern VEC(tree,heap)* cx_error_context (void); enum { BCS_NO_SCOPE = 1, diff --git a/gcc/cp/error.c b/gcc/cp/error.c index 9ad2b93844c..6f60c06887c 100644 --- a/gcc/cp/error.c +++ b/gcc/cp/error.c @@ -86,6 +86,7 @@ static void dump_scope (tree, int); static void dump_template_parms (tree, int, int); static int get_non_default_template_args_count (tree, int); static const char *function_category (tree); +static void maybe_print_constexpr_context (diagnostic_context *); static void maybe_print_instantiation_context (diagnostic_context *); static void print_instantiation_full_context (diagnostic_context *); static void print_instantiation_partial_context (diagnostic_context *, @@ -2635,6 +2636,7 @@ cp_diagnostic_starter (diagnostic_context *context, diagnostic_report_current_module (context); cp_print_error_function (context, diagnostic); maybe_print_instantiation_context (context); + maybe_print_constexpr_context (context); pp_base_set_prefix (context->printer, diagnostic_build_prefix (context, diagnostic)); } @@ -2955,6 +2957,31 @@ print_instantiation_context (void) diagnostic_flush_buffer (global_dc); } +/* Report what constexpr call(s) we're trying to expand, if any. */ + +void +maybe_print_constexpr_context (diagnostic_context *context) +{ + VEC(tree,heap) *call_stack = cx_error_context (); + unsigned ix; + tree t; + + FOR_EACH_VEC_ELT (tree, call_stack, ix, t) + { + expanded_location xloc = expand_location (EXPR_LOCATION (t)); + const char *s = expr_as_string (t, 0); + if (context->show_column) + pp_verbatim (context->printer, + _("%s:%d:%d: in constexpr expansion of %qs"), + xloc.file, xloc.line, xloc.column, s); + else + pp_verbatim (context->printer, + _("%s:%d: in constexpr expansion of %qs"), + xloc.file, xloc.line, s); + pp_base_newline (context->printer); + } +} + /* Called from output_format -- during diagnostic message processing -- to handle C++ specific format specifier with the following meanings: %A function argument-list. diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index 397d383f650..32154108107 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -5805,6 +5805,40 @@ cxx_bind_parameters_in_call (const constexpr_call *old_call, tree t, } } +/* Variables and functions to manage constexpr call expansion context. + These do not need to be marked for PCH or GC. */ + +static VEC(tree,heap) *call_stack = NULL; +static int call_stack_tick; +static int last_cx_error_tick; + +static void +push_cx_call_context (tree call) +{ + ++call_stack_tick; + if (!EXPR_HAS_LOCATION (call)) + SET_EXPR_LOCATION (call, input_location); + VEC_safe_push (tree, heap, call_stack, call); +} + +static void +pop_cx_call_context (void) +{ + ++call_stack_tick; + VEC_pop (tree, call_stack); +} + +VEC(tree,heap) * +cx_error_context (void) +{ + VEC(tree,heap) *r = NULL; + if (call_stack_tick != last_cx_error_tick + && !VEC_empty (tree, call_stack)) + r = call_stack; + last_cx_error_tick = call_stack_tick; + return r; +} + /* Subroutine of cxx_eval_constant_expression. Evaluate the call expression tree T in the context of OLD_CALL expression evaluation. */ @@ -5814,13 +5848,11 @@ cxx_eval_call_expression (const constexpr_call *old_call, tree t, bool allow_non_constant, bool addr, bool *non_constant_p) { - location_t loc = EXPR_LOCATION (t); + location_t loc = EXPR_LOC_OR_HERE (t); tree fun = get_function_named_in_call (t); tree result; constexpr_call new_call = { NULL, NULL, NULL, 0 }; constexpr_call **slot; - if (loc == UNKNOWN_LOCATION) - loc = input_location; if (TREE_CODE (fun) != FUNCTION_DECL) { /* Might be a constexpr function pointer. */ @@ -5875,6 +5907,8 @@ cxx_eval_call_expression (const constexpr_call *old_call, tree t, if (*non_constant_p) return t; + push_cx_call_context (t); + new_call.hash = iterative_hash_template_arg (new_call.bindings, constexpr_fundef_hash (new_call.fundef)); @@ -5933,13 +5967,7 @@ cxx_eval_call_expression (const constexpr_call *old_call, tree t, } } - if (result == error_mark_node) - { - if (!allow_non_constant) - error_at (loc, "in expansion of %qE", t); - *non_constant_p = true; - result = t; - } + pop_cx_call_context (); return result; } @@ -6513,7 +6541,36 @@ cxx_eval_constant_expression (const constexpr_call *call, tree t, if (DECL_P (r)) { if (!allow_non_constant) - error ("%qD cannot appear in a constant expression", r); + { + tree type = TREE_TYPE (r); + error ("the value of %qD is not usable in a constant " + "expression", r); + if (INTEGRAL_OR_ENUMERATION_TYPE_P (type)) + { + if (!CP_TYPE_CONST_P (type)) + inform (DECL_SOURCE_LOCATION (r), + "%q#D is not const", r); + else if (CP_TYPE_VOLATILE_P (type)) + inform (DECL_SOURCE_LOCATION (r), + "%q#D is volatile", r); + else if (!DECL_INITIAL (r)) + inform (DECL_SOURCE_LOCATION (r), + "%qD was not initialized with a constant " + "expression", r); + else + gcc_unreachable (); + } + else + { + if (cxx_dialect >= cxx0x && !DECL_DECLARED_CONSTEXPR_P (r)) + inform (DECL_SOURCE_LOCATION (r), + "%qD was not declared %<constexpr%>", r); + else + inform (DECL_SOURCE_LOCATION (r), + "%qD does not have integral or enumeration type", + r); + } + } *non_constant_p = true; } break; diff --git a/gcc/defaults.h b/gcc/defaults.h index 88585726c7c..b03abfb022b 100644 --- a/gcc/defaults.h +++ b/gcc/defaults.h @@ -32,33 +32,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #define GET_ENVIRONMENT(VALUE, NAME) do { (VALUE) = getenv (NAME); } while (0) #endif -/* This defines which switch letters take arguments. */ - -#define DEFAULT_SWITCH_TAKES_ARG(CHAR) \ - ((CHAR) == 'D' || (CHAR) == 'U' || (CHAR) == 'o' \ - || (CHAR) == 'e' || (CHAR) == 'T' || (CHAR) == 'u' \ - || (CHAR) == 'I' || (CHAR) == 'J' || (CHAR) == 'm' \ - || (CHAR) == 'x' || (CHAR) == 'L' || (CHAR) == 'A' \ - || (CHAR) == 'B' || (CHAR) == 'd') - /* This defines which multi-letter switches take arguments. */ -#define DEFAULT_WORD_SWITCH_TAKES_ARG(STR) \ - (!strcmp (STR, "Tdata") || !strcmp (STR, "Ttext") \ - || !strcmp (STR, "Tbss") || !strcmp (STR, "include") \ - || !strcmp (STR, "imacros") || !strcmp (STR, "aux-info") \ - || !strcmp (STR, "idirafter") || !strcmp (STR, "iprefix") \ - || !strcmp (STR, "iwithprefix") || !strcmp (STR, "iwithprefixbefore") \ - || !strcmp (STR, "iquote") || !strcmp (STR, "isystem") \ - || !strcmp (STR, "isysroot") || !strcmp (STR, "imultilib") \ - || !strcmp (STR, "-param") || !strcmp (STR, "specs") \ - || !strcmp (STR, "MF") || !strcmp (STR, "MT") || !strcmp (STR, "MQ") \ - || !strcmp (STR, "fintrinsic-modules-path") \ - || !strcmp (STR, "dumpbase") || !strcmp (STR, "dumpdir")) - -#ifndef SWITCH_TAKES_ARG -#define SWITCH_TAKES_ARG(CHAR) DEFAULT_SWITCH_TAKES_ARG (CHAR) -#endif +#define DEFAULT_WORD_SWITCH_TAKES_ARG(STR) 0 #ifndef WORD_SWITCH_TAKES_ARG #define WORD_SWITCH_TAKES_ARG(STR) DEFAULT_WORD_SWITCH_TAKES_ARG (STR) @@ -813,16 +789,6 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #define TARGET_DEFAULT_PACK_STRUCT 0 #endif -/* By default, the C++ compiler will use function addresses in the - vtable entries. Setting this nonzero tells the compiler to use - function descriptors instead. The value of this macro says how - many words wide the descriptor is (normally 2). It is assumed - that the address of a function descriptor may be treated as a - pointer to a function. */ -#ifndef TARGET_VTABLE_USES_DESCRIPTORS -#define TARGET_VTABLE_USES_DESCRIPTORS 0 -#endif - /* By default, the vtable entries are void pointers, the so the alignment is the same as pointer alignment. The value of this macro specifies the alignment of the vtable entry in bits. It should be defined only @@ -1381,6 +1347,16 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #define STACK_CHECK_MAX_VAR_SIZE (STACK_CHECK_MAX_FRAME_SIZE / 100) #endif +/* By default, the C++ compiler will use function addresses in the + vtable entries. Setting this nonzero tells the compiler to use + function descriptors instead. The value of this macro says how + many words wide the descriptor is (normally 2). It is assumed + that the address of a function descriptor may be treated as a + pointer to a function. */ +#ifndef TARGET_VTABLE_USES_DESCRIPTORS +#define TARGET_VTABLE_USES_DESCRIPTORS 0 +#endif + #ifndef SWITCHABLE_TARGET #define SWITCHABLE_TARGET 0 #endif diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index 0c2db4739d0..9126d437ace 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -99,24 +99,12 @@ from being defined in the @file{.h} file to being part of the @c prevent bad page break with this line You can control the compilation driver. -@defmac SWITCH_TAKES_ARG (@var{char}) -A C expression which determines whether the option @option{-@var{char}} -takes arguments. The value should be the number of arguments that -option takes--zero, for many options. - -By default, this macro is defined as -@code{DEFAULT_SWITCH_TAKES_ARG}, which handles the standard options -properly. You need not define @code{SWITCH_TAKES_ARG} unless you -wish to add additional options which take arguments. Any redefinition -should call @code{DEFAULT_SWITCH_TAKES_ARG} and then check for -additional options. -@end defmac - @defmac WORD_SWITCH_TAKES_ARG (@var{name}) A C expression which determines whether the option @option{-@var{name}} takes arguments. The value should be the number of arguments that -option takes--zero, for many options. This macro rather than -@code{SWITCH_TAKES_ARG} is used for multi-character option names. +option takes--zero, for many options. +This macro does not need to handle options defined in @file{.opt} +files, only those that are handled purely through specs. By default, this macro is defined as @code{DEFAULT_WORD_SWITCH_TAKES_ARG}, which handles the standard options diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in index c4d5e8ab150..2c36a765906 100644 --- a/gcc/doc/tm.texi.in +++ b/gcc/doc/tm.texi.in @@ -99,24 +99,12 @@ from being defined in the @file{.h} file to being part of the @c prevent bad page break with this line You can control the compilation driver. -@defmac SWITCH_TAKES_ARG (@var{char}) -A C expression which determines whether the option @option{-@var{char}} -takes arguments. The value should be the number of arguments that -option takes--zero, for many options. - -By default, this macro is defined as -@code{DEFAULT_SWITCH_TAKES_ARG}, which handles the standard options -properly. You need not define @code{SWITCH_TAKES_ARG} unless you -wish to add additional options which take arguments. Any redefinition -should call @code{DEFAULT_SWITCH_TAKES_ARG} and then check for -additional options. -@end defmac - @defmac WORD_SWITCH_TAKES_ARG (@var{name}) A C expression which determines whether the option @option{-@var{name}} takes arguments. The value should be the number of arguments that -option takes--zero, for many options. This macro rather than -@code{SWITCH_TAKES_ARG} is used for multi-character option names. +option takes--zero, for many options. +This macro does not need to handle options defined in @file{.opt} +files, only those that are handled purely through specs. By default, this macro is defined as @code{DEFAULT_WORD_SWITCH_TAKES_ARG}, which handles the standard options diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 9dae56aebe5..58adc25769b 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,13 @@ +2010-11-01 Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/46152 + * fortran/match.c (match_derived_type_spec): Reoplace gfc_match_symbol + with a gfc_find_symbol to prevent namespace pollution. Remove dead + code. + (match_type_spec): Remove parsing of '::'. Collapse character + kind checking to one location. + (gfc_match_allocate): Use correct locus in error message. + 2010-10-30 Thomas Koenig <tkoenig@gcc.gnu.org> * gfortran.h (gfc_option_t): Replace dump_parse_tree by diff --git a/gcc/fortran/match.c b/gcc/fortran/match.c index efde1a6c71b..1b895f0b872 100644 --- a/gcc/fortran/match.c +++ b/gcc/fortran/match.c @@ -2711,26 +2711,25 @@ gfc_free_alloc_list (gfc_alloc *p) static match match_derived_type_spec (gfc_typespec *ts) { + char name[GFC_MAX_SYMBOL_LEN + 1]; locus old_locus; gfc_symbol *derived; - old_locus = gfc_current_locus; + old_locus = gfc_current_locus; - if (gfc_match_symbol (&derived, 1) == MATCH_YES) + if (gfc_match ("%n", name) != MATCH_YES) { - if (derived->attr.flavor == FL_DERIVED) - { - ts->type = BT_DERIVED; - ts->u.derived = derived; - return MATCH_YES; - } - else - { - /* Enforce F03:C476. */ - gfc_error ("'%s' at %L is not an accessible derived type", - derived->name, &gfc_current_locus); - return MATCH_ERROR; - } + gfc_current_locus = old_locus; + return MATCH_NO; + } + + gfc_find_symbol (name, NULL, 1, &derived); + + if (derived && derived->attr.flavor == FL_DERIVED) + { + ts->type = BT_DERIVED; + ts->u.derived = derived; + return MATCH_YES; } gfc_current_locus = old_locus; @@ -2752,17 +2751,12 @@ match_type_spec (gfc_typespec *ts) locus old_locus; gfc_clear_ts (ts); - gfc_gobble_whitespace(); + gfc_gobble_whitespace (); old_locus = gfc_current_locus; - m = match_derived_type_spec (ts); - if (m == MATCH_YES) + if (match_derived_type_spec (ts) == MATCH_YES) { - old_locus = gfc_current_locus; - if (gfc_match (" :: ") != MATCH_YES) - return MATCH_ERROR; - gfc_current_locus = old_locus; - /* Enfore F03:C401. */ + /* Enforce F03:C401. */ if (ts->u.derived->attr.abstract) { gfc_error ("Derived type '%s' at %L may not be ABSTRACT", @@ -2771,10 +2765,6 @@ match_type_spec (gfc_typespec *ts) } return MATCH_YES; } - else if (m == MATCH_ERROR && gfc_match (" :: ") == MATCH_YES) - return MATCH_ERROR; - - gfc_current_locus = old_locus; if (gfc_match ("integer") == MATCH_YES) { @@ -2807,7 +2797,13 @@ match_type_spec (gfc_typespec *ts) if (gfc_match ("character") == MATCH_YES) { ts->type = BT_CHARACTER; - goto char_selector; + + m = gfc_match_char_spec (ts); + + if (m == MATCH_NO) + m = MATCH_YES; + + return m; } if (gfc_match ("logical") == MATCH_YES) @@ -2836,15 +2832,6 @@ kind_selector: m = MATCH_YES; /* No kind specifier found. */ return m; - -char_selector: - - m = gfc_match_char_spec (ts); - - if (m == MATCH_NO) - m = MATCH_YES; /* No kind specifier found. */ - - return m; } @@ -2874,7 +2861,17 @@ gfc_match_allocate (void) if (m == MATCH_ERROR) goto cleanup; else if (m == MATCH_NO) - ts.type = BT_UNKNOWN; + { + char name[GFC_MAX_SYMBOL_LEN + 3]; + + if (gfc_match ("%n :: ", name) == MATCH_YES) + { + gfc_error ("Error in type-spec at %L", &old_locus); + goto cleanup; + } + + ts.type = BT_UNKNOWN; + } else { if (gfc_match (" :: ") == MATCH_YES) @@ -2957,8 +2954,8 @@ gfc_match_allocate (void) || sym->ns->proc_name->attr.proc_pointer); if (b1 && b2 && !b3) { - gfc_error ("Allocate-object at %C is not a nonprocedure pointer " - "or an allocatable variable"); + gfc_error ("Allocate-object at %L is not a nonprocedure pointer " + "or an allocatable variable", &tail->expr->where); goto cleanup; } diff --git a/gcc/gcc.c b/gcc/gcc.c index 13635d52b8a..c016a5c3d22 100644 --- a/gcc/gcc.c +++ b/gcc/gcc.c @@ -665,7 +665,7 @@ proper position among the other output files. */ %{flto:%<fcompare-debug*} %{fwhopr*:%<fcompare-debug*} \ %{flto} %{fwhopr*} %l " LINK_PIE_SPEC \ "%X %{o*} %{A} %{d} %{e*} %{m} %{N} %{n} %{r}\ - %{s} %{t} %{u*} %{x} %{z} %{Z} %{!A:%{!nostdlib:%{!nostartfiles:%S}}}\ + %{s} %{t} %{u*} %{z} %{Z} %{!A:%{!nostdlib:%{!nostartfiles:%S}}}\ %{static:} %{L*} %(mfwrap) %(link_libgcc) %o\ %{fopenmp|ftree-parallelize-loops=*:%:include(libgomp.spec)%(link_gomp)}\ %(mflib) " STACK_SPLIT_SPEC "\ diff --git a/gcc/libgcov.c b/gcc/libgcov.c index 07f27db1363..e89e7e6cbac 100644 --- a/gcc/libgcov.c +++ b/gcc/libgcov.c @@ -798,6 +798,24 @@ __gcov_one_value_profiler (gcov_type *counters, gcov_type value) #endif #ifdef L_gcov_indirect_call_profiler + +/* By default, the C++ compiler will use function addresses in the + vtable entries. Setting TARGET_VTABLE_USES_DESCRIPTORS to nonzero + tells the compiler to use function descriptors instead. The value + of this macro says how many words wide the descriptor is (normally 2), + but it may be dependent on target flags. Since we do not have access + to the target flags here we just check to see if it is set and use + that to set VTABLE_USES_DESCRIPTORS to 0 or 1. + + It is assumed that the address of a function descriptor may be treated + as a pointer to a function. */ + +#ifdef TARGET_VTABLE_USES_DESCRIPTORS +#define VTABLE_USES_DESCRIPTORS 1 +#else +#define VTABLE_USES_DESCRIPTORS 0 +#endif + /* Tries to determine the most common value among its inputs. */ void __gcov_indirect_call_profiler (gcov_type* counter, gcov_type value, @@ -807,7 +825,7 @@ __gcov_indirect_call_profiler (gcov_type* counter, gcov_type value, function may have multiple descriptors and we need to dereference the descriptors to see if they point to the same function. */ if (cur_func == callee_func - || (TARGET_VTABLE_USES_DESCRIPTORS && callee_func + || (VTABLE_USES_DESCRIPTORS && callee_func && *(void **) cur_func == *(void **) callee_func)) __gcov_one_value_profiler_body (counter, value); } diff --git a/gcc/objc/ChangeLog b/gcc/objc/ChangeLog index 04841334ff9..e9e559214a2 100644 --- a/gcc/objc/ChangeLog +++ b/gcc/objc/ChangeLog @@ -1,3 +1,45 @@ +2010-11-01 Nicola Pero <nicola.pero@meta-innovation.com> + + Implemented format and noreturn attributes for Objective-C methods. + * objc-act.c (objc_start_method_definition): If method attributes + are specified emit a warning and ignore them. + (build_objc_method_call): Moved deprecation warnings from here ... + (objc_finish_message_expr): to here. Do not emit deprecation + warnings if the receiver is of type 'id'. + (really_start_method): Install 'deprecation' and 'noreturn' + attributes. + (objc_decl_method_attributes): Carefully filter out the list of + attributes, allowing only "noreturn", "format", "sentinel" and + "deprecated". In the case of "format", adjust the arguments. + Always process the attributes in the same way no matter if + "sentinel" is in the list or not. + +2010-11-01 Nicola Pero <nicola.pero@meta-innovation.com> + + * objc-act.c (objc_maybe_build_component_ref): Warn about using + deprecated properties. + (objc_maybe_printable_name): Support PROPERTY_DECL. + +2010-11-01 Nicola Pero <nicola.pero@meta-innovation.com> + + Implemented Objective-C 2.0 property accessors. + * objc-act.h (enum objc_tree_index): Added OCTI_GET_PROPERTY_DECL, + OCTI_SET_PROPERTY_DECL, OCTI_COPY_STRUCT_DECL, + OCTI_GET_PROPERTY_STRUCT_DECL and OCTI_SET_PROPERTY_STRUCT_DECL. + (objc_getProperty_decl): New. + (objc_setProperty_decl): New. + (objc_copyStruct_decl): New. + (objc_getPropertyStruct_decl): New. + (objc_setPropertyStruct_decl): New. + * objc-act.c (build_objc_property_accessor_helpers): New. + (synth_module_prologue): Call + build_objc_property_accessor_helpers. + (lookup_ivar): New. + (objc_synthesize_getter): Implemented synthesizing getters that + work with properties that are not nonatomic, assign properties. + (objc_synthesize_setter): Implemented synthesizing setters that + work with properties that are not nonatomic, assign properties. + 2010-10-30 Nicola Pero <nicola.pero@meta-innovation.com> Implemented Objective-C 2.0 @property, @synthesize and @dynamic. diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c index e564da55fbc..768215e7257 100644 --- a/gcc/objc/objc-act.c +++ b/gcc/objc/objc-act.c @@ -178,6 +178,7 @@ static int match_proto_with_proto (tree, tree, int); static tree lookup_property (tree, tree); static tree lookup_property_in_list (tree, tree); static tree lookup_property_in_protocol_list (tree, tree); +static void build_objc_property_accessor_helpers (void); static void objc_xref_basetypes (tree, tree); @@ -1121,6 +1122,9 @@ objc_maybe_build_component_ref (tree object, tree property_ident) { tree expression; + if (TREE_DEPRECATED (x)) + warn_deprecated_use (x, NULL_TREE); + expression = build2 (PROPERTY_REF, TREE_TYPE(x), object, x); SET_EXPR_LOCATION (expression, input_location); TREE_SIDE_EFFECTS (expression) = 1; @@ -1257,7 +1261,11 @@ objc_start_method_definition (bool is_class_method, tree decl, tree attributes) c_break_label = c_cont_label = size_zero_node; #endif - objc_decl_method_attributes (&decl, attributes, 0); + if (attributes) + warning_at (input_location, 0, "method attributes can not be specified in @implementation context"); + else + objc_decl_method_attributes (&decl, attributes, 0); + objc_add_method (objc_implementation_context, decl, is_class_method, @@ -2348,6 +2356,10 @@ synth_module_prologue (void) build_category_template (); build_objc_exception_stuff (); + /* Declare objc_getProperty, object_setProperty and other property + accessor helpers. */ + build_objc_property_accessor_helpers (); + if (flag_next_runtime) build_next_objc_exception_stuff (); @@ -6590,6 +6602,11 @@ build_method_decl (enum tree_code code, tree ret_type, tree selector, /* If no type is specified, default to "id". */ ret_type = adjust_type_for_id_default (ret_type); + /* Note how a method_decl has a TREE_TYPE which is not the function + type of the function implementing the method, but only the return + type of the method. We may want to change this, and store the + entire function type in there (eg, it may be used to simplify + dealing with attributes below). */ method_decl = make_node (code); TREE_TYPE (method_decl) = ret_type; @@ -6620,19 +6637,119 @@ build_method_decl (enum tree_code code, tree ret_type, tree selector, static void objc_decl_method_attributes (tree *node, tree attributes, int flags) { - tree sentinel_attr = lookup_attribute ("sentinel", attributes); - if (sentinel_attr) + /* TODO: Replace the hackery below. An idea would be to store the + full function type in the method declaration (for example in + TREE_TYPE) and then expose ObjC method declarations to c-family + and they could deal with them by simply treating them as + functions. */ + + /* Because of the dangers in the hackery below, we filter out any + attribute that we do not know about. For the ones we know about, + we know that they work with the hackery. For the other ones, + there is no guarantee, so we have to filter them out. */ + tree filtered_attributes = NULL_TREE; + + if (attributes) { - /* hackery to make an obj method look like a function type. */ - tree rettype = TREE_TYPE (*node); - TREE_TYPE (*node) = build_function_type (TREE_VALUE (rettype), - get_arg_type_list (*node, METHOD_REF, 0)); - decl_attributes (node, attributes, flags); + tree attribute; + for (attribute = attributes; attribute; attribute = TREE_CHAIN (attribute)) + { + tree name = TREE_PURPOSE (attribute); + + if (is_attribute_p ("deprecated", name) + || is_attribute_p ("sentinel", name) + || is_attribute_p ("noreturn", name)) + { + /* An attribute that we support; add it to the filtered + attributes. */ + filtered_attributes = chainon (filtered_attributes, + copy_node (attribute)); + } + else if (is_attribute_p ("format", name)) + { + /* "format" is special because before adding it to the + filtered attributes we need to adjust the specified + format by adding the hidden function parameters for + an Objective-C method (self, _cmd). */ + tree new_attribute = copy_node (attribute); + + /* Check the arguments specified with the attribute, and + modify them adding 2 for the two hidden arguments. + Note how this differs from C++; according to the + specs, C++ does not do it so you have to add the +1 + yourself. For Objective-C, instead, the compiler + adds the +2 for you. */ + + /* The attribute arguments have not been checked yet, so + we need to be careful as they could be missing or + invalid. If anything looks wrong, we skip the + process and the compiler will complain about it later + when it validates the attribute. */ + /* Check that we have at least three arguments. */ + if (TREE_VALUE (new_attribute) + && TREE_CHAIN (TREE_VALUE (new_attribute)) + && TREE_CHAIN (TREE_CHAIN (TREE_VALUE (new_attribute)))) + { + tree second_argument = TREE_CHAIN (TREE_VALUE (new_attribute)); + tree third_argument = TREE_CHAIN (second_argument); + tree number; + + /* This is the second argument, the "string-index", + which specifies the index of the format string + argument. Add 2. */ + number = TREE_VALUE (second_argument); + if (number + && TREE_CODE (number) == INTEGER_CST + && TREE_INT_CST_HIGH (number) == 0) + { + TREE_VALUE (second_argument) + = build_int_cst (integer_type_node, + TREE_INT_CST_LOW (number) + 2); + } + + /* This is the third argument, the "first-to-check", + which specifies the index of the first argument to + check. This could be 0, meaning it is not available, + in which case we don't need to add 2. Add 2 if not + 0. */ + number = TREE_VALUE (third_argument); + if (number + && TREE_CODE (number) == INTEGER_CST + && TREE_INT_CST_HIGH (number) == 0 + && TREE_INT_CST_LOW (number) != 0) + { + TREE_VALUE (third_argument) + = build_int_cst (integer_type_node, + TREE_INT_CST_LOW (number) + 2); + } + } + filtered_attributes = chainon (filtered_attributes, + new_attribute); + } + else + warning (OPT_Wattributes, "%qE attribute directive ignored", name); + } + } + + if (filtered_attributes) + { + /* This hackery changes the TREE_TYPE of the ObjC method + declaration to be a function type, so that decl_attributes + will treat the ObjC method as if it was a function. Some + attributes (sentinel, format) will be applied to the function + type, changing it in place; so after calling decl_attributes, + we extract the function type attributes and store them in + METHOD_TYPE_ATTRIBUTES. Some other attributes (noreturn, + deprecated) are applied directly to the method declaration + (by setting TREE_DEPRECATED and TREE_THIS_VOLATILE) so there + is nothing to do. */ + tree saved_type = TREE_TYPE (*node); + TREE_TYPE (*node) = build_function_type + (TREE_VALUE (saved_type), get_arg_type_list (*node, METHOD_REF, 0)); + decl_attributes (node, filtered_attributes, flags); METHOD_TYPE_ATTRIBUTES (*node) = TYPE_ATTRIBUTES (TREE_TYPE (*node)); - TREE_TYPE (*node) = rettype; + TREE_TYPE (*node) = saved_type; } - else - decl_attributes (node, attributes, flags); } bool @@ -7141,6 +7258,26 @@ objc_finish_message_expr (tree receiver, tree sel_name, tree method_params) warn_missing_methods = true; } } + else + { + /* Warn if the method is deprecated, but not if the receiver is + a generic 'id'. 'id' is used to cast an object to a generic + object of an unspecified class; in that case, we'll use + whatever method prototype we can find to get the method + argument and return types, but it is not appropriate to + produce deprecation warnings since we don't know the class + that the object will be of at runtime. The @interface(s) for + that class may not even be available to the compiler right + now, and it is perfectly possible that the method is marked + as non-deprecated in such @interface(s). + + In practice this makes sense since casting an object to 'id' + is often used precisely to turn off warnings associated with + the object being of a particular class. */ + if (TREE_DEPRECATED (method_prototype) && rtype != NULL_TREE) + warn_deprecated_use (method_prototype, NULL_TREE); + } + /* Save the selector name for printing error messages. */ current_objc_message_selector = sel_name; @@ -7201,14 +7338,12 @@ build_objc_method_call (location_t loc, int super_flag, tree method_prototype, tree method, t; if (method_prototype && METHOD_TYPE_ATTRIBUTES (method_prototype)) - ftype = build_type_attribute_variant ( - ftype, METHOD_TYPE_ATTRIBUTES (method_prototype)); + ftype = build_type_attribute_variant (ftype, + METHOD_TYPE_ATTRIBUTES + (method_prototype)); sender_cast = build_pointer_type (ftype); - if (method_prototype && TREE_DEPRECATED (method_prototype)) - warn_deprecated_use (method_prototype, NULL_TREE); - lookup_object = build_c_cast (loc, rcv_p, lookup_object); /* Use SAVE_EXPR to avoid evaluating the receiver twice. */ @@ -7938,6 +8073,7 @@ add_instance_variable (tree klass, objc_ivar_visibility_kind visibility, return klass; } + static tree is_ivar (tree decl_chain, tree ident) { @@ -8516,11 +8652,120 @@ objc_build_property_setter_name (tree ident) return string; } +/* This routine prepares the declarations of the property accessor + helper functions (objc_getProperty(), etc) that are used when + @synthesize is used. */ +static void +build_objc_property_accessor_helpers (void) +{ + tree type; + + /* Declare the following function: + id + objc_getProperty (id self, SEL _cmd, + ptrdiff_t offset, BOOL is_atomic); */ + type = build_function_type_list (objc_object_type, + objc_object_type, + objc_selector_type, + ptrdiff_type_node, + boolean_type_node, + NULL_TREE); + objc_getProperty_decl = add_builtin_function ("objc_getProperty", + type, 0, NOT_BUILT_IN, + NULL, NULL_TREE); + TREE_NOTHROW (objc_getProperty_decl) = 0; + + /* Declare the following function: + void + objc_setProperty (id self, SEL _cmd, + ptrdiff_t offset, id new_value, + BOOL is_atomic, BOOL should_copy); */ + type = build_function_type_list (void_type_node, + objc_object_type, + objc_selector_type, + ptrdiff_type_node, + objc_object_type, + boolean_type_node, + boolean_type_node, + NULL_TREE); + objc_setProperty_decl = add_builtin_function ("objc_setProperty", + type, 0, NOT_BUILT_IN, + NULL, NULL_TREE); + TREE_NOTHROW (objc_setProperty_decl) = 0; + + /* This is the type of all of the following functions + (objc_copyStruct(), objc_getPropertyStruct() and + objc_setPropertyStruct()). */ + type = build_function_type_list (void_type_node, + ptr_type_node, + const_ptr_type_node, + ptrdiff_type_node, + boolean_type_node, + boolean_type_node, + NULL_TREE); + + if (flag_next_runtime) + { + /* Declare the following function: + void + objc_copyStruct (void *destination, const void *source, + ptrdiff_t size, BOOL is_atomic, BOOL has_strong); */ + objc_copyStruct_decl = add_builtin_function ("objc_copyStruct", + type, 0, NOT_BUILT_IN, + NULL, NULL_TREE); + TREE_NOTHROW (objc_copyStruct_decl) = 0; + objc_getPropertyStruct_decl = NULL_TREE; + objc_setPropertyStruct_decl = NULL_TREE; + } + else + { + objc_copyStruct_decl = NULL_TREE; + + /* Declare the following function: + void + objc_getPropertyStruct (void *destination, const void *source, + ptrdiff_t size, BOOL is_atomic, BOOL has_strong); */ + objc_getPropertyStruct_decl = add_builtin_function ("objc_getPropertyStruct", + type, 0, NOT_BUILT_IN, + NULL, NULL_TREE); + TREE_NOTHROW (objc_getPropertyStruct_decl) = 0; + /* Declare the following function: + void + objc_setPropertyStruct (void *destination, const void *source, + ptrdiff_t size, BOOL is_atomic, BOOL has_strong); */ + objc_setPropertyStruct_decl = add_builtin_function ("objc_setPropertyStruct", + type, 0, NOT_BUILT_IN, + NULL, NULL_TREE); + TREE_NOTHROW (objc_setPropertyStruct_decl) = 0; + } +} + +/* This looks up an ivar in a class (including superclasses). */ +static tree +lookup_ivar (tree interface, tree instance_variable_name) +{ + while (interface) + { + tree decl_chain; + + for (decl_chain = CLASS_IVARS (interface); decl_chain; decl_chain = DECL_CHAIN (decl_chain)) + if (DECL_NAME (decl_chain) == instance_variable_name) + return decl_chain; + + /* Not found. Search superclass if any. */ + if (CLASS_SUPER_NAME (interface)) + interface = lookup_interface (CLASS_SUPER_NAME (interface)); + } + + return NULL_TREE; +} + /* This routine synthesizes a 'getter' method. This is only called for @synthesize properties. */ static void -objc_synthesize_getter (tree klass ATTRIBUTE_UNUSED, tree class_method, tree property) +objc_synthesize_getter (tree klass, tree class_method, tree property) { + location_t location = DECL_SOURCE_LOCATION (property); tree fn, decl; tree body; tree ret_val; @@ -8543,29 +8788,150 @@ objc_synthesize_getter (tree klass ATTRIBUTE_UNUSED, tree class_method, tree pro /* Adapt the 'decl'. Use the source location of the @synthesize statement for error messages. */ decl = copy_node (decl); - DECL_SOURCE_LOCATION (decl) = DECL_SOURCE_LOCATION (property); + DECL_SOURCE_LOCATION (decl) = location; objc_start_method_definition (false /* is_class_method */, decl, NULL_TREE); body = c_begin_compound_stmt (true); - /* TODO: Implement PROPERTY_NONATOMIC, use objc_getProperty etc as - appropriate. The following code just always does direct ivar - access. */ + /* Now we need to decide how we build the getter. There are three + cases: - /* return self->_property_name; */ + for 'copy' or 'retain' properties we need to use the + objc_getProperty() accessor helper which knows about retain and + copy. It supports both 'nonatomic' and 'atomic' access. + + for 'nonatomic, assign' properties we can access the instance + variable directly. 'nonatomic' means we don't have to use locks, + and 'assign' means we don't have to worry about retain or copy. + If you combine the two, it means we can just access the instance + variable directly. + + for 'atomic, assign' properties we use objc_copyStruct() (for the + next runtime) or objc_getPropertyStruct() (for the GNU runtime). */ + switch (PROPERTY_ASSIGN_SEMANTICS (property)) + { + case OBJC_PROPERTY_RETAIN: + case OBJC_PROPERTY_COPY: + { + /* We build "return objc_getProperty (self, _cmd, offset, is_atomic);" */ + tree cmd, ivar, offset, is_atomic; + cmd = TREE_CHAIN (DECL_ARGUMENTS (current_function_decl)); + + /* Find the ivar to compute the offset. */ + ivar = lookup_ivar (klass, PROPERTY_IVAR_NAME (property)); + if (!ivar || is_private (ivar)) + { + /* This should never happen. */ + error_at (location, + "can not find instance variable associated with property"); + ret_val = error_mark_node; + break; + } + offset = byte_position (ivar); + + if (PROPERTY_NONATOMIC (property)) + is_atomic = boolean_false_node; + else + is_atomic = boolean_true_node; + + ret_val = build_function_call + (location, + /* Function prototype. */ + objc_getProperty_decl, + /* Parameters. */ + tree_cons /* self */ + (NULL_TREE, self_decl, + tree_cons /* _cmd */ + (NULL_TREE, cmd, + tree_cons /* offset */ + (NULL_TREE, offset, + tree_cons /* is_atomic */ + (NULL_TREE, is_atomic, NULL_TREE))))); + } + break; + case OBJC_PROPERTY_ASSIGN: + if (PROPERTY_NONATOMIC (property)) + { + /* We build "return self->PROPERTY_IVAR_NAME;" */ + ret_val = objc_lookup_ivar (NULL_TREE, PROPERTY_IVAR_NAME (property)); + break; + } + else + { + /* We build + <property type> __objc_property_temp; + objc_getPropertyStruct (&__objc_property_temp, + &(self->PROPERTY_IVAR_NAME), + sizeof (type of self->PROPERTY_IVAR_NAME), + is_atomic, + false) + return __objc_property_temp; + + For the NeXT runtime, we need to use objc_copyStruct + instead of objc_getPropertyStruct. */ + tree objc_property_temp_decl, function_decl, function_call; + tree size_of, is_atomic; + + objc_property_temp_decl = objc_create_temporary_var (TREE_TYPE (property), "__objc_property_temp"); + DECL_SOURCE_LOCATION (objc_property_temp_decl) = location; + objc_property_temp_decl = lang_hooks.decls.pushdecl (objc_property_temp_decl); + + /* sizeof (ivar type). Since the ivar and the property have + the same type, there is no need to lookup the ivar. */ + size_of = c_sizeof_or_alignof_type (location, TREE_TYPE (property), + true /* is_sizeof */, + false /* complain */); + + if (PROPERTY_NONATOMIC (property)) + is_atomic = boolean_false_node; + else + is_atomic = boolean_true_node; + + if (flag_next_runtime) + function_decl = objc_copyStruct_decl; + else + function_decl = objc_getPropertyStruct_decl; + + function_call = build_function_call + (location, + /* Function prototype. */ + function_decl, + /* Parameters. */ + tree_cons /* &__objc_property_temp_decl */ + /* Warning: note that using build_fold_addr_expr_loc() + here causes invalid code to be generated. */ + (NULL_TREE, build_unary_op (location, ADDR_EXPR, objc_property_temp_decl, 0), + tree_cons /* &(self->PROPERTY_IVAR_NAME); */ + (NULL_TREE, build_fold_addr_expr_loc (location, + objc_lookup_ivar + (NULL_TREE, PROPERTY_IVAR_NAME (property))), + tree_cons /* sizeof (PROPERTY_IVAR) */ + (NULL_TREE, size_of, + tree_cons /* is_atomic */ + (NULL_TREE, is_atomic, + /* TODO: This is currently ignored by the GNU + runtime, but what about the next one ? */ + tree_cons /* has_strong */ + (NULL_TREE, boolean_true_node, NULL_TREE)))))); + + add_stmt (function_call); + + ret_val = objc_property_temp_decl; + } + break; + default: + gcc_unreachable (); + } - /* PROPERTY_IVAR_NAME is always defined if we got here, and should - be a valid instance variable. */ - ret_val = objc_lookup_ivar (NULL_TREE, PROPERTY_IVAR_NAME (property)); gcc_assert (ret_val); #ifdef OBJCPLUS finish_return_stmt (ret_val); #else - (void)c_finish_return (DECL_SOURCE_LOCATION (property), ret_val, NULL); + c_finish_return (location, ret_val, NULL_TREE); #endif - add_stmt (c_end_compound_stmt (DECL_SOURCE_LOCATION (property), body, true)); + add_stmt (c_end_compound_stmt (location, body, true)); fn = current_function_decl; #ifdef OBJCPLUS finish_function (); @@ -8578,8 +8944,10 @@ objc_synthesize_getter (tree klass ATTRIBUTE_UNUSED, tree class_method, tree pro static void objc_synthesize_setter (tree klass ATTRIBUTE_UNUSED, tree class_method, tree property) { - tree fn, decl, lhs, rhs; + location_t location = DECL_SOURCE_LOCATION (property); + tree fn, decl; tree body; + tree new_value, statement; /* If user has implemented a setter with same name then do nothing. */ if (lookup_method (CLASS_NST_METHODS (objc_implementation_context), @@ -8605,40 +8973,153 @@ objc_synthesize_setter (tree klass ATTRIBUTE_UNUSED, tree class_method, tree pro body = c_begin_compound_stmt (true); - /* TODO: Implement PROPERTY_NONATOMIC, use objc_getProperty etc as - appropriate. The following code just always does direct ivar - access. */ - - /* _property_name = _value; */ - - /* PROPERTY_IVAR_NAME is always defined if we got here, and should - be a valid instance variable. */ - lhs = objc_lookup_ivar (NULL_TREE, PROPERTY_IVAR_NAME (property)); - gcc_assert (lhs); - - /* TODO: Lookup the argument in a more robust way so that it works - even if the method prototype does not call it '_value'. */ - rhs = lookup_name (get_identifier ("_value")); + /* The 'new_value' is the only argument to the method, which is the + 3rd argument of the function, after self and _cmd. We use twice + TREE_CHAIN to move forward two arguments. */ + new_value = TREE_CHAIN (TREE_CHAIN (DECL_ARGUMENTS (current_function_decl))); /* This would presumably happen if the user has specified a - prototype for the setter that is not the correct one. */ - if (rhs == NULL_TREE) + prototype for the setter that does not have an argument! */ + if (new_value == NULL_TREE) { /* TODO: This should be caught much earlier than this. */ - /* We couldn't find the '_value' identifier in the current - context; presumably the user didn't have a '_value' - argument. */ - error_at (DECL_SOURCE_LOCATION (decl), "invalid setter, missing _value argument"); - /* Just recover somehow. */ - rhs = lhs; - } - - /* FIXME: NULL types to get compile. */ - add_stmt (build_modify_expr (DECL_SOURCE_LOCATION (decl), - lhs, NULL_TREE, NOP_EXPR, - DECL_SOURCE_LOCATION (decl), rhs, NULL_TREE)); - - add_stmt (c_end_compound_stmt (DECL_SOURCE_LOCATION (decl), body, true)); + error_at (DECL_SOURCE_LOCATION (decl), "invalid setter, it must have one argument"); + /* Try to recover somehow. */ + new_value = error_mark_node; + } + + /* Now we need to decide how we build the setter. There are three + cases: + + for 'copy' or 'retain' properties we need to use the + objc_setProperty() accessor helper which knows about retain and + copy. It supports both 'nonatomic' and 'atomic' access. + + for 'nonatomic, assign' properties we can access the instance + variable directly. 'nonatomic' means we don't have to use locks, + and 'assign' means we don't have to worry about retain or copy. + If you combine the two, it means we can just access the instance + variable directly. + + for 'atomic, assign' properties we use objc_copyStruct() (for the + next runtime) or objc_setPropertyStruct() (for the GNU runtime). */ + switch (PROPERTY_ASSIGN_SEMANTICS (property)) + { + case OBJC_PROPERTY_RETAIN: + case OBJC_PROPERTY_COPY: + { + /* We build "objc_setProperty (self, _cmd, new_value, offset, is_atomic, should_copy);" */ + tree cmd, ivar, offset, is_atomic, should_copy; + cmd = TREE_CHAIN (DECL_ARGUMENTS (current_function_decl)); + + /* Find the ivar to compute the offset. */ + ivar = lookup_ivar (klass, PROPERTY_IVAR_NAME (property)); + if (!ivar || is_private (ivar)) + { + error_at (location, + "can not find instance variable associated with property"); + statement = error_mark_node; + break; + } + offset = byte_position (ivar); + + if (PROPERTY_NONATOMIC (property)) + is_atomic = boolean_false_node; + else + is_atomic = boolean_true_node; + + if (PROPERTY_ASSIGN_SEMANTICS (property) == OBJC_PROPERTY_COPY) + should_copy = boolean_true_node; + else + should_copy = boolean_false_node; + + statement = build_function_call + (location, + /* Function prototype. */ + objc_setProperty_decl, + /* Parameters. */ + tree_cons /* self */ + (NULL_TREE, self_decl, + tree_cons /* _cmd */ + (NULL_TREE, cmd, + tree_cons /* offset */ + (NULL_TREE, offset, + tree_cons /* new_value */ + (NULL_TREE, new_value, + tree_cons /* is_atomic */ + (NULL_TREE, is_atomic, + tree_cons /* should_copy */ + (NULL_TREE, should_copy, NULL_TREE))))))); + } + break; + case OBJC_PROPERTY_ASSIGN: + if (PROPERTY_NONATOMIC (property)) + { + /* We build "self->PROPERTY_IVAR_NAME = new_value;" */ + statement = build_modify_expr + (location, + objc_lookup_ivar (NULL_TREE, PROPERTY_IVAR_NAME (property)), + NULL_TREE, NOP_EXPR, + location, new_value, NULL_TREE); + break; + } + else + { + /* We build + objc_setPropertyStruct (&(self->PROPERTY_IVAR_NAME), + &new_value, + sizeof (type of self->PROPERTY_IVAR_NAME), + is_atomic, + false) + + For the NeXT runtime, we need to use objc_copyStruct + instead of objc_getPropertyStruct. */ + tree function_decl, size_of, is_atomic; + + /* sizeof (ivar type). Since the ivar and the property have + the same type, there is no need to lookup the ivar. */ + size_of = c_sizeof_or_alignof_type (location, TREE_TYPE (property), + true /* is_sizeof */, + false /* complain */); + + if (PROPERTY_NONATOMIC (property)) + is_atomic = boolean_false_node; + else + is_atomic = boolean_true_node; + + if (flag_next_runtime) + function_decl = objc_copyStruct_decl; + else + function_decl = objc_setPropertyStruct_decl; + + statement = build_function_call + (location, + /* Function prototype. */ + function_decl, + /* Parameters. */ + tree_cons /* &(self->PROPERTY_IVAR_NAME); */ + (NULL_TREE, build_fold_addr_expr_loc (location, + objc_lookup_ivar + (NULL_TREE, PROPERTY_IVAR_NAME (property))), + tree_cons /* &new_value */ + (NULL_TREE, build_fold_addr_expr_loc (location, new_value), + tree_cons /* sizeof (PROPERTY_IVAR) */ + (NULL_TREE, size_of, + tree_cons /* is_atomic */ + (NULL_TREE, is_atomic, + /* TODO: This is currently ignored by the GNU + runtime, but what about the next one ? */ + tree_cons /* has_strong */ + (NULL_TREE, boolean_true_node, NULL_TREE)))))); + } + break; + default: + gcc_unreachable (); + } + gcc_assert (statement); + + add_stmt (statement); + add_stmt (c_end_compound_stmt (location, body, true)); fn = current_function_decl; #ifdef OBJCPLUS finish_function (); @@ -10282,6 +10763,20 @@ really_start_method (tree method, (type ? '-' : '+'), identifier_to_locale (gen_method_decl (proto))); } + else + { + /* If the method in the @interface was deprecated, mark + the implemented method as deprecated too. It should + never be used for messaging (when the deprecation + warnings are produced), but just in case. */ + if (TREE_DEPRECATED (proto)) + TREE_DEPRECATED (method) = 1; + + /* If the method in the @interface was marked as + 'noreturn', mark the function implementing the method + as 'noreturn' too. */ + TREE_THIS_VOLATILE (current_function_decl) = TREE_THIS_VOLATILE (proto); + } } else { @@ -10873,6 +11368,13 @@ objc_maybe_printable_name (tree decl, int v ATTRIBUTE_UNUSED) case CLASS_METHOD_DECL: return IDENTIFIER_POINTER (DECL_NAME (decl)); break; + /* This happens when printing a deprecation warning for a + property. We may want to consider some sort of pretty + printing (eg, include the class name where it was declared + ?). */ + case PROPERTY_DECL: + return IDENTIFIER_POINTER (PROPERTY_NAME (decl)); + break; default: return NULL; break; diff --git a/gcc/objc/objc-act.h b/gcc/objc/objc-act.h index 95e90703c5a..4c10c01378e 100644 --- a/gcc/objc/objc-act.h +++ b/gcc/objc/objc-act.h @@ -339,6 +339,12 @@ enum objc_tree_index OCTI_FAST_ENUM_STATE_TEMP, OCTI_ENUM_MUTATION_DECL, + OCTI_GET_PROPERTY_DECL, + OCTI_SET_PROPERTY_DECL, + OCTI_COPY_STRUCT_DECL, + OCTI_GET_PROPERTY_STRUCT_DECL, + OCTI_SET_PROPERTY_STRUCT_DECL, + OCTI_MAX }; @@ -506,4 +512,13 @@ extern GTY(()) tree objc_global_trees[OCTI_MAX]; #define objc_enumeration_mutation_decl \ objc_global_trees[OCTI_ENUM_MUTATION_DECL] +/* Declarations of functions used when synthesizing property + accessors. */ +#define objc_getProperty_decl objc_global_trees[OCTI_GET_PROPERTY_DECL] +#define objc_setProperty_decl objc_global_trees[OCTI_SET_PROPERTY_DECL] +#define objc_copyStruct_decl objc_global_trees[OCTI_COPY_STRUCT_DECL] +#define objc_getPropertyStruct_decl objc_global_trees[OCTI_GET_PROPERTY_STRUCT_DECL] +#define objc_setPropertyStruct_decl objc_global_trees[OCTI_SET_PROPERTY_STRUCT_DECL] + + #endif /* GCC_OBJC_ACT_H */ diff --git a/gcc/opts-common.c b/gcc/opts-common.c index 553e8b19b89..ab4b1b26f8f 100644 --- a/gcc/opts-common.c +++ b/gcc/opts-common.c @@ -24,7 +24,7 @@ along with GCC; see the file COPYING3. If not see #include "opts.h" #include "flags.h" #include "diagnostic.h" -#include "tm.h" /* For SWITCH_TAKES_ARG, WORD_SWITCH_TAKES_ARG and +#include "tm.h" /* For WORD_SWITCH_TAKES_ARG and TARGET_OPTION_TRANSLATE_TABLE. */ static void prune_options (struct cl_decoded_option **, unsigned int *); @@ -507,13 +507,10 @@ decode_cmdline_option (const char **argv, unsigned int lang_mask, { /* Skip the correct number of arguments for options handled through specs. */ - const char *popt = argv[0] + 1; - int c = *popt; + const char *popt ATTRIBUTE_UNUSED = argv[0] + 1; gcc_assert (result == 1); - if (SWITCH_TAKES_ARG (c) > (popt[1] != 0)) - result += SWITCH_TAKES_ARG (c) - (popt[1] != 0); - else if (WORD_SWITCH_TAKES_ARG (popt)) + if (WORD_SWITCH_TAKES_ARG (popt)) result += WORD_SWITCH_TAKES_ARG (popt); if (result > 1) for (i = 1; i < result; i++) diff --git a/gcc/system.h b/gcc/system.h index ef0c4628b43..65b523604b9 100644 --- a/gcc/system.h +++ b/gcc/system.h @@ -776,7 +776,7 @@ extern void fancy_abort (const char *, int, const char *) ATTRIBUTE_NORETURN; STACK_CHECK_PROBE_INTERVAL STACK_CHECK_PROBE_LOAD \ ORDER_REGS_FOR_LOCAL_ALLOC FUNCTION_OUTGOING_VALUE \ ASM_DECLARE_CONSTANT_NAME MODIFY_TARGET_NAME SWITCHES_NEED_SPACES \ - SWITCH_CURTAILS_COMPILATION + SWITCH_CURTAILS_COMPILATION SWITCH_TAKES_ARG /* Hooks that are no longer used. */ #pragma GCC poison LANG_HOOKS_FUNCTION_MARK LANG_HOOKS_FUNCTION_FREE \ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 6eac260146c..8fc1d6bd2aa 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,160 @@ +2010-11-01 Jason Merrill <jason@redhat.com> + Benjamin Kosnik <bkoz@redhat.com> + + * g++.dg/cpp0x/constexpr-initlist2.C: New. + * g++.dg/cpp0x/constexpr-initlist3.C: New. + + * g++.dg/cpp0x/constexpr-array-ptr.C: New. + * g++.dg/cpp0x/constexpr-array-ptr2.C: New. + * g++.dg/cpp0x/constexpr-array-ptr3.C: New. + * g++.dg/cpp0x/constexpr-array-ptr4.C: New. + * g++.dg/cpp0x/constexpr-array-ptr5.C: New. + * g++.dg/cpp0x/constexpr-array-ptr6.C: New. + * g++.dg/cpp0x/constexpr-array.C: New. + * g++.dg/cpp0x/constexpr-base.C: New. + * g++.dg/cpp0x/constexpr-complex.C: New. + * g++.dg/cpp0x/constexpr-data1.C: New. + * g++.dg/cpp0x/constexpr-data2.C: New. + * g++.dg/cpp0x/constexpr-deref.C: New. + * g++.dg/cpp0x/constexpr-diag1.C: New. + * g++.dg/cpp0x/constexpr-eh-spec.C: New. + * g++.dg/cpp0x/constexpr-ellipsis.C: New. + * g++.dg/cpp0x/constexpr-ellipsis2.C: New. + * g++.dg/cpp0x/constexpr-empty.C: New. + * g++.dg/cpp0x/constexpr-empty2.C: New. + * g++.dg/cpp0x/constexpr-empty3.C: New. + * g++.dg/cpp0x/constexpr-empty4.C: New. + * g++.dg/cpp0x/constexpr-empty5.C: New. + * g++.dg/cpp0x/constexpr-ex1.C: New. + * g++.dg/cpp0x/constexpr-ex2.C: New. + * g++.dg/cpp0x/constexpr-ex3.C: New. + * g++.dg/cpp0x/constexpr-ex4.C: New. + * g++.dg/cpp0x/constexpr-explicit-inst.C: New. + * g++.dg/cpp0x/constexpr-fnptr.C: New. + * g++.dg/cpp0x/constexpr-function1.C: New. + * g++.dg/cpp0x/constexpr-function2.C: New. + * g++.dg/cpp0x/constexpr-function3.C: New. + * g++.dg/cpp0x/constexpr-ice.C: New. + * g++.dg/cpp0x/constexpr-initlist.C: New. + * g++.dg/cpp0x/constexpr-neg1.C: New. + * g++.dg/cpp0x/constexpr-noexcept.C: New. + * g++.dg/cpp0x/constexpr-noexcept2.C: New. + * g++.dg/cpp0x/constexpr-noexcept3.C: New. + * g++.dg/cpp0x/constexpr-noexcept4.C: New. + * g++.dg/cpp0x/constexpr-non-const-arg.C: New. + * g++.dg/cpp0x/constexpr-nonlit.C: New. + * g++.dg/cpp0x/constexpr-nonlit2.C: New. + * g++.dg/cpp0x/constexpr-nullptr.C: New. + * g++.dg/cpp0x/constexpr-object1.C: New. + * g++.dg/cpp0x/constexpr-object2.C: New. + * g++.dg/cpp0x/constexpr-overflow.C: New. + * g++.dg/cpp0x/constexpr-pedantic.C: New. + * g++.dg/cpp0x/constexpr-pos1.C: New. + * g++.dg/cpp0x/constexpr-potential1.C: New. + * g++.dg/cpp0x/constexpr-ptrmem.C: New. + * g++.dg/cpp0x/constexpr-pure.C: New. + * g++.dg/cpp0x/constexpr-static.C: New. + * g++.dg/cpp0x/constexpr-static2.C: New. + * g++.dg/cpp0x/constexpr-static3.C: New. + * g++.dg/cpp0x/constexpr-static4.C: New. + * g++.dg/cpp0x/constexpr-static5.C: New. + * g++.dg/cpp0x/constexpr-static6.C: New. + * g++.dg/cpp0x/constexpr-string.C: New. + * g++.dg/cpp0x/constexpr-switch.C: New. + * g++.dg/cpp0x/constexpr-targ.C: New. + * g++.dg/cpp0x/constexpr-throw.C: New. + * g++.dg/cpp0x/constexpr-typeid.C: New. + * g++.dg/cpp0x/constexpr-union.C: New. + * g++.dg/cpp0x/constexpr-value.C: New. + * g++.dg/cpp0x/constexpr-value2.C: New. + * g++.dg/cpp0x/constexpr-variadic.C: New. + * g++.dg/cpp0x/initlist5.C: Use constexpr. + * g++.dg/cpp0x/static_assert3.C: Add expected error. + * g++.dg/other/fold1.C: Likewise. + * g++.dg/parse/crash36.C: Likewise. + * g++.dg/parse/constant4.C: Adjust expected error. + * g++.dg/template/arg5.C: Likewise. + * g++.dg/template/non-dependent10.C: Likewise. + * g++.dg/template/qualified-id3.C: Likewise. + * g++.dg/warn/overflow-warn-1.C: Likewise. + * g++.dg/warn/overflow-warn-3.C: Likewise. + * g++.dg/warn/overflow-warn-4.C: Likewise. + * g++.old-deja/g++.pt/crash10.C: Likewise. + + * g++.dg/cpp0x/constexpr-ctor2.C: New. + +2010-11-01 Nicola Pero <nicola.pero@meta-innovation.com> + + Implemented format and noreturn attributes for Objective-C methods. + * objc.dg/attributes/method-attribute-2.m: Updated warnings. + * objc.dg/attributes/method-deprecated-1.m: New. + * objc.dg/attributes/method-deprecated-2.m: New. + * objc.dg/attributes/method-deprecated-3.m: New. + * objc.dg/attributes/method-noreturn-1.m: New. + * objc.dg/attributes/method-sentinel-1.m: New. + * objc.dg/attributes/method-format-1.m: New. + * obj-c++.dg/attributes/method-attribute-2.mm: Updated warnings. + * obj-c++.dg/attributes/method-deprecated-1.mm: New. + * obj-c++.dg/attributes/method-deprecated-2.mm: New. + * obj-c++.dg/attributes/method-deprecated-3.mm: New. + * obj-c++.dg/attributes/method-noreturn-1.mm: New. + * obj-c++.dg/attributes/method-sentinel-1.mm: New. + * obj-c++.dg/attributes/method-format-1.mm: New. + +2010-11-01 Nicola Pero <nicola.pero@meta-innovation.com> + + * objc.dg/property/at-property-deprecated-1.m: New. + * obj-c++.dg/property/at-property-deprecated-1.mm: New. + +2010-11-01 Nicola Pero <nicola.pero@meta-innovation.com> + + Implemented Objective-C 2.0 property accessors. + * objc.dg/property/at-property-6.m: Use nonatomic properties to + avoid testing more complex accessors in this testcase which is not + about them. + * objc.dg/property/at-property-7.m: Same change. + * objc.dg/property/at-property-8.m: Same change. + * objc.dg/property/at-property-9.m: Same change. + * objc.dg/property/at-property-10.m: Same change. + * objc.dg/property/at-property-11.m: Same change. + * obj-c++.dg/property/at-property-6.mm: Same change. + * obj-c++.dg/property/at-property-7.mm: Same change. + * obj-c++.dg/property/at-property-8.mm: Same change. + * obj-c++.dg/property/at-property-9.mm: Same change. + * obj-c++.dg/property/at-property-10.mm: Same change. + * obj-c++.dg/property/at-property-11.mm: Same change. + * objc.dg/property/at-property-12.m: New. + * objc.dg/property/at-property-13.m: New. + * obj-c++.dg/property/at-property-12.mm: New. + * obj-c++.dg/property/at-property-13.mm: New. + +2010-11-01 Steven G. Kargl <kargl@gcc.gnu.org> + + PR fortran/46152 + * gfortran.dg/select_type_11.f03: Update dg-error phrase. + * gfortran.dg/allocate_with_typespec_4.f90: New test. + * gfortran.dg/allocate_with_typespec_1.f90: New test. + * gfortran.dg/allocate_with_typespec_2.f: New test. + * gfortran.dg/allocate_with_typespec_3.f90: New test. + * gfortran.dg/allocate_derived_1.f90: Update dg-error phrase. + * gfortran.dg/select_type_1.f03: Update dg-error phrase. + +2010-11-01 H.J. Lu <hongjiu.lu@intel.com> + Nathan Froyd <froydnj@codesourcery.com> + + PR tree-optimization/46259 + * gfortran.dg/pr46259.f: New testcase. + +2010-11-01 Paul Koning <ni1d@arrl.net> + + * gcc.c-torture/compile/20080625-1.c: Skip if pdp11. + * gcc.c-torture/compile/20020604-1.c: Ditto. + * gcc.c-torture/compile/20001226-1.c: Ditto. + * gcc.c-torture/compile/20010327-1.c: Ditto. + * gcc.c-torture/compile/limits-stringlit.c: Ditto. + * gcc.c-torture/compile/pr43191.c: Ditto. + * gcc.c-torture/compile/pr41181.c: Ditto. + 2010-10-31 Richard Henderson <rth@redhat.com> * lib/target-supports.exp @@ -1207,8 +1364,6 @@ 2010-10-07 Nicola Pero <nicola.pero@meta-innovation.com> -2010-10-07 Nicola Pero <nicola.pero@meta-innovation.com> - Merge from 'apple/trunk' branch on FSF servers. 2006-04-26 Fariborz Jahanian <fjahanian@apple.com> @@ -1272,10 +1427,6 @@ PR fortran/45889 * gfortran.dg/alloc_comp_constraint_6.f90: New test. -2010-10-06 Eric Botcazou <ebotcazou@adacore.com> - - * g++.dg/cpp0x/pr45908.C: New test. - 2010-10-06 Nicola Pero <nicola.pero@meta-innovation.com> Merge from 'apple/trunk' branch on FSF servers. @@ -1287,17 +1438,11 @@ 2010-10-06 Eric Botcazou <ebotcazou@adacore.com> - * gnat.dg/opt6.ad[sb]: New test. - -2010-10-05 Nicola Pero <nicola.pero@meta-innovation.com> - - PR objc++/28050 - * obj-c++.dg/syntax-error-10.mm: New. + * g++.dg/cpp0x/pr45908.C: New test. -2010-10-06 Hariharan Sandanagobalane <hariharan@picochip.com> +2010-10-06 Eric Botcazou <ebotcazou@adacore.com> - * gcc.c-torture/execute/cmpsi-2.c : Unsigned comparisons should use - unsigned values. + * gnat.dg/opt6.ad[sb]: New test. 2010-10-06 Nicola Pero <nicola.pero@meta-innovation.com> @@ -1336,6 +1481,16 @@ Radar 4294910 * objc.dg/objc-foreach-1.m: New +2010-10-06 Hariharan Sandanagobalane <hariharan@picochip.com> + + * gcc.c-torture/execute/cmpsi-2.c : Unsigned comparisons should use + unsigned values. + +2010-10-05 Nicola Pero <nicola.pero@meta-innovation.com> + + PR objc++/28050 + * obj-c++.dg/syntax-error-10.mm: New. + 2010-10-05 Nicola Pero <nicola.pero@meta-innovation.com> PR objc++/23707 @@ -1346,11 +1501,6 @@ PR objc++/31126 * obj-c++.dg/syntax-error-8.mm: New. -2010-10-05 Ira Rosen <irar@il.ibm.com> - - PR tree-optimization/45752 - * gcc.dg/vect/pr45752.c: New test. - 2010-10-05 Nicola Pero <nicola.pero@meta-innovation.com> Merge from 'apple/trunk' branch on FSF servers. @@ -1380,6 +1530,11 @@ Radar 4185810 * obj-c++.dg/syntax-error-[1-2].mm: New. +2010-10-05 Ira Rosen <irar@il.ibm.com> + + PR tree-optimization/45752 + * gcc.dg/vect/pr45752.c: New test. + 2010-10-05 Richard Guenther <rguenther@suse.de> * gcc.dg/tree-prof/val-prof-1.c: Adjust. @@ -1416,8 +1571,6 @@ PR debug/45849 * gcc.dg/debug/pr45849.c: New test. -2010-10-04 Jakub Jelinek <jakub@redhat.com> - PR middle-end/45876 * gcc.c-torture/compile/pr45876.c: New test. @@ -2712,12 +2865,6 @@ * gfortran.dg/iall_iany_iparity_1.f90: New. * gfortran.dg/iall_iany_iparity_2.f90: New. -2010-09-06 Jakub Jelinek <jakub@redhat.com> - - PR testsuite/45543 - * g++.dg/debug/dwarf2/typedef1.C: Expect just one - DW_TAG_enumeration_type DIE. - 2010-09-06 Jason Merrill <jason@redhat.com> * g++.dg/cpp0x/initlist42.C: New. @@ -8013,19 +8160,6 @@ * gcc.dg/ordered-comparison-3.c: New test. * gcc.dg/ordered-comparison-4.c: New test. -2009-12-03 Benjamin Kosnik <bkoz@redhat.com> - Gabriel Dos Reis <gdr@cs.tamu.edu> - - * constexpr-data1.C: New. - * constexpr-data2.C: New. - * constexpr-ex1.C: New. - * constexpr-ex2.C: New. - * constexpr-function1.C: New. - * constexpr-function2.C: New. - * constexpr-function3.C: New. - * constexpr-object1.C: New. - * constexpr-object2.C: New. - 2010-05-06 Mike Stump <mikestump@comcast.net> PR objc/35165 diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-ex1.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-ex1.C index f2b53846ecb..c7757f47598 100644 --- a/gcc/testsuite/g++.dg/cpp0x/constexpr-ex1.C +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-ex1.C @@ -55,7 +55,7 @@ constexpr complex I(0, 1); // OK -- literal complex // 2 invoked with non-const args -double x5 = 1.0; +double x5 = 1.0; // { dg-message "not declared .constexpr" } constexpr complex unit(x5, 0); // { dg-error "x5|argument" } error: x5 non-constant const complex one(x5, 0); // OK, ‘‘ordinary const’’ -- dynamic // initialization diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-ex3.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-ex3.C index 597603c39a4..08552cd7de7 100644 --- a/gcc/testsuite/g++.dg/cpp0x/constexpr-ex3.C +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-ex3.C @@ -15,7 +15,7 @@ struct B constexpr B(T _t): t(_t) { } }; -B<int> b(1); +B<int> b(1); // { dg-message "not declared .constexpr" } SA(b.t==1); // { dg-error "non-constant condition|'b'" } constexpr B<int> b2(1); SA(b2.t==1); diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-function2.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-function2.C index 5e0c101b2ba..a902e0e226c 100644 --- a/gcc/testsuite/g++.dg/cpp0x/constexpr-function2.C +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-function2.C @@ -17,7 +17,7 @@ inline constexpr double squared(double x) { return x * x; } constexpr int squarei(int x) { return x * x; } -extern const int side; +extern const int side; // { dg-message "not initialized with a constant expression" } constexpr int area = squarei(side); // { dg-error "side|argument" } // error: squarei(side) is not a constant expression diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-neg1.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-neg1.C index ce01f8b5d44..8294afa9837 100644 --- a/gcc/testsuite/g++.dg/cpp0x/constexpr-neg1.C +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-neg1.C @@ -18,7 +18,7 @@ constexpr pixel::pixel(int a) // error: square not defined, so small(2) not constant (5.19), so constexpr // not satisfied -constexpr pixel small(2); // { dg-error "" } +constexpr pixel small(2); // { dg-message "in constexpr expansion" } // error: not for parameters int next(constexpr int x) { // { dg-error "parameter" } diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-non-const-arg.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-non-const-arg.C index 2c53595833e..7637c0a05bc 100644 --- a/gcc/testsuite/g++.dg/cpp0x/constexpr-non-const-arg.C +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-non-const-arg.C @@ -7,7 +7,7 @@ struct B { int i; }; -int global; // not constant +int global; // { dg-message "not const" } struct D : B { constexpr D() : B(global) { } // { dg-error "global|argument" } diff --git a/gcc/testsuite/g++.dg/cpp0x/constexpr-throw.C b/gcc/testsuite/g++.dg/cpp0x/constexpr-throw.C index 345b24097b1..f1ef9dc7d0d 100644 --- a/gcc/testsuite/g++.dg/cpp0x/constexpr-throw.C +++ b/gcc/testsuite/g++.dg/cpp0x/constexpr-throw.C @@ -4,5 +4,5 @@ constexpr int may_throw(bool decide) { return decide ? 42 : throw -1; // { dg-error "throw" } } -constexpr int x = may_throw(false); // { dg-error "may_throw" } +constexpr int x = may_throw(false); // { dg-message "may_throw" } constexpr int y = may_throw(true); diff --git a/gcc/testsuite/g++.dg/parse/constant4.C b/gcc/testsuite/g++.dg/parse/constant4.C index b2c112ce714..4d9814fb485 100644 --- a/gcc/testsuite/g++.dg/parse/constant4.C +++ b/gcc/testsuite/g++.dg/parse/constant4.C @@ -16,7 +16,7 @@ void Foo () Y<I> i; - static const unsigned J = X<T>::J; + static const unsigned J = X<T>::J; // { dg-message "not initialized with a constant expression" } Y<J> j; // { dg-error "constant" "" } } diff --git a/gcc/testsuite/g++.dg/template/qualified-id3.C b/gcc/testsuite/g++.dg/template/qualified-id3.C index 1fc1cc32050..bbfb51e4ce1 100644 --- a/gcc/testsuite/g++.dg/template/qualified-id3.C +++ b/gcc/testsuite/g++.dg/template/qualified-id3.C @@ -2,7 +2,7 @@ template <const int N> struct A { }; template <class T> struct B { - static const int c; + static const int c; // { dg-message "not initialized with a constant expression" } typedef A<B<T>::c> C; // { dg-error "constant expression" } }; template <class T> const int B<T>::c = sizeof (T); diff --git a/gcc/testsuite/gcc.c-torture/compile/20001226-1.c b/gcc/testsuite/gcc.c-torture/compile/20001226-1.c index 7cf963f0ac7..8c93baccda9 100644 --- a/gcc/testsuite/gcc.c-torture/compile/20001226-1.c +++ b/gcc/testsuite/gcc.c-torture/compile/20001226-1.c @@ -3,6 +3,7 @@ /* { dg-do assemble } */ /* { dg-xfail-if "function larger than 64K" { m6811-*-* } { "*" } { "" } } */ /* { dg-skip-if "too much code for avr" { "avr-*-*" } { "*" } { "" } } */ +/* { dg-skip-if "too much code for pdp11" { "pdp11-*-*" } { "*" } { "" } } */ /* { dg-xfail-if "jump beyond 128K not supported" { xtensa*-*-* } { "-O0" } { "" } } */ /* { dg-xfail-if "PR36698" { spu-*-* } { "-O0" } { "" } } */ /* { dg-skip-if "" { m32c-*-* } { "*" } { "" } } */ diff --git a/gcc/testsuite/gcc.c-torture/compile/20010327-1.c b/gcc/testsuite/gcc.c-torture/compile/20010327-1.c index f20e3a3e2dc..ce68f78df1d 100644 --- a/gcc/testsuite/gcc.c-torture/compile/20010327-1.c +++ b/gcc/testsuite/gcc.c-torture/compile/20010327-1.c @@ -1,5 +1,6 @@ /* { dg-skip-if "non-SI pointers" { m32c-*-* } { "*" } { "" } } */ /* { dg-skip-if "HI mode pointer for avr" { "avr-*-*" } { "*" } { "" } } */ +/* { dg-skip-if "HI mode pointer for pdp11" { "pdp11-*-*" } { "*" } { "" } } */ /* { dg-skip-if "non-SI pointers for w64" { "x86_64-*-mingw*" } { "*" } { "" } } */ /* This testcase tests whether GCC can produce static initialized data diff --git a/gcc/testsuite/gcc.c-torture/compile/20020604-1.c b/gcc/testsuite/gcc.c-torture/compile/20020604-1.c index 17b9b2165ba..8b958040e3c 100644 --- a/gcc/testsuite/gcc.c-torture/compile/20020604-1.c +++ b/gcc/testsuite/gcc.c-torture/compile/20020604-1.c @@ -1,6 +1,6 @@ /* { dg-do assemble } */ /* { dg-xfail-if "The array is too big" { "m6811-*-* m6812-*-*" } { "*" } { "" } } */ -/* { dg-skip-if "The array is too big" { "avr-*-*" } { "*" } { "" } } */ +/* { dg-skip-if "The array is too big" { "avr-*-*" "pdp11-*-*" } { "*" } { "" } } */ /* { dg-xfail-if "The array too big" { "h8300-*-*" } { "-mno-h" "-mn" } { "" } } */ /* { dg-skip-if "" { m32c-*-* } { } { } } */ diff --git a/gcc/testsuite/gcc.c-torture/compile/20080625-1.c b/gcc/testsuite/gcc.c-torture/compile/20080625-1.c index e656cd4f58e..16def2c8a37 100644 --- a/gcc/testsuite/gcc.c-torture/compile/20080625-1.c +++ b/gcc/testsuite/gcc.c-torture/compile/20080625-1.c @@ -1,4 +1,4 @@ -/* { dg-skip-if "too much data" { "avr-*-*" "m32c-*-*" } { "*" } { "" } } */ +/* { dg-skip-if "too much data" { "avr-*-*" "m32c-*-*" "pdp11-*-*" } { "*" } { "" } } */ struct peakbufStruct { unsigned int lnum [5000]; int lscan [5000][4000]; diff --git a/gcc/testsuite/gcc.c-torture/compile/limits-stringlit.c b/gcc/testsuite/gcc.c-torture/compile/limits-stringlit.c index 75b824d1987..41fa2f14022 100644 --- a/gcc/testsuite/gcc.c-torture/compile/limits-stringlit.c +++ b/gcc/testsuite/gcc.c-torture/compile/limits-stringlit.c @@ -1,4 +1,4 @@ -/* { dg-skip-if "Array too big" { avr-*-* picochip-*-* m32c-*-* } { "*" } { "" } } */ +/* { dg-skip-if "Array too big" { avr-*-* picochip-*-* m32c-*-* pdp11-*-* } { "*" } { "" } } */ #define STR2 "012345678901234567890123456789012345678901234567890123456789\ 0123456789012345678901234567890123456789" diff --git a/gcc/testsuite/gcc.c-torture/compile/pr41181.c b/gcc/testsuite/gcc.c-torture/compile/pr41181.c index 9e42f420939..5fafb020ea5 100644 --- a/gcc/testsuite/gcc.c-torture/compile/pr41181.c +++ b/gcc/testsuite/gcc.c-torture/compile/pr41181.c @@ -1,4 +1,4 @@ -/* { dg-skip-if "The array is too big" { "avr-*-*" } { "*" } { "" } } */ +/* { dg-skip-if "The array is too big" { "avr-*-*" "pdp11-*-*" } { "*" } { "" } } */ char paths[1024]; static void x264_slicetype_path(char (*best_paths)[250], int n, int length) { diff --git a/gcc/testsuite/gcc.c-torture/compile/pr43191.c b/gcc/testsuite/gcc.c-torture/compile/pr43191.c index 9c8d1444cf9..f4ec0b4770d 100644 --- a/gcc/testsuite/gcc.c-torture/compile/pr43191.c +++ b/gcc/testsuite/gcc.c-torture/compile/pr43191.c @@ -1,3 +1,4 @@ +/* { dg-skip-if "Ints are 16 bits" { "pdp11-*-*" } { "*" } { "" } } */ struct S0 { }; diff --git a/gcc/testsuite/gfortran.dg/allocate_derived_1.f90 b/gcc/testsuite/gfortran.dg/allocate_derived_1.f90 index b9f6d5580a0..d2c65ffa38b 100644 --- a/gcc/testsuite/gfortran.dg/allocate_derived_1.f90 +++ b/gcc/testsuite/gfortran.dg/allocate_derived_1.f90 @@ -32,7 +32,7 @@ allocate(t1 :: x(2)) allocate(t2 :: x(3)) allocate(t3 :: x(4)) - allocate(tx :: x(5)) ! { dg-error "is not an accessible derived type" } + allocate(tx :: x(5)) ! { dg-error "Error in type-spec at" } allocate(u0 :: x(6)) ! { dg-error "may not be ABSTRACT" } allocate(v1 :: x(7)) ! { dg-error "is type incompatible with typespec" } diff --git a/gcc/testsuite/gfortran.dg/allocate_with_typespec_1.f90 b/gcc/testsuite/gfortran.dg/allocate_with_typespec_1.f90 new file mode 100644 index 00000000000..945a80e4afd --- /dev/null +++ b/gcc/testsuite/gfortran.dg/allocate_with_typespec_1.f90 @@ -0,0 +1,121 @@ +! { dg-do compile } +! +! Allocation of arrays with a type-spec specification with implicit none. +! +subroutine implicit_none_test1 + + implicit none + + real, allocatable :: x(:) + real(4), allocatable :: x4(:) + real(8), allocatable :: x8(:) + double precision, allocatable :: d1(:) + doubleprecision, allocatable :: d2(:) + character, allocatable :: c1(:) + character(len=4), allocatable :: c2(:) + + type a + integer mytype + end type a + + type(a), allocatable :: b(:) + + allocate(real :: x(1)) + allocate(real(4) :: x4(1)) + allocate(real(8) :: x8(1)) + allocate(double precision :: d1(1)) + allocate(doubleprecision :: d2(1)) + allocate(character :: c1(1)) + allocate(character(len=4) :: c2(1)) + allocate(a :: b(1)) + +end subroutine implicit_none_test1 +! +! Allocation of a scalar with a type-spec specification with implicit none +! +subroutine implicit_none_test2 + + implicit none + + real, allocatable :: x + real(4), allocatable :: x4 + real(8), allocatable :: x8 + double precision, allocatable :: d1 + doubleprecision, allocatable :: d2 + character, allocatable :: c1 + character(len=4), allocatable :: c2 + + type a + integer mytype + end type a + + type(a), allocatable :: b + + allocate(real :: x) + allocate(real(4) :: x4) + allocate(real(8) :: x8) + allocate(double precision :: d1) + allocate(doubleprecision :: d2) + allocate(character :: c1) + allocate(character(len=4) :: c2) + allocate(a :: b) + +end subroutine implicit_none_test2 +! +! Allocation of arrays with a type-spec specification with implicit none. +! +subroutine implicit_test3 + + real, allocatable :: x(:) + real(4), allocatable :: x4(:) + real(8), allocatable :: x8(:) + double precision, allocatable :: d1(:) + doubleprecision, allocatable :: d2(:) + character, allocatable :: c1(:) + character(len=4), allocatable :: c2(:) + + type a + integer mytype + end type a + + type(a), allocatable :: b(:) + + allocate(real :: x(1)) + allocate(real(4) :: x4(1)) + allocate(real(8) :: x8(1)) + allocate(double precision :: d1(1)) + allocate(doubleprecision :: d2(1)) + allocate(character :: c1(1)) + allocate(character(len=4) :: c2(1)) + allocate(a :: b(1)) + +end subroutine implicit_test3 +! +! Allocation of a scalar with a type-spec specification without implicit none +! +subroutine implicit_test4 + + real, allocatable :: x + real(4), allocatable :: x4 + real(8), allocatable :: x8 + double precision, allocatable :: d1 + doubleprecision, allocatable :: d2 + character, allocatable :: c1 + character(len=4), allocatable :: c2 + + type a + integer mytype + end type a + + type(a), allocatable :: b + + allocate(real :: x) + allocate(real(4) :: x4) + allocate(real(8) :: x8) + allocate(double precision :: d1) + allocate(doubleprecision :: d2) + allocate(character :: c1) + allocate(character(len=4) :: c2) + allocate(a :: b) + +end subroutine implicit_test4 diff --git a/gcc/testsuite/gfortran.dg/allocate_with_typespec_2.f b/gcc/testsuite/gfortran.dg/allocate_with_typespec_2.f new file mode 100644 index 00000000000..51d1afad08c --- /dev/null +++ b/gcc/testsuite/gfortran.dg/allocate_with_typespec_2.f @@ -0,0 +1,121 @@ +C { dg-do compile } +C +C Allocation of arrays with a type-spec specification with implicit none. +C + subroutine implicit_none_test1 + + implicit none + + real, allocatable :: x(:) + real(4), allocatable :: x4(:) + real(8), allocatable :: x8(:) + double precision, allocatable :: d1(:) + doubleprecision, allocatable :: d2(:) + character, allocatable :: c1(:) + character(len=4), allocatable :: c2(:) + + type a + integer mytype + end type a + + type(a), allocatable :: b(:) + + allocate(real :: x(1)) + allocate(real(4) :: x4(1)) + allocate(real(8) :: x8(1)) + allocate(double precision :: d1(1)) + allocate(doubleprecision :: d2(1)) + allocate(character :: c1(1)) + allocate(character(len=4) :: c2(1)) + allocate(a :: b(1)) + + end +C +C Allocation of a scalar with a type-spec specification with implicit none +C + subroutine implicit_none_test2 + + implicit none + + real, allocatable :: x + real(4), allocatable :: x4 + real(8), allocatable :: x8 + double precision, allocatable :: d1 + doubleprecision, allocatable :: d2 + character, allocatable :: c1 + character(len=4), allocatable :: c2 + + type a + integer mytype + end type a + + type(a), allocatable :: b + + allocate(real :: x) + allocate(real(4) :: x4) + allocate(real(8) :: x8) + allocate(double precision :: d1) + allocate(doubleprecision :: d2) + allocate(character :: c1) + allocate(character(len=4) :: c2) + allocate(a :: b) + + end subroutine implicit_none_test2 +C +C Allocation of arrays with a type-spec specification with implicit none. +C + subroutine implicit_test3 + + real, allocatable :: x(:) + real(4), allocatable :: x4(:) + real(8), allocatable :: x8(:) + double precision, allocatable :: d1(:) + doubleprecision, allocatable :: d2(:) + character, allocatable :: c1(:) + character(len=4), allocatable :: c2(:) + + type a + integer mytype + end type a + + type(a), allocatable :: b(:) + + allocate(real :: x(1)) + allocate(real(4) :: x4(1)) + allocate(real(8) :: x8(1)) + allocate(double precision :: d1(1)) + allocate(doubleprecision :: d2(1)) + allocate(character :: c1(1)) + allocate(character(len=4) :: c2(1)) + allocate(a :: b(1)) + + end +C +C Allocation of a scalar with a type-spec specification without implicit none +C + subroutine implicit_test4 + + real, allocatable :: x + real(4), allocatable :: x4 + real(8), allocatable :: x8 + double precision, allocatable :: d1 + doubleprecision, allocatable :: d2 + character, allocatable :: c1 + character(len=4), allocatable :: c2 + + type a + integer mytype + end type a + + type(a), allocatable :: b + + allocate(real :: x) + allocate(real(4) :: x4) + allocate(real(8) :: x8) + allocate(double precision :: d1) + allocate(doubleprecision :: d2) + allocate(character :: c1) + allocate(character(len=4) :: c2) + allocate(a :: b) + + end diff --git a/gcc/testsuite/gfortran.dg/allocate_with_typespec_3.f90 b/gcc/testsuite/gfortran.dg/allocate_with_typespec_3.f90 new file mode 100644 index 00000000000..57f8a110e8f --- /dev/null +++ b/gcc/testsuite/gfortran.dg/allocate_with_typespec_3.f90 @@ -0,0 +1,107 @@ +! { dg-do compile } +! +! Allocation of arrays with a type-spec specification with implicit none. +! +subroutine implicit_none_test1 + + implicit none + + real, allocatable :: x(:) + real(4), allocatable :: x4(:) + real(8), allocatable :: x8(:) + double precision, allocatable :: d1(:) + doubleprecision, allocatable :: d2(:) + character, allocatable :: c1(:) + + type a + integer mytype + end type a + + type(a), allocatable :: b(:) + + allocate(complex :: x(1)) ! { dg-error "is type incompatible" } + allocate(real(8) :: x4(1)) ! { dg-error "differs from the kind type parameter" } + allocate(real(4) :: x8(1)) ! { dg-error "differs from the kind type parameter" } + allocate(double :: d1(1)) ! { dg-error "Error in type-spec at" } + allocate(character(:) :: c1(1)) ! { dg-error "Syntax error in CHARACTER declaration" } + allocate(real :: b(1)) ! { dg-error "is type incompatible" } + +end subroutine implicit_none_test1 +! +! Allocation of a scalar with a type-spec specification with implicit none +! +subroutine implicit_none_test2 + + implicit none + + real, allocatable :: x + real(4), allocatable :: x4 + real(8), allocatable :: x8 + double precision, allocatable :: d1 + character, allocatable :: c1 + + type a + integer mytype + end type a + + type(a), allocatable :: b + + allocate(complex :: x) ! { dg-error "is type incompatible" } + allocate(real(8) :: x4) ! { dg-error "differs from the kind type parameter" } + allocate(real(4) :: x8) ! { dg-error "differs from the kind type parameter" } + allocate(double :: d1) ! { dg-error "Error in type-spec at" } + allocate(character(:) :: c1) ! { dg-error "Syntax error in CHARACTER declaration" } + allocate(real :: b) ! { dg-error "is type incompatible" } + +end subroutine implicit_none_test2 +! +! Allocation of arrays with a type-spec specification with implicit none. +! +subroutine implicit_test3 + + real, allocatable :: x(:) + real(4), allocatable :: x4(:) + real(8), allocatable :: x8(:) + double precision, allocatable :: d1(:) + doubleprecision, allocatable :: d2(:) + character, allocatable :: c1(:) + + type a + integer mytype + end type a + + type(a), allocatable :: b(:) + + allocate(complex :: x(1)) ! { dg-error "is type incompatible" } + allocate(real(8) :: x4(1)) ! { dg-error "differs from the kind type parameter" } + allocate(real(4) :: x8(1)) ! { dg-error "differs from the kind type parameter" } + allocate(double :: d1(1)) ! { dg-error "Error in type-spec" } + allocate(character(:) :: c1(1)) ! { dg-error "Syntax error in CHARACTER declaration" } + allocate(real :: b(1)) ! { dg-error "is type incompatible" } + +end subroutine implicit_test3 +! +! Allocation of a scalar with a type-spec specification without implicit none +! +subroutine implicit_test4 + + real, allocatable :: x + real(4), allocatable :: x4 + real(8), allocatable :: x8 + double precision, allocatable :: d1 + character, allocatable :: c1 + + type a + integer mytype + end type a + + type(a), allocatable :: b + + allocate(complex :: x) ! { dg-error "is type incompatible" } + allocate(real(8) :: x4) ! { dg-error "differs from the kind type parameter" } + allocate(real(4) :: x8) ! { dg-error "differs from the kind type parameter" } + allocate(double :: d1) ! { dg-error "Error in type-spec at" } + allocate(character(:) :: c1) ! { dg-error "Syntax error in CHARACTER declaration" } + allocate(real :: b) ! { dg-error "is type incompatible" } + +end subroutine implicit_test4 diff --git a/gcc/testsuite/gfortran.dg/allocate_with_typespec_4.f90 b/gcc/testsuite/gfortran.dg/allocate_with_typespec_4.f90 new file mode 100644 index 00000000000..327f28dcdc9 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/allocate_with_typespec_4.f90 @@ -0,0 +1,28 @@ +! { dg-do compile } +! { dg-options "-w" } +subroutine not_an_f03_intrinsic + + implicit none + + byte, allocatable :: x, y(:) + real*8, allocatable :: x8, y8(:) + double complex :: z + + type real_type + integer mytype + end type real_type + + type(real_type), allocatable :: b, c(:) + + allocate(byte :: x) ! { dg-error "Error in type-spec at" } + allocate(byte :: y(1)) ! { dg-error "Error in type-spec at" } + + allocate(real*8 :: x) ! { dg-error "Invalid type-spec at" } + allocate(real*8 :: y(1)) ! { dg-error "Invalid type-spec at" } + allocate(real*4 :: x8) ! { dg-error "Invalid type-spec at" } + allocate(real*4 :: y8(1)) ! { dg-error "Invalid type-spec at" } + allocate(double complex :: d1) ! { dg-error "not a nonprocedure pointer or an allocatable" } + allocate(real_type :: b) + allocate(real_type :: c(1)) + +end subroutine not_an_f03_intrinsic diff --git a/gcc/testsuite/gfortran.dg/pr46259.f b/gcc/testsuite/gfortran.dg/pr46259.f new file mode 100644 index 00000000000..d74e549a248 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr46259.f @@ -0,0 +1,19 @@ +! PR tree-optimization/46259 +! { dg-do compile } +! { dg-options "-O3" } + SUBROUTINE RDSTFR(FRGMNT,IFRAG,PROVEC,FOCKMA, + * MXBF,MXMO,MXMO2,NTMOF) + PARAMETER (MXPT=100, MXFRG=50, MXFGPT=MXPT*MXFRG) + CHARACTER*8 WORD,MNAME,PNAME,RNAME + COMMON /FRGSTD/ CORD(3,MXPT),PCORD(3,MXPT),POLT(9,MXPT), + * INLPR(4*MXPT),IKFR(MXPT),IKLR(MXPT), + * MNAME(MXPT),PNAME(MXPT),RNAME(MXPT) + DO 10 I=1,MXPT + INLPR(4*(I-1)+1)=0 + INLPR(4*(I-1)+2)=0 + INLPR(4*(I-1)+3)=0 + INLPR(4*(I-1)+4)=0 + IKLR(I)=0 + RNAME(I)=' ' + 10 CONTINUE + END diff --git a/gcc/testsuite/gfortran.dg/select_type_1.f03 b/gcc/testsuite/gfortran.dg/select_type_1.f03 index 840dde922f2..af0db3c84e3 100644 --- a/gcc/testsuite/gfortran.dg/select_type_1.f03 +++ b/gcc/testsuite/gfortran.dg/select_type_1.f03 @@ -45,7 +45,7 @@ print *,"a is TYPE(ts)" type is (t3) ! { dg-error "must be an extension of" } print *,"a is TYPE(t3)" - type is (t4) ! { dg-error "is not an accessible derived type" } + type is (t4) ! { dg-error "error in TYPE IS specification" } print *,"a is TYPE(t3)" class is (t1) print *,"a is CLASS(t1)" diff --git a/gcc/testsuite/gfortran.dg/select_type_11.f03 b/gcc/testsuite/gfortran.dg/select_type_11.f03 index 54501d6ab1e..c3bd9bac8d5 100644 --- a/gcc/testsuite/gfortran.dg/select_type_11.f03 +++ b/gcc/testsuite/gfortran.dg/select_type_11.f03 @@ -19,7 +19,7 @@ contains class(vector_class), intent(in) :: v select type (v) - class is (bad_id) ! { dg-error "is not an accessible derived type" } + class is (bad_id) ! { dg-error " error in CLASS IS specification" } this%elements(:) = v%elements(:) ! { dg-error "is not a member of" } end select diff --git a/gcc/testsuite/obj-c++.dg/attributes/method-attribute-2.mm b/gcc/testsuite/obj-c++.dg/attributes/method-attribute-2.mm index f9a184cdf41..4a56b3aa8f6 100644 --- a/gcc/testsuite/obj-c++.dg/attributes/method-attribute-2.mm +++ b/gcc/testsuite/obj-c++.dg/attributes/method-attribute-2.mm @@ -14,7 +14,7 @@ @end @implementation obj -- (int) depmth __attribute__((deprecated)) { return var; } +- (int) depmth __attribute__((deprecated)) { return var; } /* { dg-warning "method attributes can not be specified in @implementation context" } */ - (int) depmtharg:(int) iarg { return var + iarg ; } - (int) unusedarg:(int) __attribute__((unused)) uarg { return var; } - (int) depunusedarg:(int) __attribute__((unused)) uarg { return var; } diff --git a/gcc/testsuite/obj-c++.dg/attributes/method-deprecated-1.mm b/gcc/testsuite/obj-c++.dg/attributes/method-deprecated-1.mm new file mode 100644 index 00000000000..8343856a5c6 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/attributes/method-deprecated-1.mm @@ -0,0 +1,33 @@ +/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, October 2010. */ +/* { dg-do compile } */ + +#include <objc/objc.h> + +@interface MyClass +{ + Class isa; +} ++ (int) method; +- (int) method; ++ (int) deprecatedClassMethod __attribute__((deprecated)); +- (int) deprecatedInstanceMethod __attribute__((deprecated)); +@end + +/* Test that deprecation warnings are produced, but not if the + receiver is of type 'id'. */ +void foo (void) +{ + Class c; + id object; + MyClass *another_object; + + [c method]; + [object method]; + [c deprecatedClassMethod]; + [object deprecatedInstanceMethod]; + + [object method]; + [another_object method]; + [MyClass deprecatedClassMethod]; /* { dg-warning "is deprecated" } */ + [another_object deprecatedInstanceMethod]; /* { dg-warning "is deprecated" } */ +} diff --git a/gcc/testsuite/obj-c++.dg/attributes/method-deprecated-2.mm b/gcc/testsuite/obj-c++.dg/attributes/method-deprecated-2.mm new file mode 100644 index 00000000000..1e5d87f3e63 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/attributes/method-deprecated-2.mm @@ -0,0 +1,23 @@ +/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, October 2010. */ +/* { dg-do compile } */ + +#include <objc/objc.h> + +@interface MyClass +{ + Class isa; +} ++ (int) deprecatedClassMethod: (id)firstObject, ... __attribute__((sentinel)) __attribute__((deprecated)); +- (int) deprecatedInstanceMethod: (id)firstobject, ... __attribute__((sentinel)) __attribute__((deprecated)); +@end + +/* Test that deprecation warnings are produced even if the method is + also marked with another attribute too (this is to test the + processing of multiple attributes). */ +void foo (void) +{ + MyClass *object = nil; + + [MyClass deprecatedClassMethod: object, nil]; /* { dg-warning "is deprecated" } */ + [object deprecatedInstanceMethod: object, nil]; /* { dg-warning "is deprecated" } */ +} diff --git a/gcc/testsuite/obj-c++.dg/attributes/method-deprecated-3.mm b/gcc/testsuite/obj-c++.dg/attributes/method-deprecated-3.mm new file mode 100644 index 00000000000..5c715a20b68 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/attributes/method-deprecated-3.mm @@ -0,0 +1,21 @@ +/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, October 2010. */ +/* { dg-do compile } */ + +#include <objc/objc.h> + +/* Test that __attribute__ ((__deprecated__)) works as well as __attribute__ ((deprecated)). */ +@interface MyClass +{ + Class isa; +} ++ (int) deprecatedClassMethod: (id)firstObject, ... __attribute__((__deprecated__)); +- (int) deprecatedInstanceMethod: (id)firstobject, ... __attribute__((__deprecated__)); +@end + +void foo (void) +{ + MyClass *object = nil; + + [MyClass deprecatedClassMethod: object, nil]; /* { dg-warning "is deprecated" } */ + [object deprecatedInstanceMethod: object, nil]; /* { dg-warning "is deprecated" } */ +} diff --git a/gcc/testsuite/obj-c++.dg/attributes/method-format-1.mm b/gcc/testsuite/obj-c++.dg/attributes/method-format-1.mm new file mode 100644 index 00000000000..0a078ff0a3a --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/attributes/method-format-1.mm @@ -0,0 +1,43 @@ +/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, October 2010. */ +/* { dg-do compile } */ +/* { dg-options "-Wall" } */ + +#include <objc/objc.h> +#include <stdlib.h> + +@interface LogObject +{ + Class isa; +} ++ (void) log: (int)level message: (const char *) my_format, ... __attribute__ ((format (printf, 2, 3))); +- (void) log: (int)level message: (const char *) my_format, ... __attribute__ ((format (printf, 2, 3))); + ++ (void) debug: (const char *) my_format, ... __attribute__ ((format (printf, 1, 2))); +- (void) debug: (const char *) my_format, ... __attribute__ ((format (printf, 1, 2))); + +/* Just make sure a missing or invalid attribute won't crash the compiler. */ +- (void) log2: (int)level message: (const char *) my_format, ... __attribute__ ((format (printf, 2))); /* { dg-error "wrong" } */ ++ (void) debug2: (const char *) my_format, ... __attribute__ ((format (printf))); /* { dg-error "wrong" } */ +- (void) debug2: (const char *) my_format, ... __attribute__ ((format (printf))); /* { dg-error "wrong" } */ ++ (void) alert: (const char *) my_format __attribute__ ((format (printf, 1, 2))); /* { dg-error "args to be formatted is not ..." } */ +- (void) alert: (const char *) my_format __attribute__ ((format (printf, 1, 2))); /* { dg-error "args to be formatted is not ..." } */ +@end + +void test (LogObject *object) +{ + [object log: 2 message: "attribute only applies to variadic functions"]; + [object log: 2 message: "attribute %s only applies to variadic functions", "'format'"]; + [object log: 2 message: "attribute %s only applies to variadic functions"]; /* { dg-warning "too few arguments for format" } */ + + [object debug: "attribute only applies to variadic functions"]; + [object debug: "attribute %s only applies to variadic functions", "'format'"]; + [object debug: "attribute %s only applies to variadic functions"]; /* { dg-warning "too few arguments for format" } */ + + [LogObject log: 2 message: "attribute only applies to variadic functions"]; + [LogObject log: 2 message: "attribute %s only applies to variadic functions", "'format'"]; + [LogObject log: 2 message: "attribute %s only applies to variadic functions"]; /* { dg-warning "too few arguments for format" } */ + + [LogObject debug: "attribute only applies to variadic functions"]; + [LogObject debug: "attribute %s only applies to variadic functions", "'format'"]; + [LogObject debug: "attribute %s only applies to variadic functions"]; /* { dg-warning "too few arguments for format" } */ +} diff --git a/gcc/testsuite/obj-c++.dg/attributes/method-noreturn-1.mm b/gcc/testsuite/obj-c++.dg/attributes/method-noreturn-1.mm new file mode 100644 index 00000000000..af051a61d34 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/attributes/method-noreturn-1.mm @@ -0,0 +1,34 @@ +/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, October 2010. */ +/* { dg-do compile } */ + +#include <objc/objc.h> +#include <stdlib.h> + +@interface MyClass +{ + Class isa; +} ++ (id) method1 __attribute__ ((noreturn)); +- (id) method2 __attribute__ ((noreturn)); ++ (id) method3 __attribute__ ((noreturn)); +- (id) method4 __attribute__ ((noreturn)); +@end + +@implementation MyClass ++ (id) method1 +{ + return self; /* { dg-warning "function declared .noreturn. has a .return. statement" } */ +} /* { dg-warning ".noreturn. function does return" } */ +- (id) method2 +{ + return self; /* { dg-warning "function declared .noreturn. has a .return. statement" } */ +} /* { dg-warning ".noreturn. function does return" } */ ++ (id) method3 +{ + abort (); +} +- (id) method4 +{ + abort (); +} +@end diff --git a/gcc/testsuite/obj-c++.dg/attributes/method-sentinel-1.mm b/gcc/testsuite/obj-c++.dg/attributes/method-sentinel-1.mm new file mode 100644 index 00000000000..ecaa36c21f8 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/attributes/method-sentinel-1.mm @@ -0,0 +1,34 @@ +/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, October 2010. */ +/* { dg-do compile } */ +/* { dg-options "-Wall" } */ + +#include <objc/objc.h> +#include <stdlib.h> + +@interface NSArray +{ + Class isa; +} ++ (id) arrayWithObject: (id)object __attribute__ ((sentinel)); /* { dg-warning "attribute only applies to variadic functions" } */ ++ (id) arrayWithObjects: (id)firstObject, ... __attribute__ ((sentinel)); + +- (id) initWithObject: (id)object __attribute__ ((sentinel)); /* { dg-warning "attribute only applies to variadic functions" } */ +- (id) initWithObjects: (id)firstObject, ... __attribute__ ((sentinel)); +@end + +void test (id object) +{ + NSArray *array; + + array = [NSArray arrayWithObject: object]; + array = [NSArray arrayWithObjects: object, nil]; + array = [NSArray arrayWithObjects: object, object, nil]; + array = [NSArray arrayWithObjects: object]; /* { dg-warning "not enough variable arguments" } */ + array = [NSArray arrayWithObjects: object, object]; /* { dg-warning "missing sentinel" } */ + + [array initWithObject: object]; + [array initWithObjects: object, nil]; + [array initWithObjects: object, object, nil]; + [array initWithObjects: object]; /* { dg-warning "not enough variable arguments" } */ + [array initWithObjects: object, object]; /* { dg-warning "missing sentinel" } */ +} diff --git a/gcc/testsuite/obj-c++.dg/property/at-property-10.mm b/gcc/testsuite/obj-c++.dg/property/at-property-10.mm index f130292bb0f..83494ec3bcc 100644 --- a/gcc/testsuite/obj-c++.dg/property/at-property-10.mm +++ b/gcc/testsuite/obj-c++.dg/property/at-property-10.mm @@ -12,7 +12,7 @@ Class isa; int a; } -@property int a; +@property (nonatomic) int a; + (id) initialize; + (id) alloc; - (id) init; diff --git a/gcc/testsuite/obj-c++.dg/property/at-property-11.mm b/gcc/testsuite/obj-c++.dg/property/at-property-11.mm index 36da7bf2794..82880521680 100644 --- a/gcc/testsuite/obj-c++.dg/property/at-property-11.mm +++ b/gcc/testsuite/obj-c++.dg/property/at-property-11.mm @@ -12,7 +12,7 @@ Class isa; int a; } -@property int a; +@property (nonatomic) int a; + (id) initialize; + (id) alloc; - (id) init; diff --git a/gcc/testsuite/obj-c++.dg/property/at-property-12.mm b/gcc/testsuite/obj-c++.dg/property/at-property-12.mm new file mode 100644 index 00000000000..8d28bde9668 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/property/at-property-12.mm @@ -0,0 +1,46 @@ +/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, October 2010. */ +/* { dg-do run } */ + +/* Test atomic, assign synthesized methods. */ + +#include <stdlib.h> +#include <objc/objc.h> +#include <objc/runtime.h> + +@interface MyRootClass +{ + Class isa; + int a; + id b; +} +@property int a; +@property (assign) id b; ++ (id) initialize; ++ (id) alloc; +- (id) init; +@end + +@implementation MyRootClass ++ (id) initialize { return self; } ++ (id) alloc { return class_createInstance (self, 0); } +- (id) init { return self; } +@synthesize a; +@synthesize b; +@end + +int main (void) +{ + MyRootClass *object = [[MyRootClass alloc] init]; + + object.a = 40; + if (object.a != 40) + abort (); + + object.b = object; + if (object.b != object) + abort (); + + return (0); +} + + diff --git a/gcc/testsuite/obj-c++.dg/property/at-property-13.mm b/gcc/testsuite/obj-c++.dg/property/at-property-13.mm new file mode 100644 index 00000000000..5a5dcbbf63c --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/property/at-property-13.mm @@ -0,0 +1,71 @@ +/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, October 2010. */ +/* { dg-do run } */ + +/* Test retain and copy synthesized methods. */ + +#include <stdlib.h> +#include <objc/objc.h> +#include <objc/runtime.h> + +@interface MyRootClass +{ + Class isa; + int copy_count; + id a; + id b; +} +@property (copy) id a; +@property (retain) id b; ++ (id) initialize; ++ (id) alloc; +- (id) init; +- (id) copyWithZone: (void *)zone; +- (int) copyCount; +- (id) autorelease; +- (oneway void) release; +- (id) retain; +@end + +/* This class implements copyWithZone, which doesn't do anything other + than increasing a counter of how many copies were made. */ +@implementation MyRootClass ++ (id) initialize { return self; } ++ (id) alloc { return class_createInstance (self, 0); } +- (id) init { return self; } +- (id) copyWithZone: (void *)zone { copy_count++; return self; } +- (int) copyCount { return copy_count; } +- (id) autorelease { return self; } +- (oneway void) release { return; } +- (id) retain { return self; } +@synthesize a; +@synthesize b; +@end + +int main (void) +{ + MyRootClass *object = [[MyRootClass alloc] init]; + MyRootClass *argument = [[MyRootClass alloc] init]; + + /* This should copy argument. */ + object.a = argument; + if (object.a != argument) + abort (); + + /* Test that it was copied. */ + if ([object.a copyCount] != 1) + abort (); + + /* We just test that the retain accessors seem to work and that they + don't copy. We don't test that retain was actually called, + because if garbage collection is enabled, it may never be + called! */ + object.b = argument; + if (object.b != argument) + abort (); + + /* Test that it was not copied. */ + if ([object.b copyCount] != 1) + abort (); + + return (0); +} diff --git a/gcc/testsuite/obj-c++.dg/property/at-property-6.mm b/gcc/testsuite/obj-c++.dg/property/at-property-6.mm index 3f1f0d3abe0..8b7346b95af 100644 --- a/gcc/testsuite/obj-c++.dg/property/at-property-6.mm +++ b/gcc/testsuite/obj-c++.dg/property/at-property-6.mm @@ -13,7 +13,7 @@ Class isa; int a; } -@property int a; +@property (nonatomic) int a; + (id) initialize; + (id) alloc; - (id) init; diff --git a/gcc/testsuite/obj-c++.dg/property/at-property-7.mm b/gcc/testsuite/obj-c++.dg/property/at-property-7.mm index cae04dee498..bace2420e57 100644 --- a/gcc/testsuite/obj-c++.dg/property/at-property-7.mm +++ b/gcc/testsuite/obj-c++.dg/property/at-property-7.mm @@ -13,7 +13,7 @@ Class isa; int a; } -@property (getter = getA) int a; +@property (getter = getA, nonatomic) int a; + (id) initialize; + (id) alloc; - (id) init; diff --git a/gcc/testsuite/obj-c++.dg/property/at-property-8.mm b/gcc/testsuite/obj-c++.dg/property/at-property-8.mm index ec37052989a..a290dd3df35 100644 --- a/gcc/testsuite/obj-c++.dg/property/at-property-8.mm +++ b/gcc/testsuite/obj-c++.dg/property/at-property-8.mm @@ -13,7 +13,7 @@ Class isa; int a; } -@property (setter = writeA:) int a; +@property (setter = writeA:, nonatomic) int a; + (id) initialize; + (id) alloc; - (id) init; diff --git a/gcc/testsuite/obj-c++.dg/property/at-property-9.mm b/gcc/testsuite/obj-c++.dg/property/at-property-9.mm index 12e9ffde872..be52e37f5d0 100644 --- a/gcc/testsuite/obj-c++.dg/property/at-property-9.mm +++ b/gcc/testsuite/obj-c++.dg/property/at-property-9.mm @@ -13,7 +13,7 @@ Class isa; int a; } -@property (getter = giveMeA, setter = writeA:) int a; +@property (getter = giveMeA, setter = writeA:, nonatomic) int a; + (id) initialize; + (id) alloc; - (id) init; diff --git a/gcc/testsuite/obj-c++.dg/property/at-property-deprecated-1.mm b/gcc/testsuite/obj-c++.dg/property/at-property-deprecated-1.mm new file mode 100644 index 00000000000..1bcb28820a6 --- /dev/null +++ b/gcc/testsuite/obj-c++.dg/property/at-property-deprecated-1.mm @@ -0,0 +1,37 @@ +/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, October 2010. */ +/* { dg-do compile } */ + +/* Test that properties can be deprecated. */ + +#include <stdlib.h> +#include <objc/objc.h> +#include <objc/runtime.h> + +@interface MyRootClass +{ + Class isa; + int a; +} +@property int a __attribute__((deprecated)); ++ (id) initialize; ++ (id) alloc; +- (id) init; +@end + +@implementation MyRootClass ++ (id) initialize { return self; } ++ (id) alloc { return class_createInstance (self, 0); } +- (id) init { return self; } +@synthesize a; +@end + +int main (void) +{ + MyRootClass *object = [[MyRootClass alloc] init]; + + object.a = 40; /* { dg-warning ".a. is deprecated .declared at " } */ + if (object.a != 40) /* { dg-warning ".a. is deprecated .declared at " } */ + abort (); + + return (0); +} diff --git a/gcc/testsuite/objc.dg/attributes/method-attribute-2.m b/gcc/testsuite/objc.dg/attributes/method-attribute-2.m index f9a184cdf41..4a56b3aa8f6 100644 --- a/gcc/testsuite/objc.dg/attributes/method-attribute-2.m +++ b/gcc/testsuite/objc.dg/attributes/method-attribute-2.m @@ -14,7 +14,7 @@ @end @implementation obj -- (int) depmth __attribute__((deprecated)) { return var; } +- (int) depmth __attribute__((deprecated)) { return var; } /* { dg-warning "method attributes can not be specified in @implementation context" } */ - (int) depmtharg:(int) iarg { return var + iarg ; } - (int) unusedarg:(int) __attribute__((unused)) uarg { return var; } - (int) depunusedarg:(int) __attribute__((unused)) uarg { return var; } diff --git a/gcc/testsuite/objc.dg/attributes/method-deprecated-1.m b/gcc/testsuite/objc.dg/attributes/method-deprecated-1.m new file mode 100644 index 00000000000..8343856a5c6 --- /dev/null +++ b/gcc/testsuite/objc.dg/attributes/method-deprecated-1.m @@ -0,0 +1,33 @@ +/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, October 2010. */ +/* { dg-do compile } */ + +#include <objc/objc.h> + +@interface MyClass +{ + Class isa; +} ++ (int) method; +- (int) method; ++ (int) deprecatedClassMethod __attribute__((deprecated)); +- (int) deprecatedInstanceMethod __attribute__((deprecated)); +@end + +/* Test that deprecation warnings are produced, but not if the + receiver is of type 'id'. */ +void foo (void) +{ + Class c; + id object; + MyClass *another_object; + + [c method]; + [object method]; + [c deprecatedClassMethod]; + [object deprecatedInstanceMethod]; + + [object method]; + [another_object method]; + [MyClass deprecatedClassMethod]; /* { dg-warning "is deprecated" } */ + [another_object deprecatedInstanceMethod]; /* { dg-warning "is deprecated" } */ +} diff --git a/gcc/testsuite/objc.dg/attributes/method-deprecated-2.m b/gcc/testsuite/objc.dg/attributes/method-deprecated-2.m new file mode 100644 index 00000000000..1e5d87f3e63 --- /dev/null +++ b/gcc/testsuite/objc.dg/attributes/method-deprecated-2.m @@ -0,0 +1,23 @@ +/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, October 2010. */ +/* { dg-do compile } */ + +#include <objc/objc.h> + +@interface MyClass +{ + Class isa; +} ++ (int) deprecatedClassMethod: (id)firstObject, ... __attribute__((sentinel)) __attribute__((deprecated)); +- (int) deprecatedInstanceMethod: (id)firstobject, ... __attribute__((sentinel)) __attribute__((deprecated)); +@end + +/* Test that deprecation warnings are produced even if the method is + also marked with another attribute too (this is to test the + processing of multiple attributes). */ +void foo (void) +{ + MyClass *object = nil; + + [MyClass deprecatedClassMethod: object, nil]; /* { dg-warning "is deprecated" } */ + [object deprecatedInstanceMethod: object, nil]; /* { dg-warning "is deprecated" } */ +} diff --git a/gcc/testsuite/objc.dg/attributes/method-deprecated-3.m b/gcc/testsuite/objc.dg/attributes/method-deprecated-3.m new file mode 100644 index 00000000000..5c715a20b68 --- /dev/null +++ b/gcc/testsuite/objc.dg/attributes/method-deprecated-3.m @@ -0,0 +1,21 @@ +/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, October 2010. */ +/* { dg-do compile } */ + +#include <objc/objc.h> + +/* Test that __attribute__ ((__deprecated__)) works as well as __attribute__ ((deprecated)). */ +@interface MyClass +{ + Class isa; +} ++ (int) deprecatedClassMethod: (id)firstObject, ... __attribute__((__deprecated__)); +- (int) deprecatedInstanceMethod: (id)firstobject, ... __attribute__((__deprecated__)); +@end + +void foo (void) +{ + MyClass *object = nil; + + [MyClass deprecatedClassMethod: object, nil]; /* { dg-warning "is deprecated" } */ + [object deprecatedInstanceMethod: object, nil]; /* { dg-warning "is deprecated" } */ +} diff --git a/gcc/testsuite/objc.dg/attributes/method-format-1.m b/gcc/testsuite/objc.dg/attributes/method-format-1.m new file mode 100644 index 00000000000..0a078ff0a3a --- /dev/null +++ b/gcc/testsuite/objc.dg/attributes/method-format-1.m @@ -0,0 +1,43 @@ +/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, October 2010. */ +/* { dg-do compile } */ +/* { dg-options "-Wall" } */ + +#include <objc/objc.h> +#include <stdlib.h> + +@interface LogObject +{ + Class isa; +} ++ (void) log: (int)level message: (const char *) my_format, ... __attribute__ ((format (printf, 2, 3))); +- (void) log: (int)level message: (const char *) my_format, ... __attribute__ ((format (printf, 2, 3))); + ++ (void) debug: (const char *) my_format, ... __attribute__ ((format (printf, 1, 2))); +- (void) debug: (const char *) my_format, ... __attribute__ ((format (printf, 1, 2))); + +/* Just make sure a missing or invalid attribute won't crash the compiler. */ +- (void) log2: (int)level message: (const char *) my_format, ... __attribute__ ((format (printf, 2))); /* { dg-error "wrong" } */ ++ (void) debug2: (const char *) my_format, ... __attribute__ ((format (printf))); /* { dg-error "wrong" } */ +- (void) debug2: (const char *) my_format, ... __attribute__ ((format (printf))); /* { dg-error "wrong" } */ ++ (void) alert: (const char *) my_format __attribute__ ((format (printf, 1, 2))); /* { dg-error "args to be formatted is not ..." } */ +- (void) alert: (const char *) my_format __attribute__ ((format (printf, 1, 2))); /* { dg-error "args to be formatted is not ..." } */ +@end + +void test (LogObject *object) +{ + [object log: 2 message: "attribute only applies to variadic functions"]; + [object log: 2 message: "attribute %s only applies to variadic functions", "'format'"]; + [object log: 2 message: "attribute %s only applies to variadic functions"]; /* { dg-warning "too few arguments for format" } */ + + [object debug: "attribute only applies to variadic functions"]; + [object debug: "attribute %s only applies to variadic functions", "'format'"]; + [object debug: "attribute %s only applies to variadic functions"]; /* { dg-warning "too few arguments for format" } */ + + [LogObject log: 2 message: "attribute only applies to variadic functions"]; + [LogObject log: 2 message: "attribute %s only applies to variadic functions", "'format'"]; + [LogObject log: 2 message: "attribute %s only applies to variadic functions"]; /* { dg-warning "too few arguments for format" } */ + + [LogObject debug: "attribute only applies to variadic functions"]; + [LogObject debug: "attribute %s only applies to variadic functions", "'format'"]; + [LogObject debug: "attribute %s only applies to variadic functions"]; /* { dg-warning "too few arguments for format" } */ +} diff --git a/gcc/testsuite/objc.dg/attributes/method-noreturn-1.m b/gcc/testsuite/objc.dg/attributes/method-noreturn-1.m new file mode 100644 index 00000000000..af051a61d34 --- /dev/null +++ b/gcc/testsuite/objc.dg/attributes/method-noreturn-1.m @@ -0,0 +1,34 @@ +/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, October 2010. */ +/* { dg-do compile } */ + +#include <objc/objc.h> +#include <stdlib.h> + +@interface MyClass +{ + Class isa; +} ++ (id) method1 __attribute__ ((noreturn)); +- (id) method2 __attribute__ ((noreturn)); ++ (id) method3 __attribute__ ((noreturn)); +- (id) method4 __attribute__ ((noreturn)); +@end + +@implementation MyClass ++ (id) method1 +{ + return self; /* { dg-warning "function declared .noreturn. has a .return. statement" } */ +} /* { dg-warning ".noreturn. function does return" } */ +- (id) method2 +{ + return self; /* { dg-warning "function declared .noreturn. has a .return. statement" } */ +} /* { dg-warning ".noreturn. function does return" } */ ++ (id) method3 +{ + abort (); +} +- (id) method4 +{ + abort (); +} +@end diff --git a/gcc/testsuite/objc.dg/attributes/method-sentinel-1.m b/gcc/testsuite/objc.dg/attributes/method-sentinel-1.m new file mode 100644 index 00000000000..ecaa36c21f8 --- /dev/null +++ b/gcc/testsuite/objc.dg/attributes/method-sentinel-1.m @@ -0,0 +1,34 @@ +/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, October 2010. */ +/* { dg-do compile } */ +/* { dg-options "-Wall" } */ + +#include <objc/objc.h> +#include <stdlib.h> + +@interface NSArray +{ + Class isa; +} ++ (id) arrayWithObject: (id)object __attribute__ ((sentinel)); /* { dg-warning "attribute only applies to variadic functions" } */ ++ (id) arrayWithObjects: (id)firstObject, ... __attribute__ ((sentinel)); + +- (id) initWithObject: (id)object __attribute__ ((sentinel)); /* { dg-warning "attribute only applies to variadic functions" } */ +- (id) initWithObjects: (id)firstObject, ... __attribute__ ((sentinel)); +@end + +void test (id object) +{ + NSArray *array; + + array = [NSArray arrayWithObject: object]; + array = [NSArray arrayWithObjects: object, nil]; + array = [NSArray arrayWithObjects: object, object, nil]; + array = [NSArray arrayWithObjects: object]; /* { dg-warning "not enough variable arguments" } */ + array = [NSArray arrayWithObjects: object, object]; /* { dg-warning "missing sentinel" } */ + + [array initWithObject: object]; + [array initWithObjects: object, nil]; + [array initWithObjects: object, object, nil]; + [array initWithObjects: object]; /* { dg-warning "not enough variable arguments" } */ + [array initWithObjects: object, object]; /* { dg-warning "missing sentinel" } */ +} diff --git a/gcc/testsuite/objc.dg/property/at-property-10.m b/gcc/testsuite/objc.dg/property/at-property-10.m index bc6380cd5a6..1a7a0430899 100644 --- a/gcc/testsuite/objc.dg/property/at-property-10.m +++ b/gcc/testsuite/objc.dg/property/at-property-10.m @@ -12,7 +12,10 @@ Class isa; int a; } -@property int a; +/* Use the simplest synthesized accessor (assign, nonatomic) as we are + not testing the synthesized accessors in this test, just the + property syntax. */ +@property (nonatomic) int a; + (id) initialize; + (id) alloc; - (id) init; diff --git a/gcc/testsuite/objc.dg/property/at-property-11.m b/gcc/testsuite/objc.dg/property/at-property-11.m index 84857e0659a..2526a9cc1de 100644 --- a/gcc/testsuite/objc.dg/property/at-property-11.m +++ b/gcc/testsuite/objc.dg/property/at-property-11.m @@ -12,7 +12,10 @@ Class isa; int a; } -@property int a; +/* Use the simplest synthesized accessor (assign, nonatomic) as we are + not testing the synthesized accessors in this test, just the + property syntax. */ +@property (nonatomic) int a; + (id) initialize; + (id) alloc; - (id) init; diff --git a/gcc/testsuite/objc.dg/property/at-property-12.m b/gcc/testsuite/objc.dg/property/at-property-12.m new file mode 100644 index 00000000000..e96b198282c --- /dev/null +++ b/gcc/testsuite/objc.dg/property/at-property-12.m @@ -0,0 +1,46 @@ +/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, October 2010. */ +/* { dg-do run } */ + +/* Test atomic, assign synthesized methods. */ + +#include <stdlib.h> +#include <objc/objc.h> +#include <objc/runtime.h> + +@interface MyRootClass +{ + Class isa; + int a; + id b; +} +@property int a; +@property (assign) id b; ++ (id) initialize; ++ (id) alloc; +- (id) init; +@end + +@implementation MyRootClass ++ (id) initialize { return self; } ++ (id) alloc { return class_createInstance (self, 0); } +- (id) init { return self; } +@synthesize a; +@synthesize b; +@end + +int main (void) +{ + MyRootClass *object = [[MyRootClass alloc] init]; + + object.a = 40; + if (object.a != 40) + abort (); + + object.b = object; + if (object.b != object) + abort (); + + return 0; +} + + diff --git a/gcc/testsuite/objc.dg/property/at-property-13.m b/gcc/testsuite/objc.dg/property/at-property-13.m new file mode 100644 index 00000000000..dfdb02f7127 --- /dev/null +++ b/gcc/testsuite/objc.dg/property/at-property-13.m @@ -0,0 +1,71 @@ +/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, October 2010. */ +/* { dg-do run } */ + +/* Test retain and copy synthesized methods. */ + +#include <stdlib.h> +#include <objc/objc.h> +#include <objc/runtime.h> + +@interface MyRootClass +{ + Class isa; + int copy_count; + id a; + id b; +} +@property (copy) id a; +@property (retain) id b; ++ (id) initialize; ++ (id) alloc; +- (id) init; +- (id) copyWithZone: (void *)zone; +- (int) copyCount; +- (id) autorelease; +- (oneway void) release; +- (id) retain; +@end + +/* This class implements copyWithZone, which doesn't do anything other + than increasing a counter of how many copies were made. */ +@implementation MyRootClass ++ (id) initialize { return self; } ++ (id) alloc { return class_createInstance (self, 0); } +- (id) init { return self; } +- (id) copyWithZone: (void *)zone { copy_count++; return self; } +- (int) copyCount { return copy_count; } +- (id) autorelease { return self; } +- (oneway void) release { return; } +- (id) retain { return self; } +@synthesize a; +@synthesize b; +@end + +int main (void) +{ + MyRootClass *object = [[MyRootClass alloc] init]; + MyRootClass *argument = [[MyRootClass alloc] init]; + + /* This should copy argument. */ + object.a = argument; + if (object.a != argument) + abort (); + + /* Test that it was copied. */ + if ([object.a copyCount] != 1) + abort (); + + /* We just test that the retain accessors seem to work and that they + don't copy. We don't test that retain was actually called, + because if garbage collection is enabled, it may never be + called! */ + object.b = argument; + if (object.b != argument) + abort (); + + /* Test that it was not copied. */ + if ([object.b copyCount] != 1) + abort (); + + return 0; +} diff --git a/gcc/testsuite/objc.dg/property/at-property-6.m b/gcc/testsuite/objc.dg/property/at-property-6.m index a97c0b05f67..079995c526a 100644 --- a/gcc/testsuite/objc.dg/property/at-property-6.m +++ b/gcc/testsuite/objc.dg/property/at-property-6.m @@ -13,7 +13,7 @@ Class isa; int a; } -@property int a; +@property (nonatomic) int a; + (id) initialize; + (id) alloc; - (id) init; diff --git a/gcc/testsuite/objc.dg/property/at-property-7.m b/gcc/testsuite/objc.dg/property/at-property-7.m index dce27640781..6f182d0730e 100644 --- a/gcc/testsuite/objc.dg/property/at-property-7.m +++ b/gcc/testsuite/objc.dg/property/at-property-7.m @@ -13,7 +13,7 @@ Class isa; int a; } -@property (getter = getA) int a; +@property (getter = getA, nonatomic) int a; + (id) initialize; + (id) alloc; - (id) init; diff --git a/gcc/testsuite/objc.dg/property/at-property-8.m b/gcc/testsuite/objc.dg/property/at-property-8.m index eb158893724..94ed86e7f8b 100644 --- a/gcc/testsuite/objc.dg/property/at-property-8.m +++ b/gcc/testsuite/objc.dg/property/at-property-8.m @@ -13,7 +13,7 @@ Class isa; int a; } -@property (setter = writeA:) int a; +@property (setter = writeA:, nonatomic) int a; + (id) initialize; + (id) alloc; - (id) init; diff --git a/gcc/testsuite/objc.dg/property/at-property-9.m b/gcc/testsuite/objc.dg/property/at-property-9.m index 203eb3003fd..6e2d118882f 100644 --- a/gcc/testsuite/objc.dg/property/at-property-9.m +++ b/gcc/testsuite/objc.dg/property/at-property-9.m @@ -13,7 +13,10 @@ Class isa; int a; } -@property (getter = giveMeA, setter = writeA:) int a; +/* Use the simplest synthesized accessor (assign, nonatomic) as we are + not testing the synthesized accessors in this test, just the + property syntax. */ +@property (getter = giveMeA, setter = writeA:, nonatomic) int a; + (id) initialize; + (id) alloc; - (id) init; diff --git a/gcc/testsuite/objc.dg/property/at-property-deprecated-1.m b/gcc/testsuite/objc.dg/property/at-property-deprecated-1.m new file mode 100644 index 00000000000..c38854ff38d --- /dev/null +++ b/gcc/testsuite/objc.dg/property/at-property-deprecated-1.m @@ -0,0 +1,37 @@ +/* Contributed by Nicola Pero <nicola.pero@meta-innovation.com>, October 2010. */ +/* { dg-do compile } */ + +/* Test that properties can be deprecated. */ + +#include <stdlib.h> +#include <objc/objc.h> +#include <objc/runtime.h> + +@interface MyRootClass +{ + Class isa; + int a; +} +@property int a __attribute__((deprecated)); ++ (id) initialize; ++ (id) alloc; +- (id) init; +@end + +@implementation MyRootClass ++ (id) initialize { return self; } ++ (id) alloc { return class_createInstance (self, 0); } +- (id) init { return self; } +@synthesize a; +@end + +int main (void) +{ + MyRootClass *object = [[MyRootClass alloc] init]; + + object.a = 40; /* { dg-warning ".a. is deprecated .declared at " } */ + if (object.a != 40) /* { dg-warning ".a. is deprecated .declared at " } */ + abort (); + + return 0; +} diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c index 67e9e2bc445..183bb111a30 100644 --- a/gcc/tree-vect-stmts.c +++ b/gcc/tree-vect-stmts.c @@ -987,7 +987,9 @@ vect_get_vec_def_for_operand (tree op, gimple stmt, tree *scalar_def) loop_vec_info loop_vinfo = STMT_VINFO_LOOP_VINFO (stmt_vinfo); tree vec_inv; tree vec_cst; + tree t = NULL_TREE; tree def; + int i; enum vect_def_type dt; bool is_simple_use; tree vector_type; @@ -1049,7 +1051,13 @@ vect_get_vec_def_for_operand (tree op, gimple stmt, tree *scalar_def) if (vect_print_dump_info (REPORT_DETAILS)) fprintf (vect_dump, "Create vector_inv."); - vec_inv = build_vector_from_val (vector_type, def); + for (i = nunits - 1; i >= 0; --i) + { + t = tree_cons (NULL_TREE, def, t); + } + + /* FIXME: use build_constructor directly. */ + vec_inv = build_constructor_from_list (vector_type, t); return vect_init_vector (stmt, vec_inv, vector_type, NULL); } diff --git a/gcc/tree.c b/gcc/tree.c index 4de73ee4d2c..a7460315658 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -1376,8 +1376,8 @@ build_vector_from_val (tree vectype, tree sc) if (sc == error_mark_node) return sc; - gcc_assert (lang_hooks.types_compatible_p (TREE_TYPE (sc), - TREE_TYPE (vectype))); + gcc_assert (useless_type_conversion_p (TREE_TYPE (sc), + TREE_TYPE (vectype))); v = VEC_alloc (constructor_elt, gc, nunits); for (i = 0; i < nunits; ++i) diff --git a/gcc/var-tracking.c b/gcc/var-tracking.c index c3d5077dbaf..0dc8b15ea10 100644 --- a/gcc/var-tracking.c +++ b/gcc/var-tracking.c @@ -408,7 +408,6 @@ static void stack_adjust_offset_pre_post (rtx, HOST_WIDE_INT *, static void insn_stack_adjust_offset_pre_post (rtx, HOST_WIDE_INT *, HOST_WIDE_INT *); static bool vt_stack_adjustments (void); -static rtx compute_cfa_pointer (HOST_WIDE_INT); static hashval_t variable_htab_hash (const void *); static int variable_htab_eq (const void *, const void *); static void variable_htab_free (void *); @@ -695,22 +694,17 @@ vt_stack_adjustments (void) return true; } +/* arg_pointer_rtx resp. frame_pointer_rtx if stack_pointer_rtx or + hard_frame_pointer_rtx is being mapped to it and offset for it. */ +static rtx cfa_base_rtx; +static HOST_WIDE_INT cfa_base_offset; + /* Compute a CFA-based value for the stack pointer. */ -static rtx +static inline rtx compute_cfa_pointer (HOST_WIDE_INT adjustment) { - rtx cfa; - -#ifdef FRAME_POINTER_CFA_OFFSET - adjustment -= FRAME_POINTER_CFA_OFFSET (current_function_decl); - cfa = plus_constant (frame_pointer_rtx, adjustment); -#else - adjustment -= ARG_POINTER_CFA_OFFSET (current_function_decl); - cfa = plus_constant (arg_pointer_rtx, adjustment); -#endif - - return cfa; + return plus_constant (cfa_base_rtx, adjustment + cfa_base_offset); } /* Adjustment for hard_frame_pointer_rtx to cfa base reg, @@ -803,11 +797,13 @@ adjust_mems (rtx loc, const_rtx old_rtx, void *data) if (amd->mem_mode == VOIDmode && amd->store) return loc; if (loc == stack_pointer_rtx - && !frame_pointer_needed) + && !frame_pointer_needed + && cfa_base_rtx) return compute_cfa_pointer (amd->stack_adjust); else if (loc == hard_frame_pointer_rtx && frame_pointer_needed - && hard_frame_pointer_adjustment != -1) + && hard_frame_pointer_adjustment != -1 + && cfa_base_rtx) return compute_cfa_pointer (hard_frame_pointer_adjustment); return loc; case MEM: @@ -4757,10 +4753,6 @@ var_lowpart (enum machine_mode mode, rtx loc) return gen_rtx_REG_offset (loc, mode, regno, offset); } -/* arg_pointer_rtx resp. frame_pointer_rtx if stack_pointer_rtx or - hard_frame_pointer_rtx is being mapped to it. */ -static rtx cfa_base_rtx; - /* Carry information about uses and stores while walking rtx. */ struct count_use_info @@ -8213,8 +8205,10 @@ vt_init_cfa_base (void) #ifdef FRAME_POINTER_CFA_OFFSET cfa_base_rtx = frame_pointer_rtx; + cfa_base_offset = -FRAME_POINTER_CFA_OFFSET (current_function_decl); #else cfa_base_rtx = arg_pointer_rtx; + cfa_base_offset = -ARG_POINTER_CFA_OFFSET (current_function_decl); #endif if (cfa_base_rtx == hard_frame_pointer_rtx || !fixed_regs[REGNO (cfa_base_rtx)]) diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index c35650f6bfb..c78c71f2bf9 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,12 +1,64 @@ -2010-10-23 Benjamin Kosnik <bkoz@redhat.com> +2010-11-01 Benjamin Kosnik <bkoz@redhat.com> + + * include/std/chrono: Extend constexpr application. + * testsuite/util/testsuite_common_types.h + (constexpr_default_constructible, constexpr_single_value_constructible) + : Add comments about implied constraints. + * testsuite/20_util/duration/cons/constexpr.cc: Activate all tests. + * testsuite/20_util/time_point/cons/constexpr.cc: Same. + * testsuite/20_util/time_point/requirements/constexpr_functions.cc: + Same. + * testsuite/20_util/ratio/cons/cons_overflow_neg.cc: Adjust line + numbers. + * testsuite/20_util/time_point_cast/constexpr.cc: New. + + * include/std/bitset: Use __SIZEOF_* macros to re-create original + logic instead of slipshod application of + std::numeric_limits<T>::max() macros. + * testsuite/util/testsuite_common_types.h + (constexpr_default_constructible): Modify. + + * include/std/chrono: Tested constexpr. + * testsuite/20_util/duration_cast/constexpr.cc: New. + * testsuite/20_util/time_point/cons/constexpr.cc: New. + + * testsuite/20_util/duration/cons/constexpr.cc: Add single_value tests. + * testsuite/20_util/duration/requirements/typedefs_neg1.cc: Adjust + line numbers. + * testsuite/20_util/duration/requirements/typedefs_neg2.cc: Same. + * testsuite/20_util/duration/requirements/typedefs_neg3.cc: Same. + * testsuite/20_util/time_point/cons/constexpr.cc: Add single_value + tests. + * testsuite/20_util/time_point/requirements/constexpr_functions.cc: Add. + + * testsuite/util/testsuite_common_types.h: Adjust init. + + * include/std/chrono (duration): Remove defaulted constructor, + replace with mem-init list. + * testsuite/20_util/duration/cons/constexpr.cc: Add single value. + * testsuite/20_util/duration/requirements/constexpr_functions.cc: + Add non-static member functions. + + * testsuite/20_util/default_delete/cons/constexpr.cc: New, xfail. + * testsuite/20_util/enable_shared_from_this/cons/constexpr.cc: Same. + * testsuite/20_util/shared_ptr/cons/constexpr.cc: Same. + * testsuite/20_util/time_point/requirements/constexpr_functions.cc: + Same. + * testsuite/20_util/unique_ptr/cons/constexpr.cc: Same. + * testsuite/20_util/weak_ptr/cons/constexpr.cc: Same. + + * include/std/bitset: Add constexpr as per N3126 draft. + * testsuite/23_containers/bitset/cons/constexpr.cc: New. + * testsuite/23_containers/bitset/requirements/constexpr_functions.cc: + New. + + * testsuite/util/testsuite_common_types.h: Reset condition. * include/bits/random.h: Remove misleading comments. * include/bits/regex.h: Add constexpr. * testsuite/28_regex/05_constants/syntax_option_type.cc: Add tests. * testsuite/28_regex/08_basic_regex/requirements/constexpr_data.cc: New. -2010-10-22 Benjamin Kosnik <bkoz@redhat.com> - PR libstdc++/46134 * include/std/chrono: Use default constructor. * testsuite/util/testsuite_common_types.h @@ -17,8 +69,6 @@ constructors for constexpr. * testsuite/26_numerics/complex/cons/constexpr.cc: Enable tests. -2010-10-20 Benjamin Kosnik <bkoz@redhat.com> - * include/bits/random.h: Adjust for constexpr as per N3126 draft. * testsuite/26_numerics/random/discard_block_engine/requirements/ constexpr_data.cc: New. @@ -43,8 +93,6 @@ * testsuite/26_numerics/random/subtract_with_carry_engine/requirements/ constexpr_functions.cc: New. -2010-10-20 Benjamin Kosnik <bkoz@redhat.com> - * include/bits/stream_iterator.h: Add constexpr as per N3126 draft. * include/bits/streambuf_iterator.h: Same. * include/std/complex: Same. @@ -54,25 +102,17 @@ * testsuite/26_numerics/complex/requirements/constexpr_functions.cc: New. -2010-10-20 Benjamin Kosnik <bkoz@redhat.com> - * include/bits/char_traits.h: Add constexpr as per N3126 draft. * testsuite/21_strings/char_traits/requirements/constexpr_functions.cc: New. -2010-10-20 Benjamin Kosnik <bkoz@redhat.com> - * include/tr1_impl/array: Add constexpr as per N3126 draft. * testsuite/23_containers/array/requirements/ constexpr_functions.cc: New. -2010-10-20 Benjamin Kosnik <bkoz@redhat.com> - * include/bits/shared_ptr.h: Revert changes. * include/bits/unique_ptr.h: Same. -2010-10-20 Benjamin Kosnik <bkoz@redhat.com> - * include/std/chrono: Adjust. * include/tr1_impl/type_traits: Same. @@ -96,8 +136,6 @@ * testsuite/29_atomics/atomic_integral/cons/copy_neg.cc: Same. * testsuite/29_atomics/atomic_integral/operators/bitwise_neg.cc: Same. -2010-10-19 Benjamin Kosnik <bkoz@redhat.com> - * include/bits/allocator.h: Add constexpr as per N3126 draft. * include/bits/ios_base.h: Same. * include/bits/shared_ptr.h: Same. @@ -120,8 +158,6 @@ * doc/doxygen/user.cfg.in: Replace _GLIBCXX_USE_CONSTEXPR, _GLIBCXX_CONSTEXPR for doxygen generation. -2010-10-18 Benjamin Kosnik <bkoz@redhat.com> - * src/limits.cc: Undef. * testsuite/29_atomics/atomic/cons/constexpr.cc: Adjust. * testsuite/29_atomics/atomic_address/cons/constexpr.cc: Same. @@ -131,8 +167,6 @@ * testsuite/18_support/numeric_limits/requirements/ constexpr_data.cc, constexpr_functions.cc: ...this -2010-10-15 Benjamin Kosnik <bkoz@redhat.com> - * testsuite/util/testsuite_common_types.h (constexpr_single_value_constructible): Add. * testsuite/29_atomics/atomic/cons/constexpr.cc: Adjust name. @@ -150,16 +184,12 @@ * testsuite/29_atomics/atomic_integral/operators/decrement_neg.cc: Same. * testsuite/29_atomics/atomic_integral/operators/increment_neg.cc: Same. -2010-10-15 Benjamin Kosnik <bkoz@redhat.com> - * include/bits/c++config (_GLIBCXX_CONSTEXPR): Add. (_GLIBCXX_USE_CONSTEXPR): Add. * include/std/limits: Use it. * src/limits.cc: Adjust. * testsuite/ext/profile/mutex_extensions.cc: Change line number. -2010-10-15 Benjamin Kosnik <bkoz@redhat.com> - * include/bits/atomic_0.h: Rework for N3126 draft, add constexpr. * include/bits/atomic_2.h: Same. * include/bits/atomic_base.h: Same. @@ -194,6 +224,21 @@ * testsuite/util/testsuite_abi.cc: Add GLIBCXX_3.4.16. +2010-11-01 Jason Merrill <jason@redhat.com> + + * libsupc++/initializer_list: Decorate with constexpr. + +2010-11-01 Jonathan Wakely <jwakely.gcc@gmail.com> + + PR libstdc++/45999 + * python/libstdcxx/v6/printers.py (StdVectorPrinter): Replace + conditional expression with backward-compatible if-else. + +2010-11-01 Jie Zhang <jie@codesourcery.com> + + * config/abi/pre/gnu.ver: Export __emutls_v._ZSt11__once_call + and __emutls_v._ZSt15__once_callable. + 2010-10-31 Paolo Carlini <paolo.carlini@oracle.com> * testsuite/23_containers/bitset/cons/dr1325-2.cc: Fix typo. @@ -1087,13 +1132,13 @@ 2010-09-03 François Dumont <francois.cppdevs@free.fr> - * testsuite/lib/libstdc++.exp ([check_v3_target_debug_mode]): Fix so - that it really detects when debug mode is activated. - * testsuite/util/debug/construct_neg.h, insert_neg.h, assign_neg.h: - Remove, content moved... - * testsuite/util/debug/checks.h: ... here. Modify checks to take the + * testsuite/lib/libstdc++.exp ([check_v3_target_debug_mode]): Fix so + that it really detects when debug mode is activated. + * testsuite/util/debug/construct_neg.h, insert_neg.h, assign_neg.h: + Remove, content moved... + * testsuite/util/debug/checks.h: ... here. Modify checks to take the type of the container to test rather than an intermediate container - type traits helper. + type traits helper. * testsuite/23_containers/unordered_map/debug/insert1_neg.cc: Update to use dg-require-debug-mode when necessary and use new check functions. * testsuite/23_containers/unordered_map/debug/construct1_neg.cc: @@ -1310,89 +1355,89 @@ 2010-08-29 François Dumont <francois.cppdevs@free.fr> - * include/bits/stl_algobase.h (_Iter_base): Move... - * include/bits/stl_iterator_base_types.h: ...here. - * include/debug/functions.h (__check_valid_range, __check_string, + * include/bits/stl_algobase.h (_Iter_base): Move... + * include/bits/stl_iterator_base_types.h: ...here. + * include/debug/functions.h (__check_valid_range, __check_string, __check_sorted): Fix to not depend on _GLIBCXX_DEBUG; include formatter.h and use formatting macros for a consistent debug result. - * include/debug/formatter.h (__check_singular): Declare; do not + * include/debug/formatter.h (__check_singular): Declare; do not include debug.h. - * include/debug/debug.h: Do not include formatter.h. - * include/debug/safe_iterator.h (_Safe_iterator::_Base_Iterator) - rename to iterator_type. + * include/debug/debug.h: Do not include formatter.h. + * include/debug/safe_iterator.h (_Safe_iterator::_Base_Iterator) + rename to iterator_type. (__gnu_debug::__base): Add. - * include/debug/set.h: Use everywhere __gnu_debug::__base once + * include/debug/set.h: Use everywhere __gnu_debug::__base once iterator range valided. - * include/debug/unordered_map: Likewise. - * include/debug/multiset.h: Likewise. - * include/debug/vector: Likewise. - * include/debug/unordered_set: Likewise. - * include/debug/deque: Likewise. - * include/debug/map.h: Likewise. - * include/debug/string: Likewise. - * include/debug/list: Likewise. - * include/debug/multimap.h: Likewise. - * testsuite/23_containers/util/debug/assign_neg.h: New test cases on - debug checks performed on container assign operation. - * testsuite/23_containers/util/debug/construct_neg.h: New test cases - on debug checks on constructors. - * testsuite/23_containers/util/debug/insert_neg.h: New test cases on - debug checks performed on container insert operations. - * testsuite/23_containers/unordered_map/debug/cont_traits.h, - debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc, - construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc, - insert3_neg.cc, insert4_neg.cc: New. - * testsuite/23_containers/multimap/debug/cont_traits.h, - debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc, - construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc, - insert3_neg.cc, insert4_neg.cc: Likewise. - * testsuite/23_containers/set/debug/cont_traits.h, - debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc, - construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc, - insert3_neg.cc, insert4_neg.cc: Likewise. - * testsuite/23_containers/unordered_multimap/debug/cont_traits.h, - debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc, - construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc, - insert3_neg.cc, insert4_neg.cc: Likewise. - * testsuite/23_containers/unordered_set/debug/cont_traits.h, - debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc, - construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc, - insert3_neg.cc, insert4_neg.cc: Likewise. - * testsuite/23_containers/multiset/debug/cont_traits.h, - debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc, - construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc, - insert3_neg.cc, insert4_neg.cc: Likewise. - * testsuite/23_containers/unordered_multiset/debug/cont_traits.h, - debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc, - construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc, - insert3_neg.cc, insert4_neg.cc: Likewise. - * testsuite/23_containers/map/debug/cont_traits.h, - debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc, - construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc, - insert3_neg.cc, insert4_neg.cc: Likewise. - * testsuite/23_containers/vector/debug/cont_traits.h, - debug_cont_traits.h, assign1_neg.cc, assign2_neg.cc, assign3_neg.cc, - assign4_neg.cc, construct1_neg.cc, construct2_neg.cc, - construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc, - insert3_neg.cc, insert4_neg.cc: Likewise. - * testsuite/23_containers/deque/debug/cont_traits.h, - debug_cont_traits.h, assign1_neg.cc, assign2_neg.cc, assign3_neg.cc, - assign4_neg.cc, construct1_neg.cc, construct2_neg.cc, - construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc, - insert3_neg.cc, insert4_neg.cc: Likewise. + * include/debug/unordered_map: Likewise. + * include/debug/multiset.h: Likewise. + * include/debug/vector: Likewise. + * include/debug/unordered_set: Likewise. + * include/debug/deque: Likewise. + * include/debug/map.h: Likewise. + * include/debug/string: Likewise. + * include/debug/list: Likewise. + * include/debug/multimap.h: Likewise. + * testsuite/23_containers/util/debug/assign_neg.h: New test cases on + debug checks performed on container assign operation. + * testsuite/23_containers/util/debug/construct_neg.h: New test cases + on debug checks on constructors. + * testsuite/23_containers/util/debug/insert_neg.h: New test cases on + debug checks performed on container insert operations. + * testsuite/23_containers/unordered_map/debug/cont_traits.h, + debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc, + construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc, + insert3_neg.cc, insert4_neg.cc: New. + * testsuite/23_containers/multimap/debug/cont_traits.h, + debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc, + construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc, + insert3_neg.cc, insert4_neg.cc: Likewise. + * testsuite/23_containers/set/debug/cont_traits.h, + debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc, + construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc, + insert3_neg.cc, insert4_neg.cc: Likewise. + * testsuite/23_containers/unordered_multimap/debug/cont_traits.h, + debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc, + construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc, + insert3_neg.cc, insert4_neg.cc: Likewise. + * testsuite/23_containers/unordered_set/debug/cont_traits.h, + debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc, + construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc, + insert3_neg.cc, insert4_neg.cc: Likewise. + * testsuite/23_containers/multiset/debug/cont_traits.h, + debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc, + construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc, + insert3_neg.cc, insert4_neg.cc: Likewise. + * testsuite/23_containers/unordered_multiset/debug/cont_traits.h, + debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc, + construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc, + insert3_neg.cc, insert4_neg.cc: Likewise. + * testsuite/23_containers/map/debug/cont_traits.h, + debug_cont_traits.h, construct1_neg.cc, construct2_neg.cc, + construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc, + insert3_neg.cc, insert4_neg.cc: Likewise. + * testsuite/23_containers/vector/debug/cont_traits.h, + debug_cont_traits.h, assign1_neg.cc, assign2_neg.cc, assign3_neg.cc, + assign4_neg.cc, construct1_neg.cc, construct2_neg.cc, + construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc, + insert3_neg.cc, insert4_neg.cc: Likewise. + * testsuite/23_containers/deque/debug/cont_traits.h, + debug_cont_traits.h, assign1_neg.cc, assign2_neg.cc, assign3_neg.cc, + assign4_neg.cc, construct1_neg.cc, construct2_neg.cc, + construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc, + insert3_neg.cc, insert4_neg.cc: Likewise. * testsuite/23_containers/list/debug/cont_traits.h, - debug_cont_traits.h, assign1_neg.cc, assign2_neg.cc, assign3_neg.cc, - assign4_neg.cc, construct1_neg.cc, construct2_neg.cc, - construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc, - insert3_neg.cc, insert4_neg.cc: Likewise. - * testsuite/performance/23_containers/range_construct/ + debug_cont_traits.h, assign1_neg.cc, assign2_neg.cc, assign3_neg.cc, + assign4_neg.cc, construct1_neg.cc, construct2_neg.cc, + construct3_neg.cc, construct4_neg.cc, insert1_neg.cc, insert2_neg.cc, + insert3_neg.cc, insert4_neg.cc: Likewise. + * testsuite/performance/23_containers/range_construct/ list_construct1.cc: New, validate performance impact of the patch on the debug mode. - * testsuite/performance/23_containers/range_construct/ + * testsuite/performance/23_containers/range_construct/ list_construct2.cc: Likewise. - * testsuite/performance/23_containers/range_construct/ + * testsuite/performance/23_containers/range_construct/ vector_construct.cc: Likewise. - * testsuite/performance/23_containers/range_construct/ + * testsuite/performance/23_containers/range_construct/ deque_construct.cc: Likewise. 2010-08-26 Benjamin Kosnik <bkoz@redhat.com> @@ -2688,18 +2733,18 @@ 2010-06-08 Johannes Singler <singler@kit.edu> - * include/parallel/find.h - (__find_template(.., growing_blocks_tag)): Make block size - proportional to current position. - * include/parallel/settings.h (_Settings): Introduce new tuning - parameter find_scale_factor to the end of the struct, defaults to - 0.01f. + * include/parallel/find.h + (__find_template(.., growing_blocks_tag)): Make block size + proportional to current position. + * include/parallel/settings.h (_Settings): Introduce new tuning + parameter find_scale_factor to the end of the struct, defaults to + 0.01f. 2010-06-08 Johannes Singler <singler@kit.edu> - * include/parallel/partial_sum.h - (__parallel_partial_sum_linear): - Correctly calculate part lengths for partial_sum_dilation!=1. + * include/parallel/partial_sum.h + (__parallel_partial_sum_linear): + Correctly calculate part lengths for partial_sum_dilation!=1. 2010-06-07 Paolo Carlini <paolo.carlini@oracle.com> @@ -2929,7 +2974,7 @@ * doc/xml/manual/status_cxx200x.xml: Update. 2010-06-05 Magnus Fromreide <magfr@lysator.liu.se> - Jonathan Wakely <jwakely.gcc@gmail.com> + Jonathan Wakely <jwakely.gcc@gmail.com> * include/std/functional (function): Add nullptr_t support. * include/bits/shared_ptr.h (shared_ptr): Likewise. @@ -2980,7 +3025,7 @@ 2010-06-03 Paolo Carlini <paolo.carlini@oracle.com> * include/bits/c++config (std::size_t, std::ptrdiff_t, - std::nullptr_t): Provide typedefs. + std::nullptr_t): Provide typedefs. * include/c_std/cstddef: Don't provide std::size_t and std::ptrdiff_t here. * include/c_global/cstddef: Likewise. @@ -3760,11 +3805,11 @@ 2010-04-22 Johannes Singler <singler@kit.edu> - * include/parallel/partition.h (__parallel_partition): - Improve scalability by: - -introducing new variables __leftold, __rightold, __dist, thus - -getting rid of omp lock by using atomic operations - -getting rid of two omp barriers + * include/parallel/partition.h (__parallel_partition): + Improve scalability by: + -introducing new variables __leftold, __rightold, __dist, thus + -getting rid of omp lock by using atomic operations + -getting rid of two omp barriers 2010-04-22 Jonathan Wakely <jwakely.gcc@gmail.com> @@ -3814,10 +3859,10 @@ 2010-03-30 Johannes Singler <singler@kit.edu> - * include/parallel/random_shuffle.h - (__parallel_random_shuffle_drs) : Take as many threads as - possible, i. e. favor parallelism over cache efficiency. - Use own PRNG also for the 1 thread case. + * include/parallel/random_shuffle.h + (__parallel_random_shuffle_drs) : Take as many threads as + possible, i. e. favor parallelism over cache efficiency. + Use own PRNG also for the 1 thread case. 2010-03-30 Paolo Carlini <paolo.carlini@oracle.com> @@ -3884,14 +3929,14 @@ 2010-03-22 Johannes Singler <singler@kit.edu> - * include/parallel/numeric (inner_product, partial_sum): - Precede subsequent call with _GLIBCXX_STD_P:: to avoid ambiguity - between __gnu_parallel:: and std:: - * include/parallel/algobase.h (equal): Likewise. - * include/parallel/algo.h (find_first_of, search_n, merge, nth_element, - partial_sort, max_element, min_element): Likewise. - * include/parallel/partial_sum.h (__parallel_partial_sum_linear): - Qualify accumulate call with __gnu_parallel::. + * include/parallel/numeric (inner_product, partial_sum): + Precede subsequent call with _GLIBCXX_STD_P:: to avoid ambiguity + between __gnu_parallel:: and std:: + * include/parallel/algobase.h (equal): Likewise. + * include/parallel/algo.h (find_first_of, search_n, merge, nth_element, + partial_sort, max_element, min_element): Likewise. + * include/parallel/partial_sum.h (__parallel_partial_sum_linear): + Qualify accumulate call with __gnu_parallel::. 2010-03-22 Paolo Carlini <paolo.carlini@oracle.com> diff --git a/libstdc++-v3/config/abi/pre/gnu.ver b/libstdc++-v3/config/abi/pre/gnu.ver index f11147730ce..eec63a016da 100644 --- a/libstdc++-v3/config/abi/pre/gnu.ver +++ b/libstdc++-v3/config/abi/pre/gnu.ver @@ -1187,6 +1187,10 @@ GLIBCXX_3.4.15 { # basic_filebuf::_M_get_ext_pos _ZNSt13basic_filebufI[cw]St11char_traitsI[cw]EE14_M_get_ext_pos*; + # targets using emutls + __emutls_v._ZSt11__once_call; + __emutls_v._ZSt15__once_callable; + } GLIBCXX_3.4.14; GLIBCXX_3.4.16 { diff --git a/libstdc++-v3/python/libstdcxx/v6/printers.py b/libstdc++-v3/python/libstdcxx/v6/printers.py index bf3689bb707..fb999bf5257 100644 --- a/libstdc++-v3/python/libstdcxx/v6/printers.py +++ b/libstdc++-v3/python/libstdcxx/v6/printers.py @@ -177,7 +177,10 @@ class StdVectorPrinter: if self.item == self.finish and self.so >= self.fo: raise StopIteration elt = self.item.dereference() - obit = 1 if elt & (1 << self.so) else 0 + if elt & (1 << self.so): + obit = 1 + else: + obit = 0 self.so = self.so + 1 if self.so >= self.isize: self.item = self.item + 1 diff --git a/libstdc++-v3/testsuite/20_util/ratio/cons/cons_overflow_neg.cc b/libstdc++-v3/testsuite/20_util/ratio/cons/cons_overflow_neg.cc index 17001563ed2..c7617690fe2 100644 --- a/libstdc++-v3/testsuite/20_util/ratio/cons/cons_overflow_neg.cc +++ b/libstdc++-v3/testsuite/20_util/ratio/cons/cons_overflow_neg.cc @@ -51,6 +51,6 @@ test04() // { dg-error "instantiated from here" "" { target *-*-* } 46 } // { dg-error "denominator cannot be zero" "" { target *-*-* } 153 } // { dg-error "out of range" "" { target *-*-* } 154 } -// { dg-error "overflow" "" { target *-*-* } 59 } +// { dg-error "constant expression" "" { target *-*-* } 59 } // { dg-error "not a member" "" { target *-*-* } 162 } // { dg-error "not a valid template argument" "" { target *-*-* } 164 } |