[FFmpeg-devel] [PATCH 1/2] libavutil: Add av_visibility_hidden for setting hidden symbol visibility

Andreas Rheinhardt andreas.rheinhardt at outlook.com
Mon Jul 11 13:57:32 EEST 2022


Martin Storsjö:
> On Mon, 11 Jul 2022, Andreas Rheinhardt wrote:
> 
>> Martin Storsjö:
>>> Signed-off-by: Martin Storsjö <martin at martin.st>
>>> ---
>>>  doc/APIchanges         | 3 +++
>>>  libavutil/attributes.h | 6 ++++++
>>>  libavutil/version.h    | 2 +-
>>>  3 files changed, 10 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/doc/APIchanges b/doc/APIchanges
>>> index 20b944933a..5d84bc27d7 100644
>>> --- a/doc/APIchanges
>>> +++ b/doc/APIchanges
>>> @@ -14,6 +14,9 @@ libavutil:     2021-04-27
>>>
>>>  API changes, most recent first:
>>>
>>> +2022-xx-xx - xxxxxxxxxx - lavu 57.28.100 - attributes.h
>>> +  Add av_visibility_hidden, for setting hidden visibilty on symbols.
>>> +
>>>  2022-06-12 - xxxxxxxxxx - lavf 59.25.100 - avio.h
>>>    Add avio_vprintf(), similar to avio_printf() but allow to use it
>>>    from within a function taking a variable argument list as input.
>>> diff --git a/libavutil/attributes.h b/libavutil/attributes.h
>>> index 04c615c952..dc4c88932c 100644
>>> --- a/libavutil/attributes.h
>>> +++ b/libavutil/attributes.h
>>> @@ -170,4 +170,10 @@
>>>  #    define av_noreturn
>>>  #endif
>>>
>>> +#if (AV_GCC_VERSION_AT_LEAST(4,0) || defined(__clang__)) &&
>>> (defined(__ELF__) || defined(__MACH__))
>>> +#    define av_visibility_hidden __attribute__((visibility("hidden")))
>>> +#else
>>> +#    define av_visibility_hidden
>>> +#endif
>>> +
>>>  #endif /* AVUTIL_ATTRIBUTES_H */
>>> diff --git a/libavutil/version.h b/libavutil/version.h
>>> index 2e9e02dda8..87178e9e9a 100644
>>> --- a/libavutil/version.h
>>> +++ b/libavutil/version.h
>>> @@ -79,7 +79,7 @@
>>>   */
>>>
>>>  #define LIBAVUTIL_VERSION_MAJOR  57
>>> -#define LIBAVUTIL_VERSION_MINOR  27
>>> +#define LIBAVUTIL_VERSION_MINOR  28
>>>  #define LIBAVUTIL_VERSION_MICRO 100
>>>
>>>  #define LIBAVUTIL_VERSION_INT  
>>> AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \
>>
>> Hidden stuff is by definition not part of installed headers, so that
>> there is no point in adding a public define for this.
> 
> Good point - attribute.h would otherwise have been the natural spot, but
> I agree that it'd be better to not make it public at all. In what header
> would you prefer to have it?
> 

The typical place we put such things is libavutil/internal.h.

- Andreas


More information about the ffmpeg-devel mailing list