Diego Novillo wrote:
On Tue, Jun 9, 2009 at 15:33, Taras Glek<taras.g...@gmail.com> wrote:
While developing my plugin I've noticed that many callbacks need to be
guarded with "if (errorcount)" or the plugin will cause a gcc crash due to
receiving less complete data than it expected.

More details please.  What exactly is the error and how is errorcount related?

Should the plugin API guard callbacks in invoke_plugin_callbacks() to avoid
99% of plugins running into this issue?

At the point that plugins are invoked, they should be able to deal
with whatever state the IL is at that moment.  I'd favor flexibility
over protection here.  But I'd like to see more details on what you're
after here.
This is more of a polish issue than anything else. Trouble is that one may never see these bugs during plugin development unless the plugins are tested on files that have syntax errors.

   Test command: /home/bradh/devel/gcc-build/gcc/cc1 -quiet -O1
-ftest-coverage -fplugin=../gcc_dehydra.so -o /dev/null
-fplugin-arg-gcc_dehydra-=test_numinfo.js numinfo.cc
   Failure msg: Expected 'OK' output; Errors:
numinfo.cc:14:6: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’
before ‘boolvar’
numinfo.cc:19:7: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before
‘enumvar’
numinfo.cc:21:7: error: expected identifier or ‘(’ before ‘&’ token
numinfo.cc:22:21: error: ‘enumvar’ undeclared here (not in a function)
*** WARNING *** there are active plugins, do not report this as a bug unless
you can reproduce it without enabling any plugins.
Event            Plugins
PLUGIN_FINISH_TYPE gcc_dehydra PLUGIN_FINISH_UNIT gcc_dehydra PLUGIN_CXX_CP_PRE_GENERICIZE gcc_dehydra PLUGIN_FINISH gcc_dehydra PLUGIN_EVENT_LAST gcc_dehydra plugin_init gcc_dehydra numinfo.cc:22:1: internal compiler error: tree check: expected class ‘type’,
have ‘exceptional’ (error_mark) in process_type, at dehydra_plugin.c:139
Please submit a full bug report,
with preprocessed source if appropriate.
See <http://gcc.gnu.org/bugs.html> for instructions.

Stuff like FINISH_TYPE, PLUGIN_CXX_CP_PRE_GENERICIZE, etc can end up with error 
nodes instead of what is normally expected to be there.

I can't imagine a usecase for when it would be useful for a plugin to have the error marker node.

As I said, it's a minor polish issue. It may be sufficient to just have a note in the documentation as Basil suggested.


Taras

Reply via email to