This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: -fvisibility-inlines-hidden not hiding inline methods?


Lassi Tuura <lat@cern.ch> writes:

>> -fvisibility-inlines-hidden only affects inline methods.  It does not
>> affect inline functions which are not methods.  E.g., your test cases
>> uses std::sort, but std::sort is not an inline method of any  class.
>> In
>> general -fvisibility-inlines-hidden does not apply to template
>> instantiations, since that would break explicit instantiations.
>
> Thanks. We do see this happening for members as well such as
> std::vector<T>::_M_insert_aux. Do I understand you correctly the
> option only applies to non-template inline member functions? That
> would be unfortunate as we have by far more template-generated inline
> goo than other origins :-/
> 
> Is there any way to override the above restriction to apply to all
> inlines - or at least templates and out-of-class free functions
> included - and/or would a patch to enable such behaviour be accepted?
> Should one expect any major drawbacks for such a change on pretty bog
> standard C++ use, such as standard library or boost?
>
> Is different visibility for template specialisations common for those
> that use the option? I couldn't think of any construct in our code
> that would call for it, and was wondering if there were examples of
> how it's used elsewhere so that I don't misunderstand this feature.

I think you understand me correctly.  The problem with templates is that
changing the visibility will break explicit instantiation--that is,
-fvisibility-inlines-hidden will always work as long as you don't
compare function pointers.  I think it would be OK to have an option
which says that you also promise not to use explicit instantiation.

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]