Bug #88041 Avoid C++ comments in mysql C headers
Submitted: 10 Oct 2017 7:31 Modified: 12 Oct 2017 9:57
Reporter: Sebastien FLAESCH Email Updates:
Status: Won't fix Impact on me:
Category:MySQL Server: C API (client library) Severity:S3 (Non-critical)
Version:8.0.3 OS:Any
Assigned to: CPU Architecture:Any
Tags: C++, comments, compiler, header, libmysqlclient, warnings

[10 Oct 2017 7:31] Sebastien FLAESCH
The C headers in include directory contain C++ style comments with //

When compiling with gcc -Wall -Werror to make sure that any mistake stops the compilation of our C code.

When including MySQL C headers we get:

...... error: C++ style comments are not allowed in ISO C90 [-Werror]

Can you please use only C style comments in .h headers, designed for C code?


How to repeat:
Compile with gcc -Wall -Werror

Suggested fix:
Remplace // comments by /*  */ comments
[10 Oct 2017 8:18] MySQL Verification Team
Hello Sebastien FLAESCH,

Thank you for the report and feedback!

[12 Oct 2017 9:28] MySQL Verification Team
Hello Sebastien,

We have discussed internally on this and concluded that - Since MySQL 8.0, the client headers require C99 or newer, which allows // comments. GCC uses C11 mode by default since version 5. If you must use an older version of GCC, you can use the default gnu89 mode without -pedantic,which also accepts such comments.

Thank you for your interest in MySQL.

[12 Oct 2017 9:57] Sebastien FLAESCH
Ok I understand.
Thanks for the answer and suggestion.