Thread: [cedet-semantic] class __declspec() name parsing error
Brought to you by:
zappo
From: Johan A. G. <je...@ne...> - 2003-05-22 17:34:36
|
I've been using semantic for a little while, and I have run into a problem with my C++ classes. As I am sure you all know, when developing for windows, you export classes from dll's by using this construct: class __declspec(dllexport) classname { }; and similarly you import with: class __declspec(dllimport) classname { }; The __declspec() causes semantic to underline the entire contents of the class declaration (which is kind of unreadable), presumably because it looks like garbage to it. In addition, I develop for cross-platform applications, so I actually have a macro for the import/export, so that depending on the target (.exe or .dll) the macro (on win32) is: #ifdef BUILD_DLL #define EXPORT_DECL __declspec(dllexport) #else #define EXPORT_DECL __declspec(dllimport) #endif I have taken a poke around in c.bnf, but I cannot see any obvious place to add something to handle the case, and I am a pretty weak lisp programmer.... It seems that what is needed is a generalized mechanism for handling an arbitrary token (defined through some add-to-list?) after the class keyword. Any suggestions? Thanks Johan -- Your favorite stores, helpful shopping tools and great gift ideas. Experience the convenience of buying online with Shop@Netscape! http://shopnow.netscape.com/ |
From: Eric M. L. <er...@si...> - 2003-05-22 19:36:28
|
>>> "Johan A. Grape" <je...@ne...> seems to think that: > >I've been using semantic for a little while, and I have run into a >problem with my C++ classes. > >As I am sure you all know, when developing for windows, you export >classes from dll's by using this construct: > >class __declspec(dllexport) classname >{ > > >}; > >and similarly you import with: > >class __declspec(dllimport) classname >{ > > >}; > >The __declspec() causes semantic to underline the entire contents of the >class declaration (which is kind of unreadable), presumably because it >looks like garbage to it. > >In addition, I develop for cross-platform applications, so I actually >have a macro for the import/export, so that depending on the target >(.exe or .dll) the macro (on win32) is: > >#ifdef BUILD_DLL >#define EXPORT_DECL __declspec(dllexport) >#else >#define EXPORT_DECL __declspec(dllimport) >#endif > >I have taken a poke around in c.bnf, but I cannot see any obvious place >to add something to handle the case, and I am a pretty weak lisp >programmer.... > >It seems that what is needed is a generalized mechanism for handling an >arbitrary token (defined through some add-to-list?) after the class keyword. [ ... ] For a quick fix in semantic 1.4, you can probably do this: (add-to-list 'semantic-flex-c-extensions '("^\\(EXPORT_DECL\\)$" . semantic-flex-backslash-newline)) and so-on for anything you would like it to just ignore. the weird function in that list happens to be a function that will ignore the syntactic match. Eric -- Eric Ludlam: za...@gn..., er...@si... Home: http://www.ludlam.net Siege: www.siege-engine.com Emacs: http://cedet.sourceforge.net GNU: www.gnu.org |