Bug #111614 clang 12 warns about string concatenation in my_handler_errors.h
Submitted: 28 Jun 2023 23:55 Modified: 2 Aug 2023 22:31
Reporter: Mark Callaghan Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:5.7, 8.0 OS:Any
Assigned to: CPU Architecture:Any

[28 Jun 2023 23:55] Mark Callaghan
Description:
clang 12 with -Wstring-concatenation complains about this line because one entry spans two lines and uses string concatenation. When using -Werror -Wstring-concatenation then the build fails.

The line in question is here:
https://github.com/mysql/mysql-server/blob/ea7087d885006918ad54458e7aad215b1650312c/mysys/...

This is not a bug in upstream MySQL. This might be an overzealous warning. But a small bit of busy work on your part might save a few people from wasting time chasing down broken builds.

The warning text is repeated here:
https://clang.llvm.org/docs/DiagnosticsReference.html#wstring-concatenation

"warning: suspicious concatenation of string literals in an array initialization; did you mean to separate the elements with a comma?"

One way to fix this is here:
https://github.com/facebook/mysql-5.6/blob/76145e1afee877d5e1d50449755d47dce250da14/mysys/...

How to repeat:
Build with clang, -Werror and -Wstring-concatenation

Note, I didn't add -Wstring-concatenation by choice and I am still trying to understand what added it.

Suggested fix:
Edit the line in question.
[29 Jun 2023 8:40] MySQL Verification Team
Hello Mark,

Thank you for the report and feedback!

Thanks,
Umesh
[30 Jun 2023 13:40] Tor Didriksen
Posted by developer:
 
It's confusing, I am not able to reproduce.
But it makes sense to change those lines anyways.
[2 Aug 2023 22:31] Philip Olson
Posted by developer:
 
Fixed as of the upcoming MySQL Server 8.0.35/8.2.0 releases, and here's the proposed changelog entry from the documentation team:

Fixed a string concatenation warning produced when compiling with Clang
12.

Thank you for the bug report.