After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 781298 - gfileutils.c:330:3: error: ISO C90 forbids mixed declarations and code
gfileutils.c:330:3: error: ISO C90 forbids mixed declarations and code
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: win32
2.52.x
Other Windows
: Normal major
: ---
Assigned To: gtk-win32 maintainers
gtk-win32 maintainers
Depends on:
Blocks:
 
 
Reported: 2017-04-14 02:10 UTC by John Lindgren
Modified: 2017-04-18 06:33 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Fix build error (1022 bytes, patch)
2017-04-14 02:32 UTC, John Lindgren
accepted-commit_now Details | Review

Description John Lindgren 2017-04-14 02:10:54 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
Comment 1 John Lindgren 2017-04-14 02:32:27 UTC
Created attachment 349845 [details] [review]
Fix build error
Comment 2 LRN 2017-04-14 05:21:21 UTC
Review of attachment 349845 [details] [review]:

Looks fine.
Comment 3 LRN 2017-04-14 05:29:55 UTC
Attachment 349845 [details] pushed into master as commit 7641cf2.
Comment 4 Daniel Boles 2017-04-14 06:46:11 UTC
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.
Comment 5 LRN 2017-04-14 07:03:45 UTC
Huh, i didn't get that memo. And glib configure.ac explicitly adds the -Werror=declaration-after-statement flag.
Comment 6 Daniel Boles 2017-04-14 08:10:38 UTC
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.)
Comment 7 Fan, Chun-wei 2017-04-18 06:33:51 UTC
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!