Description:
Compiling mysql 5.5.15 under AIX and xlc 11.1, I get the following error:
xlc_r -ma -O3 -qstrict -qoptimize=3 -qmaxmem=8192 -DHAVE_CONFIG_H -DDISABLE_MYSQL_THREAD_H -qthreaded -qalias=noansi -qhalt=e -g -DENABLED_DEBUG_SYNC -I/opt/freeware/src/packages/BUILD/mysql-5.5.15/debug/include -I/opt/freeware/src/packages/BUILD/mysql-5.5.15/mysql-5.5.15/include -o CMakeFiles/strings.dir/bchange.c.o -c /opt/freeware/src/packages/BUILD/mysql-5.5.15/mysql-5.5.15/strings/bchange.c
"/opt/freeware/src/packages/BUILD/mysql-5.5.15/mysql-5.5.15/include/my_global.h", line 289.74: 1506-272 (E) Identifier not allowed in cast or sizeof declarations.
"/opt/freeware/src/packages/BUILD/mysql-5.5.15/mysql-5.5.15/include/my_global.h", line 289.76: 1506-046 (S) Syntax error.
"/usr/include/alloca.h", line 34.1: 1506-224 (I) Incorrect pragma ignored.
make: 1254-004 The error code from the last command is 1.
***************************************************************************************************************
>>>>Souce list of compile command
IBM XL C for AIX, Version 11.1.0.0 /opt/freeware/src/packages/BUILD/mysql-5.5.15/mysql-5.5.15/strings/bchange.c 08/16/11 16:41:58 (C)
>>>>> SOURCE SECTION <<<<<
1 | /* Copyright (c) 2000, 2001, 2006, 2007 MySQL AB
2 | Use is subject to license terms.
3 |
4 | This program is free software; you can redistribute it and/or modify
5 | it under the terms of the GNU General Public License as published by
6 | the Free Software Foundation; version 2 of the License.
7 |
8 | This program is distributed in the hope that it will be useful,
9 | but WITHOUT ANY WARRANTY; without even the implied warranty of
10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 | GNU General Public License for more details.
12 |
13 | You should have received a copy of the GNU General Public License
14 | along with this program; if not, write to the Free Software
15 | Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
16 |
17 | /* File : bchange.c
18 | Author : Michael widenius
19 | Updated: 1987-03-20
20 | Defines: bchange()
21 |
22 | bchange(dst, old_length, src, new_length, tot_length)
23 | replaces old_length characters at dst to new_length characters from
24 | src in a buffer with tot_length bytes.
25 | */
26 |
27 | #include <my_global.h>
"/opt/freeware/src/packages/BUILD/mysql-5.5.15/mysql-5.5.15/include/my_global.h", line 289.74: 1506-272 (E) Identifier not allowed in cast or sizeof declarations.
"/opt/freeware/src/packages/BUILD/mysql-5.5.15/mysql-5.5.15/include/my_global.h", line 289.76: 1506-046 (S) Syntax error.
"/usr/include/alloca.h", line 34.1: 1506-224 (I) Incorrect pragma ignored.
28 | #include "m_string.h"
29 |
30 | void bchange(register uchar *dst, size_t old_length, register const uchar *src,
******************************************************************************
"/opt/freeware/src/packages/BUILD/mysql-5.5.15/mysql-5.5.15/include/my_global.h", line 282.2: 1506-454 (I) ifdef condition evaluates to 1.
"/opt/freeware/src/packages/BUILD/mysql-5.5.15/mysql-5.5.15/include/my_global.h", line 289.74: 1506-272 (E) Identifier not allowed in cast or sizeof declarations.
"/opt/freeware/src/packages/BUILD/mysql-5.5.15/mysql-5.5.15/include/my_global.h", line 289.76: 1506-046 (S) Syntax error.
"/opt/freeware/src/packages/BUILD/mysql-5.5.15/mysql-5.5.15/include/my_global.h", line 289.78: 1506-481 (I) The end of the function may be reached without returning a value.
"/opt/freeware/src/packages/BUILD/mysql-5.5.15/mysql-5.5.15/include/my_global.h", line 289.78: 1506-414 (I) The parameter "A" is never referenced.
***************************************************************************************************
It appears the problem code is my_global.h- Snippet:
/* Go around some bugs in different OS and compilers */
#ifdef _AIX /* By soren@t.dk */
#define _H_STRINGS
#define _SYS_STREAM_H
/* #define _AIX32_CURSES */ /* XXX: this breaks AIX 4.3.3 (others?). */
#define ulonglong2double(A) my_ulonglong2double(A)
#define my_off_t2double(A) my_ulonglong2double(A)
C_MODE_START
inline double my_ulonglong2double(unsigned long long A) { return (double A); }
C_MODE_END
#endif /* _AIX */
****************************
IBM says:
Identifier not allowed in cast or sizeof declarations.
Explanation:
Only abstract declarators can appear in cast or sizeof expressions.
User response:
Remove the identifier from the cast or sizeof expression and replace it with an abstract declarator.
********************************************
Any ideas on how to work around this problem would be very much appreciated. Thank you in advance.
How to repeat:
Repeat the cmake command using the xlC 11.1 compiler under AIX 6.1
Suggested fix:
Possible alteration of code for AIX