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

Overloaded functions dbug_print_rec break compilation in 10.3

Details

    Description

      Implementations of overloaded standalone functions dbug_print_rec, located in the file storage/innobase/ut/ut0ut.cc, return pointer to a temporary allocated memory. In result attempt to compile server on MacOS fails with error

      [ 18%] Building CXX object storage/innobase/CMakeFiles/innobase.dir/ut/ut0ut.cc.o
      10.3/storage/innobase/ut/ut0ut.cc:635:9: error: returning address
            of local temporary object [-Werror,-Wreturn-stack-address]
              return r.str().c_str();
                     ^~~~~~~
      10.3/storage/innobase/ut/ut0ut.cc:641:9: error: returning address
            of local temporary object [-Werror,-Wreturn-stack-address]
              return r.str().c_str();
                     ^~~~~~~
      10.3/storage/innobase/ut/ut0ut.cc:647:9: error: returning address
            of local temporary object [-Werror,-Wreturn-stack-address]
              return r.str().c_str();
                     ^~~~~~~
      10.3/storage/innobase/ut/ut0ut.cc:653:9: error: returning address
            of local temporary object [-Werror,-Wreturn-stack-address]
              return r.str().c_str();
                     ^~~~~~~
      10.3/storage/innobase/ut/ut0ut.cc:665:9: error: returning address
            of local temporary object [-Werror,-Wreturn-stack-address]
              return r.str().c_str();
                     ^~~~~~~
      5 errors generated.
      

      The overloaded function dbug_print_rec() isn't used anywhere along the source code.
      So, it is proposed to remove them at all.

      Attachments

        Issue Links

          Activity

            shulga Dmitry Shulga created issue -
            serg Sergei Golubchik made changes -
            Field Original Value New Value
            Description Implementations of overloaded standalone functions dbug_print_rec, located in the file storage/innobase/ut/ut0ut.cc, return pointer to a temporary allocated memory. In result attempt to compile server on MacOS fails with error

            [ 18%] Building CXX object storage/innobase/CMakeFiles/innobase.dir/ut/ut0ut.cc.o
            10.3/storage/innobase/ut/ut0ut.cc:635:9: error: returning address
                  of local temporary object [-Werror,-Wreturn-stack-address]
                    return r.str().c_str();
                           ^~~~~~~
            10.3/storage/innobase/ut/ut0ut.cc:641:9: error: returning address
                  of local temporary object [-Werror,-Wreturn-stack-address]
                    return r.str().c_str();
                           ^~~~~~~
            10.3/storage/innobase/ut/ut0ut.cc:647:9: error: returning address
                  of local temporary object [-Werror,-Wreturn-stack-address]
                    return r.str().c_str();
                           ^~~~~~~
            10.3/storage/innobase/ut/ut0ut.cc:653:9: error: returning address
                  of local temporary object [-Werror,-Wreturn-stack-address]
                    return r.str().c_str();
                           ^~~~~~~
            10.3/storage/innobase/ut/ut0ut.cc:665:9: error: returning address
                  of local temporary object [-Werror,-Wreturn-stack-address]
                    return r.str().c_str();
                           ^~~~~~~
            5 errors generated.

            The overloaded function dbug_print_rec() isn't used anywhere along the source code.
            So, it is proposed to remove them at all.
            Implementations of overloaded standalone functions dbug_print_rec, located in the file storage/innobase/ut/ut0ut.cc, return pointer to a temporary allocated memory. In result attempt to compile server on MacOS fails with error
            {noformat}
            [ 18%] Building CXX object storage/innobase/CMakeFiles/innobase.dir/ut/ut0ut.cc.o
            10.3/storage/innobase/ut/ut0ut.cc:635:9: error: returning address
                  of local temporary object [-Werror,-Wreturn-stack-address]
                    return r.str().c_str();
                           ^~~~~~~
            10.3/storage/innobase/ut/ut0ut.cc:641:9: error: returning address
                  of local temporary object [-Werror,-Wreturn-stack-address]
                    return r.str().c_str();
                           ^~~~~~~
            10.3/storage/innobase/ut/ut0ut.cc:647:9: error: returning address
                  of local temporary object [-Werror,-Wreturn-stack-address]
                    return r.str().c_str();
                           ^~~~~~~
            10.3/storage/innobase/ut/ut0ut.cc:653:9: error: returning address
                  of local temporary object [-Werror,-Wreturn-stack-address]
                    return r.str().c_str();
                           ^~~~~~~
            10.3/storage/innobase/ut/ut0ut.cc:665:9: error: returning address
                  of local temporary object [-Werror,-Wreturn-stack-address]
                    return r.str().c_str();
                           ^~~~~~~
            5 errors generated.
            {noformat}
            The overloaded function dbug_print_rec() isn't used anywhere along the source code.
            So, it is proposed to remove them at all.

            no, they are supposed to be used from the gdb prompt, don't remove.
            typically other dbug_print* functions use a static buffer. Like

            #ifndef DBUG_OFF
            char dbug_print_buffer[1024];
            const char *dbug_print_rec(...)
            {
              strmake(dbug_print_buffer, r.str().c_str(), sizeof(dbug_print_buffer)-1);
              return dbug_print_buffer;
            }
            

            serg Sergei Golubchik added a comment - no, they are supposed to be used from the gdb prompt, don't remove. typically other dbug_print* functions use a static buffer. Like #ifndef DBUG_OFF char dbug_print_buffer[1024]; const char *dbug_print_rec(...) { strmake(dbug_print_buffer, r.str().c_str(), sizeof (dbug_print_buffer)-1); return dbug_print_buffer; }
            serg Sergei Golubchik made changes -
            Fix Version/s 10.3 [ 22126 ]
            midenok Aleksey Midenkov made changes -
            midenok Aleksey Midenkov made changes -
            Component/s Debug [ 14208 ]
            Component/s Storage Engine - InnoDB [ 10129 ]
            midenok Aleksey Midenkov made changes -
            Environment MacOS
            midenok Aleksey Midenkov made changes -
            Fix Version/s 10.3.28 [ 25111 ]
            Fix Version/s 10.3 [ 22126 ]
            Resolution Fixed [ 1 ]
            Status Open [ 1 ] Closed [ 6 ]
            serg Sergei Golubchik made changes -
            Workflow MariaDB v3 [ 117318 ] MariaDB v4 [ 158727 ]

            People

              midenok Aleksey Midenkov
              shulga Dmitry Shulga
              Votes:
              0 Vote for this issue
              Watchers:
              2 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.