diff options
author | Mike Gulick <mgulick@mathworks.com> | 2018-11-27 15:53:51 +0000 |
---|---|---|
committer | David Malcolm <dmalcolm@gcc.gnu.org> | 2018-11-27 15:53:51 +0000 |
commit | 4d8da4df6b6c2c7b89a6cc402bc134b69911e922 (patch) | |
tree | 52b4d730c96dff21a590f8f580b7f7afcb0fd8d9 | |
parent | 862ec76377acf7a20009d755f45d8480868c3fc8 (diff) | |
download | gcc-4d8da4df6b6c2c7b89a6cc402bc134b69911e922.zip gcc-4d8da4df6b6c2c7b89a6cc402bc134b69911e922.tar.gz gcc-4d8da4df6b6c2c7b89a6cc402bc134b69911e922.tar.bz2 |
PR preprocessor/83173: New test
2018-11-27 Mike Gulick <mgulick@mathworks.com>
PR preprocessor/83173
* gcc.dg/plugin/location-overflow-test-pr83173.c: New test.
* gcc.dg/plugin/location-overflow-test-pr83173.h: Header for
pr83173.c.
* gcc.dg/plugin/location-overflow-test-pr83173-1.h: Header for
pr83173.c.
* gcc.dg/plugin/location-overflow-test-pr83173-2.h: Header for
pr83173.c.
* gcc.dg/plugin/location_overflow_plugin.c: Use PLUGIN_PRAGMAS
instead of PLUGIN_START_UNIT.
* gcc.dg/plugin/plugin.exp: Enable new test.
From-SVN: r266518
7 files changed, 51 insertions, 6 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index bf09d5c..00a063d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,17 @@ +2018-11-27 Mike Gulick <mgulick@mathworks.com> + + PR preprocessor/83173 + * gcc.dg/plugin/location-overflow-test-pr83173.c: New test. + * gcc.dg/plugin/location-overflow-test-pr83173.h: Header for + pr83173.c. + * gcc.dg/plugin/location-overflow-test-pr83173-1.h: Header for + pr83173.c. + * gcc.dg/plugin/location-overflow-test-pr83173-2.h: Header for + pr83173.c. + * gcc.dg/plugin/location_overflow_plugin.c: Use PLUGIN_PRAGMAS + instead of PLUGIN_START_UNIT. + * gcc.dg/plugin/plugin.exp: Enable new test. + 2018-11-27 Jakub Jelinek <jakub@redhat.com> PR target/88188 diff --git a/gcc/testsuite/gcc.dg/plugin/location-overflow-test-pr83173-1.h b/gcc/testsuite/gcc.dg/plugin/location-overflow-test-pr83173-1.h new file mode 100644 index 0000000..f47dc36 --- /dev/null +++ b/gcc/testsuite/gcc.dg/plugin/location-overflow-test-pr83173-1.h @@ -0,0 +1,2 @@ +#pragma once +#define LOCATION_OVERFLOW_TEST_PR83173_1_H diff --git a/gcc/testsuite/gcc.dg/plugin/location-overflow-test-pr83173-2.h b/gcc/testsuite/gcc.dg/plugin/location-overflow-test-pr83173-2.h new file mode 100644 index 0000000..bc23ed2 --- /dev/null +++ b/gcc/testsuite/gcc.dg/plugin/location-overflow-test-pr83173-2.h @@ -0,0 +1,2 @@ +#pragma once +#define LOCATION_OVERFLOW_TEST_PR83173_2_H diff --git a/gcc/testsuite/gcc.dg/plugin/location-overflow-test-pr83173.c b/gcc/testsuite/gcc.dg/plugin/location-overflow-test-pr83173.c new file mode 100644 index 0000000..2d58128 --- /dev/null +++ b/gcc/testsuite/gcc.dg/plugin/location-overflow-test-pr83173.c @@ -0,0 +1,21 @@ +/* + { dg-options "-fplugin-arg-location_overflow_plugin-value=0x60000001" } + { dg-do preprocess } +*/ + +#include "location-overflow-test-pr83173.h" + +int +main () +{ + return 0; +} + +/* + The preprocessor output should contain + '# 1 "path/to/location-overflow-test-pr83173-1.h" 1', but should not + contain any other references to location-overflow-test-pr83183-1.h. + + { dg-final { scan-file location-overflow-test-pr83173.i "# 1 \[^\r\n\]+location-overflow-test-pr83173-1\.h\" 1" } } + { dg-final { scan-file-not location-overflow-test-pr83173.i "# (?!1 \[^\r\n\]+location-overflow-test-pr83173-1\.h\" 1)\[0-9\]+ \[^\r\n\]+location-overflow-test-pr83173-1\.h\"" } } +*/ diff --git a/gcc/testsuite/gcc.dg/plugin/location-overflow-test-pr83173.h b/gcc/testsuite/gcc.dg/plugin/location-overflow-test-pr83173.h new file mode 100644 index 0000000..49076f7 --- /dev/null +++ b/gcc/testsuite/gcc.dg/plugin/location-overflow-test-pr83173.h @@ -0,0 +1,2 @@ +#include "location-overflow-test-pr83173-1.h" +#include "location-overflow-test-pr83173-2.h" diff --git a/gcc/testsuite/gcc.dg/plugin/location_overflow_plugin.c b/gcc/testsuite/gcc.dg/plugin/location_overflow_plugin.c index 5c9d5ba..09bac50d 100644 --- a/gcc/testsuite/gcc.dg/plugin/location_overflow_plugin.c +++ b/gcc/testsuite/gcc.dg/plugin/location_overflow_plugin.c @@ -12,11 +12,14 @@ int plugin_is_GPL_compatible; static location_t base_location; -/* Callback handler for the PLUGIN_START_UNIT event; pretend - we parsed a very large include file. */ +/* Callback handler for the PLUGIN_PRAGMAS event; pretend we parsed a + very large include file. This is used to set the initial line table + offset for the preprocessor, to make it appear as if we had parsed a + very large file. PRAGMA_START_UNIT is not suitable here as is not + invoked during the preprocessor stage. */ static void -on_start_unit (void */*gcc_data*/, void */*user_data*/) +on_pragma_registration (void */*gcc_data*/, void */*user_data*/) { /* Act as if we've already parsed a large body of code; so that we can simulate various fallbacks in libcpp: @@ -81,8 +84,8 @@ plugin_init (struct plugin_name_args *plugin_info, error_at (UNKNOWN_LOCATION, "missing plugin argument"); register_callback (plugin_info->base_name, - PLUGIN_START_UNIT, - on_start_unit, + PLUGIN_PRAGMAS, + on_pragma_registration, NULL); /* void *user_data */ /* Hack in additional testing, based on the exact value supplied. */ diff --git a/gcc/testsuite/gcc.dg/plugin/plugin.exp b/gcc/testsuite/gcc.dg/plugin/plugin.exp index d92ede7..f9e89c4 100644 --- a/gcc/testsuite/gcc.dg/plugin/plugin.exp +++ b/gcc/testsuite/gcc.dg/plugin/plugin.exp @@ -96,7 +96,8 @@ set plugin_test_list [list \ diagnostic-test-inlining-4.c } \ { location_overflow_plugin.c \ location-overflow-test-1.c \ - location-overflow-test-2.c } \ + location-overflow-test-2.c \ + location-overflow-test-pr83173.c } \ { must_tail_call_plugin.c \ must-tail-call-1.c \ must-tail-call-2.c } \ |