Bug #31822 | Redefinition of C++ bool prevents use of external C++ libraries in plug-ins | ||
---|---|---|---|
Submitted: | 24 Oct 2007 18:44 | Modified: | 27 Oct 2007 0:01 |
Reporter: | Bill Mitchell | Email Updates: | |
Status: | Duplicate | Impact on me: | |
Category: | MySQL Server: Compiling | Severity: | S2 (Serious) |
Version: | 5.1 | OS: | Windows |
Assigned to: | CPU Architecture: | Any |
[24 Oct 2007 18:44]
Bill Mitchell
[24 Oct 2007 19:59]
MySQL Verification Team
Thank you for the bug report. Duplicate of bug: http://bugs.mysql.com/bug.php?id=26461.
[26 Oct 2007 23:57]
Bill Mitchell
Yes, Miguel, I did recognize that bug #26461 is one of several that discusses issues surrounding the definition of bool in config-win.h. So I see why you might regard this bug #31822 as a duplicate. But I think I can draw a distinction. Bug #26461 discusses problems that arise when a source file includes one but not both of the header files config-win.h and my_global.h. In principal, one could resolve that bug report by ensuring that the two header files give equivalent redefinitions, either 1 byte or 4 byte for consistency. Bug #31822 discusses a different issue, the complete inability to use publicly available C++ libraries from a C++ plugin. And the only resolution on the mysql side would be the elimination of redefinitions of bool in both header files, leaving the native C++ bool intact. Looking at the two reports from a practical level, a source resolution to #31822 must necessarily fix #26461 as well. But there exist source changes that resolve #26461, but leave #31822 as an outstanding issue.
[27 Oct 2007 0:01]
Bill Mitchell
To determine the size of the issue on the mysql side, and to verify that the problem can indeed be resolved, I have developed a set of source changes that attempt to make consistent use for each set of related variables/methods of either bool or my_bool. Where consistency is too hard to achieve, most of the compilation warnings are remedied through appropriate use of the test() method. Beyond the constraints I sketched in the initial bug report, the most significant source constraint appears where some functions expect the address of an item, e.g., a char* that points to a my_bool. Some of these functions are in C modules, and not C++ modules, where the native C++ bool should not be passed. I have uploaded a .zip file, bug-fix-31822.zip, with the set of changes I have made so far. These yield an error-free compilation with a manageable set of warning messages. A few of these warnings relate to real source errors that should be looked at. The largest clump of remaining warnings are in the yacc parser, the has numerous conversions from int/my_bool to bool. Not yet being really familiar with yacc, I thought I would leave these for someone else to consider, although they could all be made to go away very quickly with a few more test() calls. For each of the modified files, I have included a .rev file that describes the changes in each file. For header and source files with the same name, I shared all the revision comments in one file with the same base name. Of course, not yet being as expert as I might like on mysql, the implications for not-Windows platforms, and the implications for the data across the client interfaces, there is a chance that these source changes affect a data type that should be kept fixed across multiple versions of the product. I hope that is not the case. Also, I have not yet built a Linux version where I could run the provided test suite. So all I know is that it compiles relatively cleanly and seems to work on very preliminary simple tests.
[27 Oct 2007 1:16]
MySQL Verification Team
Thank you for the feedback and additional comments. Besides the link as duplicate bug I added your 2 last comments in the http://bugs.mysql.com/bug.php?id=26461 also you can add comments to that bug. Thank you for the contribution.