Bug #60911 Avoid compiler warnings if _XOPEN_SOURCE or isoctal are already defined
Submitted: 18 Apr 2011 21:08 Modified: 28 Feb 2013 15:41
Reporter: Paul Green (OCA) Email Updates:
Status: Closed Impact on me:
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version:5.6.2-m5 OS:Any
Assigned to: CPU Architecture:Any
Tags: Contribution

[18 Apr 2011 21:08] Paul Green
Several MySQL source files unconditionally define the _XOPEN_SOURCE and isoctal macros. If these macros are already defined in the environment, then the compiler complains about the redefinition. 

For the record, I discovered these issues while building MySQL 5.1.48 on Stratus OpenVOS Release 17.1 using gcc 3.4.6.  Our environment pre-defines these two macros.

How to repeat:
Simply pre-define _XOPEN_SOURCE to some value other than 500, and predefine isoctal to some string other than the definition used by MySQL.

Suggested fix:
I will attach a patch file. The patches are against MySQL 5.1.48, but I have verified that these 3 files have not changed as of MySQL 5.6.2-m5.

The files are extra/innochecksum.c, cmd-line-utils/libedit/np/vis.c and cmd-line-utils/libedit/np/unvis.c.
[18 Apr 2011 21:09] Paul Green
Patches to correct compilation warnings

Attachment: mysql.60911.diff (application/octet-stream, text), 1.49 KiB.

[27 Apr 2011 17:47] Valeriy Kravchuk
Thank you for the problem report and patch contributed.
[26 Feb 2013 15:28] Tor Didriksen
the _XOPEN_SOURCE #define went away with the patch for
Bug#55713 	innochecksum is NOT built with large file support enabled
[28 Feb 2013 15:41] Paul DuBois
Noted in 5.6.11, 5.7.1 changelogs.

Fixed warnings when compiling when the _XOPEN_SOURCE or isoctal macro
was already defined in the environment.