diff options
author | David Malcolm <dmalcolm@redhat.com> | 2017-07-07 18:49:09 +0000 |
---|---|---|
committer | David Malcolm <dmalcolm@gcc.gnu.org> | 2017-07-07 18:49:09 +0000 |
commit | 738f7c2e12de922b91024717429a048b877492ee (patch) | |
tree | 1b954335f19a816878f1e5806bb1ecff2760223b /gcc | |
parent | 57f49e990f52ebdd3cb4a5be4e87a2301fed1a1a (diff) | |
download | gcc-738f7c2e12de922b91024717429a048b877492ee.zip gcc-738f7c2e12de922b91024717429a048b877492ee.tar.gz gcc-738f7c2e12de922b91024717429a048b877492ee.tar.bz2 |
libcpp: preserve ranges within macro expansions (PR c++/79300)
gcc/testsuite/ChangeLog:
PR c++/79300
* g++.dg/diagnostic/pr79300.C: New test case.
libcpp/ChangeLog:
PR c++/79300
* line-map.c (linemap_macro_loc_to_def_point): Preserve range
information for macro expansions by delaying resolving ad-hoc
locations until within the loop.
From-SVN: r250058
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/diagnostic/pr79300.C | 44 |
2 files changed, 49 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b2e43ef..73db4a7 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2017-07-07 David Malcolm <dmalcolm@redhat.com> + + PR c++/79300 + * g++.dg/diagnostic/pr79300.C: New test case. + 2017-07-07 Michael Meissner <meissner@linux.vnet.ibm.com> * gcc.target/powerpc/clone1.c: Add check to make sure the diff --git a/gcc/testsuite/g++.dg/diagnostic/pr79300.C b/gcc/testsuite/g++.dg/diagnostic/pr79300.C new file mode 100644 index 0000000..6805e85 --- /dev/null +++ b/gcc/testsuite/g++.dg/diagnostic/pr79300.C @@ -0,0 +1,44 @@ +// { dg-options "-fdiagnostics-show-caret" } + +#define TEST_1_DEPTH_0 throw bad_alloc; // { dg-line define_TEST_1_DEPTH_0 } + +void test_1 () +{ + TEST_1_DEPTH_0 // { dg-line use_TEST_1_DEPTH_0 } +} + +// { dg-error "'bad_alloc' was not declared in this scope" "" { target *-*-* } define_TEST_1_DEPTH_0 } +/* { dg-begin-multiline-output "" } + #define TEST_1_DEPTH_0 throw bad_alloc; + ^~~~~~~~~ + { dg-end-multiline-output "" } */ +// { dg-message "in expansion of macro 'TEST_1_DEPTH_0'" "" { target *-*-* } use_TEST_1_DEPTH_0 } +/* { dg-begin-multiline-output "" } + TEST_1_DEPTH_0 + ^~~~~~~~~~~~~~ + { dg-end-multiline-output "" } */ + + +#define TEST_2_DEPTH_0 throw bad_alloc; // { dg-line define_TEST_2_DEPTH_0 } +#define TEST_2_DEPTH_1 TEST_2_DEPTH_0 // { dg-line define_TEST_2_DEPTH_1 } + +void test_2 () +{ + TEST_2_DEPTH_1 // { dg-line use_TEST_2_DEPTH_1 } +} + +// { dg-error "'bad_alloc' was not declared in this scope" "" { target *-*-* } define_TEST_2_DEPTH_0 } +/* { dg-begin-multiline-output "" } + #define TEST_2_DEPTH_0 throw bad_alloc; + ^~~~~~~~~ + { dg-end-multiline-output "" } */ +// { dg-message "in expansion of macro 'TEST_2_DEPTH_0'" "" { target *-*-* } define_TEST_2_DEPTH_1 } +/* { dg-begin-multiline-output "" } + #define TEST_2_DEPTH_1 TEST_2_DEPTH_0 + ^~~~~~~~~~~~~~ + { dg-end-multiline-output "" } */ +// { dg-message "in expansion of macro 'TEST_2_DEPTH_1'" "" { target *-*-* } use_TEST_2_DEPTH_1 } +/* { dg-begin-multiline-output "" } + TEST_2_DEPTH_1 + ^~~~~~~~~~~~~~ + { dg-end-multiline-output "" } */ |