* 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
+2009-07-20 Olatunji Ruwase <tjruwase@google.com>
+
+ * toplev.c: Invoke FINISH_UNIT callbacks before call to
+ finalize().
+
2009-07-20 Shujing Zhao <pearly.zhao@oracle.com>
* Makefile.in (TREE_INLINE_H, tree-inline.o, cgraph.o): Remove
+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.
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-O" } */
+
+int main (int argc, char **argv)
+{
+ return 0;
+}
--- /dev/null
+/* 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;
+}
{ 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 {
}
#endif
+ /* Invoke registered plugin callbacks. */
+ invoke_plugin_callbacks (PLUGIN_FINISH_UNIT, NULL);
+
/* This must be at the end. Some target ports emit end of file directives
into the assembly file here, and hence we can not output anything to the
assembly file after this point. */
compile_file ();
finalize ();
-
- /* Invoke registered plugin callbacks. */
- invoke_plugin_callbacks (PLUGIN_FINISH_UNIT, NULL);
}
/* Stop timing and print the times. */