After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 721783 - inline is a C99 keyword, not a GCC extension
inline is a C99 keyword, not a GCC extension
Product: anjuta
Classification: Applications
Component: plugins: symbol-db
git master
Other Linux
: Normal normal
: ---
Assigned To: Massimo Cora'
Anjuta maintainers
Depends on:
Reported: 2014-01-08 12:53 UTC by Ting-Wei Lan
Modified: 2014-01-16 20:57 UTC
See Also:
GNOME target: ---
GNOME version: 3.11/3.12

Simple patch file to fix the error (873 bytes, patch)
2014-01-08 13:09 UTC, Ting-Wei Lan
none Details | Review
Remove GNUC_INLINE (3.09 KB, patch)
2014-01-15 21:15 UTC, Sébastien Granjoux
committed Details | Review

Description Ting-Wei Lan 2014-01-08 12:53:33 UTC
I build anjuta with clang and it fails in `plugins/symbol-db/benchmark/symbol-db':

../../.libs/ error: undefined reference to 'sdb_engine_get_statement_by_query_id'
../../.libs/ error: undefined reference to 'sdb_engine_get_tuple_id_by_unique_name'
clang: error: linker command failed with exit code 1

There are also some relevant warning message:
symbol-db-engine-utils.c:37:1: warning: inline function 'sdb_engine_get_statement_by_query_id' is not defined [-Wundefined-inline]
sdb_engine_get_statement_by_query_id (SymbolDBEngine * dbe, static_query_type query_id);
symbol-db-engine-utils.c:102:14: note: used here
        if ((stmt = sdb_engine_get_statement_by_query_id (dbe,
1 warning generated.

It seems gcc treats the inline keyword as a GCC extension, so gcc will generate a external symbol for the inline function. However, clang treats it as a C99 keyword, so clang does not generate a external symbol for it. Maybe `extern inline' should be used instead.
Comment 1 Ting-Wei Lan 2014-01-08 13:09:09 UTC
Created attachment 265702 [details] [review]
Simple patch file to fix the error
Comment 2 Sébastien Granjoux 2014-01-13 21:45:08 UTC
Thank for reporting this and providing a patch but I'm not sure it's the right fix. I have read that extern inline doesn't have the same meaning in GCC and clang. I'm still searching.
Comment 3 Ting-Wei Lan 2014-01-14 06:19:53 UTC
Can we add AC_PROG_CC_STDC to, so gcc will treats the inline keyword as a C99 keyword?
Comment 4 Allison Karlitskaya (desrt) 2014-01-15 04:55:36 UTC
imho, "inline" should just be dropped here.  Let the compiler's optimiser decide if it wants to do it or not.
Comment 5 Sébastien Granjoux 2014-01-15 21:15:35 UTC
Created attachment 266397 [details] [review]

I think it's better to remove GNUC_INLINE too, so here is a patch doing it.

Ting-Wei can you check that it fixes the issue?

I don't understand why you get an error sdb_engine_get_tuple_id_by_unique_name. This function is used only inside the file symbol-db-engine.core.c
Comment 6 Ting-Wei Lan 2014-01-16 10:20:47 UTC
Yes, the issue can be fixed by the patch.
Comment 7 Sébastien Granjoux 2014-01-16 20:57:09 UTC
Thank you, I have committed the fix in the master branch