]> git.ipfire.org Git - thirdparty/gcc.git/commit
libcpp: location comparison within macro [PR100796]
authorJason Merrill <jason@redhat.com>
Mon, 14 Jun 2021 21:37:43 +0000 (17:37 -0400)
committerJason Merrill <jason@redhat.com>
Wed, 16 Jun 2021 18:33:27 +0000 (14:33 -0400)
commitbb2e908638758097e261bca1a4825d171a18af9c
tree642bc3fe29d4bee2558e266408cdee6a2e77d1b9
parentd92613ec5529cecd66ef0c21b894c7f70ace7f87
libcpp: location comparison within macro [PR100796]

The patch for 96391 changed linemap_compare_locations to give up on
comparing locations from macro expansions if we don't have column
information.  But in this testcase, the BOILERPLATE macro is multiple lines
long, so we do want to compare locations within the macro.  So this patch
moves the LINE_MAP_MAX_LOCATION_WITH_COLS check inside the block, to use it
for failing gracefully.

PR c++/100796
PR preprocessor/96391

libcpp/ChangeLog:

* line-map.c (linemap_compare_locations): Only use comparison with
LINE_MAP_MAX_LOCATION_WITH_COLS to avoid abort.

gcc/testsuite/ChangeLog:

* g++.dg/plugin/location-overflow-test-pr100796.c: New test.
* g++.dg/plugin/plugin.exp: Run it.
gcc/testsuite/g++.dg/plugin/location-overflow-test-pr100796.c [new file with mode: 0644]
gcc/testsuite/g++.dg/plugin/plugin.exp
libcpp/line-map.c