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

[PATCH] Warnings/errors while compiling with clang

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 10.0.1
    • Fix Version/s: 10.0.2, 10.0.7
    • Component/s: None
    • Labels:
      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.

        Gliffy Diagrams

          Attachments

            Activity

            Hide
            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?

            Show
            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?
            Hide
            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.

            Show
            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.
            Hide
            pivanof Pavel Ivanov added a comment -

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

            Show
            pivanof Pavel Ivanov added a comment - Sergei, did you decide to drop the changes in include/probes_mysql_nodtrace.h completely?
            Hide
            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.

            Show
            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

              • Assignee:
                serg Sergei Golubchik
                Reporter:
                pivanof Pavel Ivanov
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 4 hours
                  4h