[MDEV-9427] Server does not build, my_addr_resolve.c:185:3: error: ‘for’ loop initial declarations are only allowed in C99 mode Created: 2016-01-17  Updated: 2016-01-17  Resolved: 2016-01-17

Status: Closed
Project: MariaDB Server
Component/s: Compiling
Affects Version/s: None
Fix Version/s: 10.1.11

Type: Bug Priority: Blocker
Reporter: Elena Stepanova Assignee: Vicențiu Ciorbaru
Resolution: Fixed Votes: 0
Labels: None


 Description   

cmake . -DCMAKE_BUILD_TYPE=Debug && make

 19%] Building C object mysys/CMakeFiles/mysys.dir/my_addr_resolve.c.o
/src/10.1/mysys/my_addr_resolve.c: In function ‘my_addr_resolve’:
/src/10.1/mysys/my_addr_resolve.c:155:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
   ssize_t total_bytes_read = 0;
   ^
/src/10.1/mysys/my_addr_resolve.c:180:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
   int filename_start = -1;
   ^
/src/10.1/mysys/my_addr_resolve.c:185:3: error: ‘for’ loop initial declarations are only allowed in C99 mode
   for (ssize_t i = 0; i < total_bytes_read; i++) {
   ^
/src/10.1/mysys/my_addr_resolve.c:185:3: note: use option -std=c99 or -std=gnu99 to compile your code
mysys/CMakeFiles/mysys.dir/build.make:2630: recipe for target 'mysys/CMakeFiles/mysys.dir/my_addr_resolve.c.o' failed
make[2]: *** [mysys/CMakeFiles/mysys.dir/my_addr_resolve.c.o] Error 1
CMakeFiles/Makefile2:8099: recipe for target 'mysys/CMakeFiles/mysys.dir/all' failed
make[1]: *** [mysys/CMakeFiles/mysys.dir/all] Error 2
Makefile:160: recipe for target 'all' failed
make: *** [all] Error 2

If I set CFLAGS="-std=gnu99", it goes further, and I get MDEV-9226



 Comments   
Comment by Vicențiu Ciorbaru [ 2016-01-17 ]

I somehow managed to push an old version of the final commit. Fixed

Comment by Vicențiu Ciorbaru [ 2016-01-17 ]

Reverted all the patches but the my_addr_resolv one. There seems to be some failures with those on Windows. I'll have a look at them again.

Generated at Thu Feb 08 07:34:35 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.