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

    • Bug
    • Status: Closed (View Workflow)
    • Blocker
    • Resolution: Fixed
    • None
    • 10.1.11
    • Compiling
    • 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

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

            Dates

              Created:
              Updated:
              Resolved:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.