From: Brian Behlendorf Date: Thu, 26 Aug 2010 16:52:40 +0000 (-0700) Subject: Fix gcc init pragma warnings X-Git-Tag: zfs-0.5.1~75 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0ccd9d24e4fdbe9cd07f838d0a62083e8eca95f2;p=zfs Fix gcc init pragma warnings Use constructor attribute on non-Solaris platforms. The #pragma init/fini ->__attribute__((constructor/destructor)) conversions, these should go upstream. Signed-off-by: Brian Behlendorf --- diff --git a/lib/libuutil/uu_misc.c b/lib/libuutil/uu_misc.c index 66a6ca569..578bf3294 100644 --- a/lib/libuutil/uu_misc.c +++ b/lib/libuutil/uu_misc.c @@ -249,7 +249,13 @@ uu_release_child(void) uu_release(); } +#ifdef __GNUC__ +static void +uu_init(void) __attribute__((constructor)); +#else #pragma init(uu_init) +#endif + static void uu_init(void) { diff --git a/lib/libzfs/libzfs_mount.c b/lib/libzfs/libzfs_mount.c index 922220620..c31a12371 100644 --- a/lib/libzfs/libzfs_mount.c +++ b/lib/libzfs/libzfs_mount.c @@ -518,8 +518,12 @@ static void (*_sa_update_sharetab_ts)(sa_handle_t); * values to be used later. This is triggered by the runtime loader. * Make sure the correct ISA version is loaded. */ - +#ifdef __GNUC__ +static void +_zfs_init_libshare(void) __attribute__((constructor)); +#else #pragma init(_zfs_init_libshare) +#endif static void _zfs_init_libshare(void) {