- 29 May, 2012 4 commits
-
-
As stated in the audit trail of this problem report, consider this test case: $ cat test.c 1 struct x { 2 int i; 3 }; 4 struct x x; 5 6 #define TEST(X) x.##X 7 8 void foo (void) 9 { 10 TEST(i) = 0; 11 } $ $ cc1 -quiet test.c test.c: In function 'foo': test.c:10:1: error: pasting "." and "i" does not give a valid preprocessing token TEST(i) = 0; ^ $ So, when pasting tokens, the error diagnostic uses the global and imprecise input_location variable, leading to an imprecise output. To properly fix this, I think libcpp should keep the token of the pasting operator '##', instead of representing it with flag on the LHS operand's token. That way, it could use its location. Doing that would be quite intrusive though. So this patch just uses the location of the LHS of the pasting operator, for now. It's IMHO better than the current situation. The patch makes paste_tokens take a location parameter that is used in the diagnostics. This change can still be useful later when we can use the location of the pasting operator, because paste_tokens will just be passed the new, more precise location. Incidentally, it appeared that when getting tokens from within preprocessor directives (like what is done in gcc.dg/cpp/paste12.c), with -ftrack-macro-expansion disabled, the location of the expansion point of macros was being lost because cpp_reader::set_invocation_location wasn't being properly set. It's because when cpp_get_token_1 calls enter_macro_context, there is a little period of time between the beginning of that later function and when the macro is really pushed (and thus when the macro is really expanded) where we wrongly consider that we are not expanding the macro because macro_of_context is still NULL. In that period of time, in the occurrences of indirect recursive calls to cpp_get_token_1, this later function wrongly sets cpp_reader::invocation_location because cpp_reader::set_invocation_location is not being properly set. To avoid that confusion the patch does away with cpp_reader::set_invocation_location and introduces a new flag cpp_reader::about_to_expand_macro_p that is set in the small time interval exposed earlier. A new in_macro_expansion_p is introduced as well, so that cpp_get_token_1 can now accurately detect when we are in the process of expanding a macro, and thus correctly collect the location of the expansion point. People seem to like screenshots. Thus, after the patch, we now have: $ cc1 -quiet test.c test.c: In function 'foo': test.c:6:18: error: pasting "." and "i" does not give a valid preprocessing token #define TEST(X) x.##X ^ test.c:10:3: note: in expansion of macro 'TEST' TEST(i) = 0; ^ $ Bootstrapped and tested on x86_64-unknown-linux-gnu against trunk. libcpp/ PR preprocessor/53229 * internal.h (cpp_reader::set_invocation_location): Remove. (cpp_reader::about_to_expand_macro_p): New member flag. * directives.c (do_pragma): Remove Kludge as pfile->set_invocation_location is no more. * macro.c (cpp_get_token_1): Do away with the use of cpp_reader::set_invocation_location. Just collect the macro expansion point when we are about to expand the top-most macro. Do not override cpp_reader::about_to_expand_macro_p. This fixes gcc.dg/cpp/paste12.c by making get_token_no_padding properly handle locations of expansion points. (cpp_get_token_with_location): Adjust, as cpp_reader::set_invocation_location is no more. (paste_tokens): Take a virtual location parameter for the LHS of the pasting operator. Use it in diagnostics. Update comments. (paste_all_tokens): Tighten the assert. Propagate the location of the expansion point when no virtual locations are available. Pass the virtual location to paste_tokens. (in_macro_expansion_p): New static function. (enter_macro_context): Set the cpp_reader::about_to_expand_macro_p flag until we really start expanding the macro. gcc/testsuite/ PR preprocessor/53229 * gcc.dg/cpp/paste6.c: Force to run without -ftrack-macro-expansion. * gcc.dg/cpp/paste8.c: Likewise. * gcc.dg/cpp/paste8-2.c: New test, like paste8.c but run with -ftrack-macro-expansion. * gcc.dg/cpp/paste12.c: Force to run without -ftrack-macro-expansion. * gcc.dg/cpp/paste12-2.c: New test, like paste12.c but run with -ftrack-macro-expansion. * gcc.dg/cpp/paste13.c: Likewise. * gcc.dg/cpp/paste14.c: Likewise. * gcc.dg/cpp/paste14-2.c: New test, like paste14.c but run with -ftrack-macro-expansion. * gcc.dg/cpp/paste18.c: New test. From-SVN: r187945
Dodji Seketeli committed -
* gcc.target/cris/torture/trap-1.c, gcc.target/cris/torture/trap-2.c, gcc.target/cris/torture/trap-3.c, gcc.target/cris/torture/trap-v0.c, gcc.target/cris/torture/trap-v3.c: New tests. From-SVN: r187943
Hans-Peter Nilsson committed -
* config/cris/cris.h (TARGET_HAS_BREAK, TARGET_TRAP_USING_BREAK8): New macros. * config/cris/cris.md ("trap"): Define, enabled for TARGET_TRAP_USING_BREAK8. * config/cris/cris.opt (mtrap-using-break8): New option. From-SVN: r187942
Hans-Peter Nilsson committed -
From-SVN: r187941
GCC Administrator committed
-
- 28 May, 2012 7 commits
-
-
/c-family 2012-05-28 Paolo Carlini <paolo.carlini@oracle.com> PR c++/25137 * c-opts.c (c_common_handle_option): For C++ -Wall doesn't enable -Wmissing_braces. 2012-05-28 Paolo Carlini <paolo.carlini@oracle.com> PR c++/25137 * doc/invoke.texi: Document -Wmissing-braces not enabled by -Wall for C++. /testsuite 2012-05-28 Paolo Carlini <paolo.carlini@oracle.com> PR c++/25137 * g++.dg/warn/Wbraces3.C: New. * g++.dg/warn/Wbraces4.C: Likewise. From-SVN: r187937
Paolo Carlini committed -
From-SVN: r187936
Hans-Peter Nilsson committed -
From-SVN: r187935
Hans-Peter Nilsson committed -
* doc/md.texi (stack_protect_test): Remove negation of branch to label. From-SVN: r187934
Hans-Peter Nilsson committed -
PR tree-optimization/53505 * c-c++-common/torture/pr53505.c: New test. From-SVN: r187931
Jakub Jelinek committed -
gcc/cp 2012-05-28 Paolo Carlini <paolo.carlini@oracle.com> PR c++/53503 * semantics.c (potential_constant_expression_1): Handle LTGT_EXPR. libstdc++-v3 2012-05-28 Paolo Carlini <paolo.carlini@oracle.com> PR c++/53503 * testsuite/26_numerics/headers/cmath/53503.cc: New. From-SVN: r187928
Paolo Carlini committed -
From-SVN: r187927
GCC Administrator committed
-
- 27 May, 2012 3 commits
-
-
* tree.c (build_constructor): Propagate TREE_SIDE_EFFECTS. testsuite/ * gcc.dg/stmt-expr-4.c: New. From-SVN: r187923
Nathan Sidwell committed -
2012-05-27 Janne Blomqvist <jb@gcc.gnu.org> * intrinsics/time_1.h (gf_cputime): Don't reevaluate HZ expression for times fallback, clarify operation ordering for times and clock fallbacks. (gf_gettime): Fix comment typo. From-SVN: r187922
Janne Blomqvist committed -
From-SVN: r187921
GCC Administrator committed
-
- 26 May, 2012 8 commits
-
-
/cp 2012-05-26 Paolo Carlini <paolo.carlini@oracle.com> PR c++/53491 * tree.c (stabilize_expr): Handle exp of void type. /testsuite 2012-05-26 Paolo Carlini <paolo.carlini@oracle.com> PR c++/53491 * g++.dg/parse/crash60.C: New. From-SVN: r187917
Paolo Carlini committed -
PR c++/53220 gcc/ * c-typeck.c (array_to_pointer_conversion): Give -Wc++-compat warning about array compound literals. gcc/cp/ * call.c (convert_like_real) [ck_list]: Take array address directly. * typeck.c (decay_conversion): Reject decay of an array compound literal. From-SVN: r187916
Jason Merrill committed -
PR ada/50294 * gnat.dg/array21.adb: New test. From-SVN: r187914
Eric Botcazou committed -
* cfgcleanup.c (try_optimize_cfg): Do not delete forwarder blocks if CLEANUP_NO_INSN_DEL. * cfgrtl.c (unique_locus_on_edge_between_p): New function extracted from cfg_layout_merge_blocks. (emit_nop_for_unique_locus_between): New function. (rtl_merge_blocks): Invoke emit_nop_for_unique_locus_between. (cfg_layout_merge_blocks): Likewise. From-SVN: r187913
Eric Botcazou committed -
From-SVN: r187912
Eric Botcazou committed -
2012-05-26 Dimitrios Apostolou <jimis@gmx.net> Paolo Bonzini <bonzini@gnu.org> * df-scan.c (df_def_record_1): Assert a parallel must contain an EXPR_LIST at this point. Receive the LOC and move its extraction... (df_defs_record): ... here. Change if-else to a switch statement. (df_find_hard_reg_defs, df_find_hard_reg_defs_1): New. (df_get_call_refs): Changed defs_generated from bitmap to HARD_REG_SET and compute it from df_find_hard_reg_defs(). Record DF_REF_BASE DEFs in REGNO order. Use HARD_REG_SET instead of bitmap for regs_invalidated_by_call. (df_insn_refs_collect): Record DF_REF_REGULAR DEFs after df_get_call_refs(). Co-Authored-By: Paolo Bonzini <bonzini@gnu.org> From-SVN: r187911
Dimitrios Apostolou committed -
* gcc-interface/decl.c (variant_desc): Rename 'record' to 'new_type'. (build_variant_list): Adjust to above renaming. (gnat_to_gnu_entity) <E_Record_Subtype>: Likewise. Give a unique name to the type of the variant containers. (create_variant_part_from): Likewise. Give a unique name to the type of the variant part. From-SVN: r187908
Eric Botcazou committed -
From-SVN: r187906
GCC Administrator committed
-
- 25 May, 2012 18 commits
-
-
/cp 2012-05-25 Paolo Carlini <paolo.carlini@oracle.com> PR c++/32054 * parser.c (cp_parser_member_declaration): A storage class is not allowed in a declaration of an anonymous aggregate in a class scope. /testsuite 2012-05-25 Paolo Carlini <paolo.carlini@oracle.com> PR c++/32054 * g++.dg/other/anon-union3.C: New. From-SVN: r187902
Paolo Carlini committed -
From-SVN: r187899
Ian Lance Taylor committed -
From-SVN: r187897
Ian Lance Taylor committed -
morestack.S (__morestack_non_split): Check whether caller is varargs and needs %bp to hold the stack frame on return. libgcc/: * config/i386/morestack.S (__morestack_non_split): Check whether caller is varargs and needs %bp to hold the stack frame on return. gcc/testsuite/: * gcc.dg/split-6.c: New test. From-SVN: r187894
Ian Lance Taylor committed -
PR lto/52178 * tree-inline.c (remap_gimple_op_r): Fix handling of FIELD_DECL. * tree.c (RETURN_TRUE_IF_VAR): Do not return true for PLACEHOLDER_EXPR. From-SVN: r187892
Eric Botcazou committed -
2012-05-25 Michael Meissner <meissner@linux.vnet.ibm.com> * config/rs6000/t-linux64: Delete the 32-bit multilib that uses software floating point emulation. No longer build the multilibs with -mstrict-align. From-SVN: r187891
Michael Meissner committed -
From-SVN: r187889
Ian Lance Taylor committed -
PR obj-c++/53441 * decl.c (grokdeclarator): Check that current_class_type is non-NULL before calling constructor_name_p. From-SVN: r187888
Uros Bizjak committed -
PR middle-end/53008 * trans-mem.c (ipa_tm_create_version_alias): Output new_node if accessed indirectly. (ipa_tm_create_version): Same. From-SVN: r187887
Aldy Hernandez committed -
From-SVN: r187886
Uros Bizjak committed -
PR target/53474 * config/i386/i386.c (ix86_print_operand) <case 'O'>: Print '.' here. <case 'C', case 'c', case 'F', case 'f'>: Print '.' only for C and c. From-SVN: r187885
Uros Bizjak committed -
re PR target/53435 ((ix86_expand_vec_perm) and (ix86_expand_vec_perm) do not pass arguments to avx2_permvar8s[f,i] correctly) 2012-05-21 Alexander Ivchenko <alexander.ivchenko@intel.com> PR target/53435 * config/i386/i386.c (ix86_expand_vec_perm): Use correct op. (ix86_expand_vec_perm): Use int mode instead of float. (expand_vec_perm_pshufb): Remove handling of useseless type conversion. From-SVN: r187881
Alexander Ivchenko committed -
PR bootstrap/53472 * contrib/compare-debug (remove_comment): New function. Remove any .comment sections if the first cmp failed. From-SVN: r187879
H.J. Lu committed -
From-SVN: r187875
Eric Botcazou committed -
PR ada/52362 * config.gcc (i[34567]86-*-mingw* | x86_64-*-mingw*): Set gas and gnu_ld variables to yes. * configure.ac (HAVE_GNU_LD): Move to after config.gcc inclusion. (HAVE_GNU_AS): Likewise. * config.in: Regenerate. * configure: Likewise. ada/ * link.c (__gnat_object_file_option): Set to "-Wl,@" for GNU linker. (__gnat_using_gnu_linker): Delete. * gnatlink.adb (Gnatlink): Declare Object_File_Option_Ptr here... Declare Object_File_Option string constant and Using_GNU_response_file boolean constant. (Process_Binder_File): ...instead of here. Delete Using_GNU_Linker, Opening and Closing local variables. Do not handle the GNU linker specially. (Write_RF): New procedure to write into the response file. Escape some characters if a GNU response file is used. Keep track of error status. Invoke Write_RF to write into the response file. Delete the file only if the link was successful. * mlib-utl.adb: Do not `with' package System. (Gcc): Likewise. Declare Object_File_Option string constant and Using_GNU_response_file boolean constant. (Write_RF): Take a string instead of address and length. Escape some characters if a GNU response file is used. Invoke Write_RF to write into the response file. Delete the file only if the link was successful. Do not warn if it cannot be deleted. From-SVN: r187874
Eric Botcazou committed -
gcc/ 2012-05-25 Tristan Gingold <gingold@adacore.com> * config/i386/i386.c (struct ix86_frame): Remove unused frame field. (ix86_compute_frame_layout): Fix type of stack_alignment_needed and preferred_alignment. gcc/testsuite 2012-05-25 Tristan Gingold <gingold@adacore.com> * gcc.target/i386/large-frame.c: New. From-SVN: r187873
Tristan Gingold committed -
2012-05-25 Tristan Gingold <gingold@adacore.com> * common/config/ia64/ia64-common.c (ia64_except_unwind_info): Fix typo. From-SVN: r187872
Tristan Gingold committed -
libgcc/ * config/rs6000/vxworks/tramp.S (trampoline_setup): Use a longcall sequence in the non pic case on VxWorks. From-SVN: r187871
Olivier Hainque committed
-