Hello,
> It relies on api_directive_list, which is a global char array,
> populated from command line, with something like
> "EXPORT_FOO_API:EXPORT_BAR_API:EXPORT_BAZ_API".
Since it is a issue peculiar to a language, it seems to be
suitable to solve in the parser for the language.
[.api_directive]
+----------------
|EXPORT_FOO_API
|EXPORT_BAR_API
|EXPORT_BAZ_API
|...
[Cpp.c]
+----------------------------------------------
|int
|is_api_directive(const char *token) {
| if (first time)
| load '.api_directive'
| if (token is found in '.api_directive')
| return TRUE;
| else
| return FALSE;
|}
|Cpp() {
| ...
| if (is_api_directive(token))
| ...
|}
I will put this issue into the TODO list. However, it will not
be realized until someone write a patch for it, I think.
Thank you for the report.
~
2014-11-16 23:05 GMT+09:00 Julien Montmartin <[email protected]>
:
> Hello,
>
> I'm using Global on some cross-platform C++ code, and I have an issue with
> exported class such as :
>
> class FOO_API Foo
> {
> //blablalba
> };
>
> Where FOO_API is a compiler specific #define that affect symbol
> visibility, or binding conventions.
>
> The problem here is that gtags expect the class name to follow the "class"
> keyword, and fail to index those class properly (and exported class are
> often important ones !)
>
> I couldn't find any workaround to solve this issue, and I'm note alone :
> it was already reported a few years ago by Ashish :
> http://lists.gnu.org/archive/html/bug-global/2011-05/msg00000.htm
>
> Looking at the code, I found an easy way to fix it. Not sure if it's the
> best way to go, but at least "It works on my machine" ;)
>
> In libparser/Cpp.c, patch void Cpp(const struct parser_param *param) this
> way :
>
> case CPP_CLASS:
> DBG_PRINT(level, "class");
> if ((c = nexttoken(interested, cpp_reserved_word)) == SYMBOL) {
>
> /*beginning of patch : skip predifined API directives*/
>
> if(is_api_directive(token))
> if ((c = nexttoken(interested, cpp_reserved_word)) != SYMBOL)
> break;
>
> /*end of patch*/
>
> strlimcpy(classname, token, sizeof(classname));
> /*
> * Ignore forward definitions.
> * "class name;"
> */
> if (peekc(0) != ';') {
> startclass = 1;
> PUT(PARSER_DEF, token, lineno, sp);
> }
> }
> break;
>
> Where is_api_directive might be defined in the same file this way :
>
> static int is_api_directive(const char* token)
> {
> int res=0;
>
> if(token!=NULL && api_directive_list!=NULL)
> if(strstr(api_directive_list, token)!=NULL)
> res=1;
>
> return res;
> }
>
> It relies on api_directive_list, which is a global char array, populated
> from command line, with something like "EXPORT_FOO_API:EXPORT_BAR_
> API:EXPORT_BAZ_API".
>
> Hope this helps,
>
> Julien
>
>
> _______________________________________________
> Bug-global mailing list
> [email protected]
> https://lists.gnu.org/mailman/listinfo/bug-global
>
--
Shigio YAMAGUCHI <[email protected]>
PGP fingerprint: D1CB 0B89 B346 4AB6 5663 C4B6 3CA5 BBB3 57BE DDA3
_______________________________________________
Bug-global mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/bug-global