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 614326 - Ensure that G_INLINE_FUNC functions are used inline internally
Ensure that G_INLINE_FUNC functions are used inline internally
Status: RESOLVED DUPLICATE of bug 757374
Product: glib
Classification: Platform
Component: general
2.24.x
Other All
: Normal enhancement
: ---
Assigned To: gtkdev
gtkdev
Depends on:
Blocks:
 
 
Reported: 2010-03-30 06:19 UTC by Mikhail Zabaluev
Modified: 2017-11-21 12:49 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
The patch (9.69 KB, patch)
2010-03-30 13:25 UTC, Mikhail Zabaluev
none Details | Review
Include ginline.h in the master glib header (755 bytes, patch)
2010-04-04 09:26 UTC, Mikhail Zabaluev
none Details | Review
Added a script to check that ginline.c includes all headers with G_INLINE_FUNC (1.94 KB, patch)
2010-04-04 09:27 UTC, Mikhail Zabaluev
none Details | Review

Description Mikhail Zabaluev 2010-03-30 06:19:13 UTC
The current pattern of implementing non-inline emissions of functions defined with G_INLINE_FUNC is faulty: G_IMPLEMENT_INLINES is defined in ordinary source files that have some other code, which can use the affected functions. This may lead to suboptimal use of non-inline instances inside GLib.
Comment 1 Mikhail Zabaluev 2010-03-30 06:21:52 UTC
http://git.collabora.co.uk/?p=user/zabaluev/glib.git;a=shortlog;h=refs/heads/implement-inlines

This change consigns all non-inline emissions for functions declared with G_INLINE_FUNC to one dedicated source file, to make sure no other source file needs to have G_IMPLEMENT_INLINES defined and possibly ends up using non-inlined implementations of these functions inside the library.
Comment 2 Colin Walters 2010-03-30 13:17:04 UTC
So the problem here is that inside glib, the compiler may choose to use the non-inline version rather than inlining?

Can you please attach a "git format-patch" series of patches rather than linking to a git repository?  "git bz" ( http://blog.fishsoup.net/2008/11/16/git-bz-bugzilla-subcommand-for-git/ ) makes it easy to keep a Bugzilla bug in sync with a git series.
Comment 3 Mikhail Zabaluev 2010-03-30 13:25:40 UTC
Created attachment 157483 [details] [review]
The patch
Comment 4 Mikhail Zabaluev 2010-03-30 13:26:49 UTC
(In reply to comment #2)
> So the problem here is that inside glib, the compiler may choose to use the
> non-inline version rather than inlining?

Yes.

> Can you please attach a "git format-patch" series of patches rather than
> linking to a git repository?

Done; there is only one commit.
Comment 5 Behdad Esfahbod 2010-03-30 19:58:12 UTC
1. Can we avoid having G_IMPLEMENT_INLINES in the header files?  Something like this for example:

ginline.c:

#include <ginline.h>
=====================

#undef inline
#define inline

#include <gthread.h>
---------------------

2. Can you add a test to make sure all headers with inline functions are included in ginline.c?  Shee various check.sh scripts in glib/glib/.
Comment 6 Mikhail Zabaluev 2010-03-30 21:02:40 UTC
(In reply to comment #5)
> 1. Can we avoid having G_IMPLEMENT_INLINES in the header files?  Something like
> this for example:
> 
> ginline.c:
> 
> #include <ginline.h>
> =====================
> 
> #undef inline
> #define inline
> 
> #include <gthread.h>
> ---------------------

It's not only about the inline keyword, the non-inline definition of G_INLINE_FUNC sheds 'static' linkage as well.
Comment 7 Mikhail Zabaluev 2010-04-04 09:26:11 UTC
Created attachment 157859 [details] [review]
Include ginline.h in the master glib header
Comment 8 Mikhail Zabaluev 2010-04-04 09:27:06 UTC
Created attachment 157860 [details] [review]
Added a script to check that ginline.c includes all headers with G_INLINE_FUNC
Comment 9 Mikhail Zabaluev 2010-04-04 09:43:20 UTC
(In reply to comment #5)
> 2. Can you add a test to make sure all headers with inline functions are
> included in ginline.c?  Shee various check.sh scripts in glib/glib/.

I have attached my attempt as attachment #157860 [details].
Comment 10 Philip Withnall 2017-11-21 12:49:33 UTC
These patches are all redundant, since this was fixed in bug #757374. Sorry for the delay in reviewing them.

If there are still problems with inline support inside/outside GLib, please re-open this bug. Thanks.

*** This bug has been marked as a duplicate of bug 757374 ***