Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Inline template function instances #50

Merged
merged 1 commit into from Feb 19, 2013

Conversation

Projects
None yet
2 participants
Contributor

jpf91 commented Feb 19, 2013

Functions which are marked as DECL_WEAK are not inlined by gcc as
they could be replaced with a completely different implementation
at link time.

We know that our template instances will always be identical so
they should be inlined. The solution is to mark the template
function instance as DECL_DECLARED_INLINE_P as it's also done in
C++.

This also applies to DECL_ONE_ONLY functions as make_decl_one_only
also sets DECL_WEAK.

Related discussion on gcc-list:
http://article.gmane.org/gmane.comp.gcc.devel/130242

@jpf91 jpf91 Inline template function instances
Functions which are marked as DECL_WEAK are not inlined by gcc as
they could be replaced with a completely different implementation
at link time.

We know that our template instances will always be identical so
they should be inlined. The solution is to mark the template
function instance as DECL_DECLARED_INLINE_P as it's also done in
C++.

This also applies to DECL_ONE_ONLY functions as make_decl_one_only
also sets DECL_WEAK.

Related discussion on gcc-list:
http://article.gmane.org/gmane.comp.gcc.devel/130242
15d4663
Owner

ibuclaw commented Feb 19, 2013

Looks fine to me.

@ibuclaw ibuclaw added a commit that referenced this pull request Feb 19, 2013

@ibuclaw ibuclaw Merge pull request #50 from jpf91/inlineTemplates
Inline template function instances
af01eed

@ibuclaw ibuclaw merged commit af01eed into D-Programming-GDC:master Feb 19, 2013

@jpf91 jpf91 deleted the jpf91:inlineTemplates branch Feb 19, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment