[MDEV-4243] [PATCH] Warnings/errors while compiling with clang Created: 2013-03-05  Updated: 2013-12-12  Resolved: 2013-12-12

Status: Closed
Project: MariaDB Server
Component/s: None
Affects Version/s: 10.0.1
Fix Version/s: 10.0.2, 10.0.7

Type: Bug Priority: Major
Reporter: Pavel Ivanov Assignee: Sergei Golubchik
Resolution: Fixed Votes: 0
Labels: None

Attachments: Text File patch.txt    

 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.



 Comments   
Comment by Sergei Golubchik [ 2013-03-28 ]

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?

Comment by Pavel Ivanov [ 2013-03-28 ]

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.

Comment by Pavel Ivanov [ 2013-09-30 ]

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

Comment by Sergei Golubchik [ 2013-10-23 ]

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.

Generated at Thu Feb 08 06:54:54 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.