diff options
author | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-07-20 19:28:05 +0000 |
---|---|---|
committer | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2009-07-20 19:28:05 +0000 |
commit | 67a2b55a06644eea26249e710fa29677122fe789 (patch) | |
tree | 7541d5c6e267f3aaeb0dfc0038a90a3083dfe75f /gcc/testsuite | |
parent | 124370fd2fbe4d3d10b264a1cdbce62134c6e730 (diff) | |
download | gcc-67a2b55a06644eea26249e710fa29677122fe789.tar.gz |
./:
* toplev.c: Invoke FINISH_UNIT callbacks before call to
finalize().
testsuite/:
* gcc.dg/plugin/finish_unit_plugin.c: New test.
* gcc.dg/plugin/finish_unit-test-1.c: New test.
* gcc.dg/plugin/plugin.exp: Added finish_unit_plugin.c test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@149833 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite')
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/plugin/finish_unit-test-1.c | 7 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/plugin/finish_unit_plugin.c | 28 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/plugin/plugin.exp | 1 |
4 files changed, 42 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b7ba7d4f974..5faeb99bf23 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2009-07-20 Olatunji Ruwase <tjruwase@google.com> + + * gcc.dg/plugin/finish_unit_plugin.c: New test. + * gcc.dg/plugin/finish_unit-test-1.c: New test. + * gcc.dg/plugin/plugin.exp: Added finish_unit_plugin.c test. + 2009-07-20 Adam Nemet <anemet@caviumnetworks.com> * gcc.target/mips/ext-3.c: New test. diff --git a/gcc/testsuite/gcc.dg/plugin/finish_unit-test-1.c b/gcc/testsuite/gcc.dg/plugin/finish_unit-test-1.c new file mode 100644 index 00000000000..4cd8a40f441 --- /dev/null +++ b/gcc/testsuite/gcc.dg/plugin/finish_unit-test-1.c @@ -0,0 +1,7 @@ +/* { dg-do compile } */ +/* { dg-options "-O" } */ + +int main (int argc, char **argv) +{ + return 0; +} diff --git a/gcc/testsuite/gcc.dg/plugin/finish_unit_plugin.c b/gcc/testsuite/gcc.dg/plugin/finish_unit_plugin.c new file mode 100644 index 00000000000..634daeeda13 --- /dev/null +++ b/gcc/testsuite/gcc.dg/plugin/finish_unit_plugin.c @@ -0,0 +1,28 @@ +/* This plugin creates a fake function in the FINISH_UNIT callback, in + * other words right after compilation of the translation unit. +*/ +#include "gcc-plugin.h" +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "tm.h" +#include "toplev.h" +#include "basic-block.h" +#include "gimple.h" +#include "tree.h" +#include "tree-pass.h" +#include "intl.h" + +int plugin_is_GPL_compatible; + +static void finish_unit_callback (void *gcc_data, void *user_data) +{ + cgraph_build_static_cdtor ('I', NULL, DEFAULT_INIT_PRIORITY); +} + +int plugin_init (struct plugin_name_args *plugin_info, + struct plugin_gcc_version *version) +{ + register_callback ("finish_unit", PLUGIN_FINISH_UNIT, &finish_unit_callback, NULL); + return 0; +} diff --git a/gcc/testsuite/gcc.dg/plugin/plugin.exp b/gcc/testsuite/gcc.dg/plugin/plugin.exp index 3122fa8dc3e..872a0ea8c3c 100644 --- a/gcc/testsuite/gcc.dg/plugin/plugin.exp +++ b/gcc/testsuite/gcc.dg/plugin/plugin.exp @@ -51,6 +51,7 @@ set plugin_test_list [list \ { ggcplug.c ggcplug-test-1.c } \ { one_time_plugin.c one_time-test-1.c } \ { start_unit_plugin.c start_unit-test-1.c } \ + { finish_unit_plugin.c finish_unit-test-1.c } \ ] foreach plugin_test $plugin_test_list { |