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

[PATCH] Warnings/errors while compiling with clang

Details

    • Bug
    • Status: Closed (View Workflow)
    • Major
    • Resolution: Fixed
    • 10.0.1
    • 10.0.2, 10.0.7
    • None
    • None

    Description

      Please consider the attached patch that fixes compilation warnings (that turn into errors with -Werror) occurring when compiling MariaDB 10.0.1 with clang. Feel free to adjust it if you think that some warnings should be fixed differently.

      Attachments

        Activity

          I've applied most of your patches.
          I didn't apply changes to include/probes_mysql_nodtrace.h, sql/item.cc, sql/unireg.cc.

          Could you please clarify what warnings exactly did you get there?

          serg Sergei Golubchik added a comment - I've applied most of your patches. I didn't apply changes to include/probes_mysql_nodtrace.h, sql/item.cc, sql/unireg.cc. Could you please clarify what warnings exactly did you get there?
          pivanof Pavel Ivanov added a comment -

          For include/probes_mysql_nodtrace.h: in the places where these macros are used there was a warning "Logical || on a numeric constant" (I don't remember the exact wording but something like that).

          For sql/item.cc: "memcpy on a class with virtual table" – really bad thing. It should have different, more elaborate fix but I realized that knowing intrinsics of how virtual table is represented inside the class layout it's good enough to have such fix in this place. But if you want to Do The Right Thing you should do something better than that.

          For sql/unireg.cc: "accessing array element with negative index". clang somehow doesn't understand that there's conversion to unsigned char here, but converting to unsigned int with masking only lower byte works.

          pivanof Pavel Ivanov added a comment - For include/probes_mysql_nodtrace.h: in the places where these macros are used there was a warning "Logical || on a numeric constant" (I don't remember the exact wording but something like that). For sql/item.cc: "memcpy on a class with virtual table" – really bad thing. It should have different, more elaborate fix but I realized that knowing intrinsics of how virtual table is represented inside the class layout it's good enough to have such fix in this place. But if you want to Do The Right Thing you should do something better than that. For sql/unireg.cc: "accessing array element with negative index". clang somehow doesn't understand that there's conversion to unsigned char here, but converting to unsigned int with masking only lower byte works.
          pivanof Pavel Ivanov added a comment -

          Sergei, did you decide to drop the changes in include/probes_mysql_nodtrace.h completely?

          pivanof Pavel Ivanov added a comment - Sergei, did you decide to drop the changes in include/probes_mysql_nodtrace.h completely?

          I believe back then I only applied changes that either I was able to repeat, or those that made perfect sense without a compiler. Now we have freebsd with clang, so I'll try your patch again.

          serg Sergei Golubchik added a comment - I believe back then I only applied changes that either I was able to repeat, or those that made perfect sense without a compiler. Now we have freebsd with clang, so I'll try your patch again.

          People

            serg Sergei Golubchik
            pivanof Pavel Ivanov
            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.