Re: [cedet-semantic] Problem with multi-line macros
Brought to you by:
zappo
From: Eric M. L. <er...@si...> - 2008-03-26 02:42:09
|
Oy, that's dreadful. The macro expansion support works by substituting in lexical tokens that overlap the location of where the substitution occurs. If they didn't overlap that space, none of the positioning of tag overlays would ever work. The C parser works by parsing the contents of parentheticals at the last minute, such as { } or ( ). Parsing at that location re-expands the macro. Instant problem. I checked in a new version of semantic-c.el which overloads semantic-parse-region. The overload identifies when we are in a macro expansion, and short-circuits the recursion. To make the expansion valid, it would need to do something pretty clever, since we'd need the parser to generate tags that did not have overlays. That sounds like a really big job I don't want to do... sort of like running the debugger against pre-processor macros. ;) Are you on this mailing list? I keep getting bounce notifications. Eric >>> Ravikiran Rajagopal <rav...@am...> seems to think that: >Hello, > The following code in a header file causes CVS HEAD to choke on parsing: > >--------------------------- >#include <stdexcept> >typedef long long Clock_t; > >#define ET_DEFINE_EXCEPTION( e, b ) \ > struct e : public b \ > { \ > e( const std::string &w = std::string( "" ) ) : b( w ) {} \ > } > >ET_DEFINE_EXCEPTION( MyException, std::runtime_error ); >Cl // <-- semantic-complete-analyze-inline invoked here >--------------------------- > >Semantic seems to choke on multi-line macros with arguments. This specific >macro above is even worse; if the macro is condensed to one line, emacs >freezes (C-g does not work) and has to be killed from outside. > >Regards, >Ravi > -- Eric Ludlam: er...@si... Siege: www.siege-engine.com Emacs: http://cedet.sourceforge.net |