Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-9427

Server does not build, my_addr_resolve.c:185:3: error: ‘for’ loop initial declarations are only allowed in C99 mode

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed (View Workflow)
    • Priority: Blocker
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 10.1.11
    • Component/s: Compiling
    • 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

        Attachments

          Activity

            People

            Assignee:
            cvicentiu Vicențiu Ciorbaru
            Reporter:
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Git Integration