public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Taras Glek <taras.glek@gmail.com>
To: Diego Novillo <dnovillo@google.com>
Cc: gcc@gcc.gnu.org
Subject: Re: plugin callbacks after compiler errors
Date: Wed, 10 Jun 2009 02:14:00 -0000	[thread overview]
Message-ID: <4A2F1506.5090905@gmail.com> (raw)
In-Reply-To: <b798aad50906091512h7ebe75aai361d12378530af37@mail.gmail.com>

Diego Novillo wrote:
> On Tue, Jun 9, 2009 at 15:33, Taras Glek<taras.glek@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	other threads:[~2009-06-10  2:14 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-09 19:33 Taras Glek
2009-06-09 19:45 ` Basile STARYNKEVITCH
2009-06-09 22:12 ` Diego Novillo
2009-06-10  2:14   ` Taras Glek [this message]
2009-06-15 13:32     ` Rafael Espindola
2009-06-15 13:43       ` Diego Novillo
2009-06-15 14:30       ` Basile STARYNKEVITCH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A2F1506.5090905@gmail.com \
    --to=taras.glek@gmail.com \
    --cc=dnovillo@google.com \
    --cc=gcc@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).