From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bob Peterson Date: Wed, 28 Jan 2015 08:09:32 -0500 (EST) Subject: [Cluster-devel] [PATCH 1/3] fsck.gfs2: Fix 'initializer element is not constant' build error In-Reply-To: <1422373935-19184-1-git-send-email-anprice@redhat.com> References: <1422373935-19184-1-git-send-email-anprice@redhat.com> Message-ID: <1175730561.2636038.1422450572583.JavaMail.zimbra@redhat.com> List-Id: To: cluster-devel.redhat.com MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit ----- 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 > --- ACK Bob Peterson Red Hat File Systems