[Cluster-devel] [PATCH 1/3] fsck.gfs2: Fix 'initializer element is not constant' build error
Bob Peterson
rpeterso at redhat.com
Wed Jan 28 13:09:32 UTC 2015
----- Original Message -----
> This error occurs when gfs2-utils is compiled with -std options more
> recent than gnu89:
>
> CC fsck_gfs2-main.o
> main.c:39:38: error: initializer element is not constant
> struct osi_root dup_blocks = (struct osi_root) { NULL, };
> ^
> main.c:40:35: error: initializer element is not constant
> struct osi_root dirtree = (struct osi_root) { NULL, };
> ^
> main.c:41:37: error: initializer element is not constant
> struct osi_root inodetree = (struct osi_root) { NULL, };
> ^
> As far as I can tell, with C89/gnu89 the use of a cast in this context
> is undefined behaviour and the later standards are more strict about it,
> hence the error. As the standards specify that members of objects with
> static storage duration are zeroed/NULLed anyway, the initializers can
> be removed to achieve the intended result.
>
> Signed-off-by: Andrew Price <anprice at redhat.com>
> ---
ACK
Bob Peterson
Red Hat File Systems
More information about the Cluster-devel
mailing list