On Wed, 2015-11-25 at 16:26 -0500, Jason Merrill wrote: > > It's not clear to me whether I should be passing in UNKNOWN_LOCATION > > or input_location to the various functions. > > > > cp_build_unary_op used input_location in various places internally, > > so I've passed that in wherever there isn't a better value. > > Rather than try to get this right now I'm inclined to save it for the > next stage 1 and go back to protected_set_expr_location for GCC 6.
Thanks; I've reworked the patch based on that idea. I found whilst bugfixing that in general it was better to use cp_expr::set_location, which calls protected_set_expr_location, since the former sets both the location in the tree node (if any) *and* the shadow copy in the cp_expr (thus ensuring that compound expressions use the correct location_t). I've also done a lot of bugfixing, and rebased from r230562 (Nov 18th) to r231208 (Dec 2nd). > > Bootstraps (on x86_64-pc-linux-gnu), but regresses some tests, due to > > changes in locations at which diagnostics are emitted: > > > > c-c++-common/cilk-plus/CK/cilk_for_errors.c > > c-c++-common/cilk-plus/PS/for1.c > > c-c++-common/gomp/pr59073.c > > g++.dg/cpp0x/nsdmi-template14.C > > g++.dg/gomp/for-1.C > > g++.dg/gomp/pr39495-2.C > > g++.dg/init/new38.C > > g++.dg/warn/Wconversion-real-integer2.C > > g++.dg/warn/pr35635.C > > Are the changes good or bad? Some were bad, which I've fixed in the code. Others were improvements, requiring tweaks/movement of dg- directives. I've broken out any such changes I needed to make to specific test cases as separate patches in the kit, with notes on each, in the hope it will make review easier. (The kit would be applied as a single commit; I've been testing it as one). The following 10-patch kit bootstraps®rtests successfully on x86_64-pc-linux-gnu. It adds 213 new PASS results to g++.sum, and changes the location of 154 PASS results there. It adds 16 new PASS results to obj-c++.sum. OK for trunk for gcc 6? David Malcolm (10): C++ FE: expression ranges v4 Fix g++.dg/cpp0x/nsdmi-template14.C Fix g++.dg/gomp/loop-1.C Fix g++.dg/template/crash55.C Fix location of dg-error within g++.dg/template/pr64100.C Fix g++.dg/template/pseudodtor3.C Fix g++.dg/template/ref3.C Fix g++.dg/ubsan/pr63956.C Fix g++.dg/warn/pr35635.C Fix g++.dg/warn/Wconversion-real-integer2.C gcc/convert.c | 9 +- gcc/cp/cp-tree.h | 86 ++- gcc/cp/cvt.c | 4 +- gcc/cp/name-lookup.c | 6 +- gcc/cp/name-lookup.h | 2 +- gcc/cp/parser.c | 576 +++++++++++---- gcc/cp/semantics.c | 53 +- gcc/cp/typeck.c | 42 +- gcc/testsuite/g++.dg/cpp0x/nsdmi-template14.C | 4 +- gcc/testsuite/g++.dg/gomp/loop-1.C | 32 +- .../g++.dg/plugin/diagnostic-test-expressions-1.C | 775 +++++++++++++++++++++ gcc/testsuite/g++.dg/plugin/plugin.exp | 5 +- gcc/testsuite/g++.dg/template/crash55.C | 3 +- gcc/testsuite/g++.dg/template/pr64100.C | 4 +- gcc/testsuite/g++.dg/template/pseudodtor3.C | 4 +- gcc/testsuite/g++.dg/template/ref3.C | 6 +- gcc/testsuite/g++.dg/ubsan/pr63956.C | 28 +- .../g++.dg/warn/Wconversion-real-integer2.C | 4 +- gcc/testsuite/g++.dg/warn/pr35635.C | 6 +- .../plugin/diagnostic-test-expressions-1.mm | 94 +++ gcc/testsuite/obj-c++.dg/plugin/plugin.exp | 90 +++ gcc/tree.c | 25 +- gcc/tree.h | 17 +- 23 files changed, 1632 insertions(+), 243 deletions(-) create mode 100644 gcc/testsuite/g++.dg/plugin/diagnostic-test-expressions-1.C create mode 100644 gcc/testsuite/obj-c++.dg/plugin/diagnostic-test-expressions-1.mm create mode 100644 gcc/testsuite/obj-c++.dg/plugin/plugin.exp -- 1.8.5.3