[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Acl-devel] [RFC] Add attribute visibility("default") to API functio
From: |
Mike Frysinger |
Subject: |
Re: [Acl-devel] [RFC] Add attribute visibility("default") to API functions |
Date: |
Thu, 11 Feb 2016 18:30:16 -0500 |
On 11 Feb 2016 19:50, Yury Usishchev wrote:
> I am trying to make acl build with -fvisibility=hidden possible. For that API
> functions (that are used externally)
> should be marked with __attribute__((visibility("default"))).
we already use hidden visibility in include/misc.h, so if we want to
invert the meaning, you'll need to update that too.
> --- a/include/acl.h
> +++ b/include/acl.h
> @@ -27,6 +27,17 @@
> extern "C" {
> #endif
>
> +/* Define for visibility */
> +#if defined _WIN32 || defined __CYGWIN__
> + #define API_EXPORT
> +#else
> + #if __GNUC__ >= 4
> + #define API_EXPORT __attribute__ ((visibility ("default")))
> + #else
> + #define API_EXPORT
> + #endif
> +#endif
do not indent the # w/cpp. that should always be in col 0. e.g.
#if ...
# define ...
#else
# if ........
that said, i don't think this is the right route. it'd be better imo:
(1) name it ACL_API_EXPORT
(2) just do in acl.h:
#ifndef ACL_API_EXPORT
# define ACL_API_EXPORT extern
#endif
(3) update config.h to define ACL_API_EXPORT to default visiblity
(4) update configure.ac to test for the flag directly -- we already have
the m4/visibility_hidden.m4 file in the codebase for this
since all our source files should be including config.h first, we
then know the macro will be defined before pulling in acl.h.
> --- a/libacl/acl_calc_mask.c
> +++ b/libacl/acl_calc_mask.c
>
> -int
> +API_EXPORT int
> acl_calc_mask(acl_t *acl_p)
there's no need to enumerate the definitions themselves. just the
prototype is sufficient.
-mike
signature.asc
Description: Digital signature
- [Acl-devel] [RFC] Add attribute visibility("default") to API functions, Yury Usishchev, 2016/02/11
- Re: [Acl-devel] [RFC] Add attribute visibility("default") to API functions,
Mike Frysinger <=
- Re: [Acl-devel] [RFC] Add attribute visibility("default") to API functions, Andreas Grünbacher, 2016/02/11
- Re: [Acl-devel] [RFC] Add attribute visibility("default") to API functions, Yury Usishchev, 2016/02/12
- Re: [Acl-devel] [RFC] Add attribute visibility("default") to API functions, Mike Frysinger, 2016/02/12
- Re: [Acl-devel] [RFC] Add attribute visibility("default") to API functions, Yury Usishchev, 2016/02/15
- Re: [Acl-devel] [RFC] Add attribute visibility("default") to API functions, Mike Frysinger, 2016/02/15
- Re: [Acl-devel] [RFC] Add attribute visibility("default") to API functions, Yury Usishchev, 2016/02/15
- Re: [Acl-devel] [RFC] Add attribute visibility("default") to API functions, Mike Frysinger, 2016/02/15
- Re: [Acl-devel] [RFC] Add attribute visibility("default") to API functions, Yury Usishchev, 2016/02/15