GNOME Bugzilla – Bug 781298
gfileutils.c:330:3: error: ISO C90 forbids mixed declarations and code
Last modified: 2017-04-18 06:33:51 UTC
GLib fails to build with the following error: gfileutils.c: In function 'g_file_test_utf8': gfileutils.c:330:3: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement] int attributes; ^~~ cc1.exe: some warnings being treated as errors OS: Windows 10 $ gcc --version gcc.exe (Rev2, Built by MSYS2 project) 6.3.0
Created attachment 349845 [details] [review] Fix build error
Review of attachment 349845 [details] [review]: Looks fine.
Attachment 349845 [details] pushed into master as commit 7641cf2.
I thought this was going to be allowed in the new versions: https://wiki.gnome.org/Projects/GLib/CompilerRequirements > Selected C99 features > > Starting with GLib 2.52 and GTK+ 3.90, we will be using the following C99 > features where appropriate: > > Compound literals > Designated initializers > Mixed declarations If mixed declarations are no longer allowed, then someone should fix that page.
Huh, i didn't get that memo. And glib configure.ac explicitly adds the -Werror=declaration-after-statement flag.
Hmm, I guess either usage of mixed declarations hasn't formally started yet, or the decision has been changed but the wiki not updated. (I've definitely seen designated initialisers in use, particular in the initialiser-heavy Vulkan code, and I'm 99% sure I've seen compound literals also.)
Hi, I pushed this patch into glib-2-52 as 7641cf2, since 2.52.0 builds normally on C89 compilers, so I don't think we want to bump compiler requirements within a stable release series (I am aware of the wiki page, but since that did not happen for 2.52.0...). The compound literals did indeed show up for GTK+-3.89.x, and so that was why I removed the 2012 (and earlier) Visual Studio projects. With blessings, and cheers!