Bug #7457 Compilation fails on 64 bit platforms
Submitted: 21 Dec 2004 16:43 Modified: 1 Feb 2005 10:31
Reporter: Joerg Bruehe Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S1 (Critical)
Version:5.0.3-pre OS:Various Unix, 64 bit
Assigned to: Ramil Kalimullin CPU Architecture:Any

[21 Dec 2004 16:43] Joerg Bruehe
Description:
On various 64 bit Unix platforms, compiling the current 5.0.3-pre fails with an error that Alexey Kopytov has analyzed (in a mail to dev-public dated 'Tue, 21 Dec 2004 18:08:48 +0300') as follows:

=== cut ===
I've just failed to compile a fresh 5.0 BK clone on sgi1.mysql.com due to the 
following:

field.cc:347:51: macro "longlong10_to_str" passed 5 arguments, but takes just 
3
make[4]: *** [field.o] Error 1

It looks like the problem is in the following code from include/m_string.h 
(abbreviated):

#if SIZEOF_LONG == SIZEOF_LONG_LONG
#define longlong2str(A,B,C) int2str((A),(B),(C),1)
#define longlong10_to_str(A,B,C) int10_to_str((A),(B),(C))
#else
extern char *longlong2str(longlong val,char *dst,int radix);
extern char *longlong10_to_str(longlong val,char *dst,int radix);
#endif

So for 64-bit platforms longlong10_to_str is a macro that takes 3 arguments. 
And in include/m_ctype.h we have the following in the declaration of 
my_charset_handler_st structure:

  int (*longlong10_to_str)(struct charset_info_st *, char *to, uint n,
         int radix, longlong val);

Here longlong10_to_str is a pointer to a function that takes 5 arguments.

So 5.0 is broken for 64-bit platforms due to the above names conflict.
=== cut ===

The exact messages differ from compiler to compiler - some samples:

=== Tru64, native:
cxx: Warning: field.cc, line 346: too many arguments in macro invocation
                                             length, unsigned_flag ? 10 : -10,
-----------------------------------------------------^
cxx: Error: field.cc, line 345: class "my_charset_handler_st" has no member
          "int10_to_str"
  length= (uint) cs->cset->longlong10_to_str(cs, (char*) val_buffer->ptr(),
---------------------------^

=== SunOS 5.10, native:
"field.cc", line 346: Warning: Too many arguments in macro longlong10_to_str.

=== Linux x86_64, gcc:
field.cc:347:51: macro "longlong10_to_str" passed 5 arguments, but takes just 3

=== Linux x86_64, icc:
field.cc(346): warning #55: too many arguments in macro invocation
                                               length, unsigned_flag ? 10 : -10,
                                                       ^
field.cc(345): error: class "my_charset_handler_st" has no member "int10_to_str"
    length= (uint) cs->cset->longlong10_to_str(cs, (char*) val_buffer->ptr(),
                             ^

How to repeat:
Try to build a current 5.0.3-pre on a 64 bit platform.