Boost logo

Boost :

Subject: Re: [boost] [visibility][test][osx] visibility warnings with 1.70beta
From: Raffi Enficiaud (raffi.enficiaud_at_[hidden])
Date: 2019-03-28 07:56:00

On 27.03.19 20:38, Andrey Semashev via Boost wrote:
> On 3/27/19 10:16 PM, Raffi Enficiaud via Boost wrote:
>> [snip]
> You can add -d+2 to the b2 command line to see the commands it is using
> while building Boost.
> I'm guessing that the compiler is correct in that different visibility
> modes are used for different TUs, since I don't see visibility flags in
> your project's command line and visibility is likely set to hidden when
> building Boost. The particular complaint in the warnings you quoted is
> about the function-local static `null` in
> `basic_cstring<CharT>::null_str()`, which is not explicitly marked as
> visible and therefore has different visibility when it is compiled in
> Boost and your project.
> I suggest changing the code so that `null` is instead a static class
> member of `basic_cstring` and mark it with `BOOST_SYMBOL_VISIBLE`. Also,
> it might make sense to make it a const array instead of a single
> character, and change `null_str` to return a const pointer instead of a
> mutable one.

I am not doing any change to the code that is not related to the warning.

To follow up:

Lessons learned:

* template classes should have their forward declaration with visibility
* local visibility does not work (I do not know if this is the language
or a compiler limitation), so the static variables need to get out. For

static lazy_ostream& instance()
        { BOOST_SYMBOL_VISIBLE static lazy_ostream inst; return inst; }

is not setting the visibility of the static variable.

I guess all those things are compiler specific, and not at all indicated
in the standard?

Thanks for the quick help,

Tests are running, I will need to get this in the next release,

Boost list run by bdawes at, gregod at, cpdaniel at, john at