Bug #28240 "isinf()" cannot be used in C++ for lack of prototype
Submitted: 4 May 2007 13:32 Modified: 27 May 2007 16:23
Reporter: Joerg Bruehe Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Compiling Severity:S1 (Critical)
Version:5.0 + 5.1 OS:Solaris (x86)
Assigned to: Alexey Kopytov

[4 May 2007 13:32] Joerg Bruehe
Description:
Compilation of 5.1.18 fails on Solaris/x86
because of a platform inconsistency regarding "isinf()":

- During the configure phase, the test program succeeds, 
     checking for isinf with <math.h>... yes
  and so "HAVE_ISINF" is set to 1.

- However, there is no header file with a prototype for "isinf()".
  This causes warnings in C code
     "strtod.c", line 197: warning: implicit function declaration: isinf
  and fatal errors in C++ code
     "item_func.cc", line 2004: Error: The function "isinf" must have a 
     prototype.

I know this is related to bug#14862 and bug#20602;
the current (= failing) code includes the fix for bug#14862.
I filed a new report because:
1) This occurs with Sun compilers
      "Sun C 5.6 2004/06/02" and "Sun C++ 5.6 2004/06/02"
   whereas the other reports were about gcc.
2) We should have a new, clean history with this.

How to repeat:
Try to build 5.1 (or 5.0) on Solaris/x86

Suggested fix:
I have no idea for a more strict check in configure that would detect the missing prototype - maybe we should use a C++ program ?

Alternatively: Should we wrap the C++ call to "isinf()" into a C function ?
I know this would be a runtime overhead.

In any case, currently the "HAVE_ISINF" setting cannot be relied upon, and the new code in "my_global.h" (to replace a missing "isinf()") will not take effect.
[8 May 2007 17:12] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/26316

ChangeSet@1.2476, 2007-05-08 21:11:46+04:00, kaa@polly.local +4 -0
  Fix for bug #28240: "isinf()" cannot be used in C++ for lack of prototype
  
  Since isinf() portability across various platforms and compilers is a complicated question, we should not use it directly. Instead, the my_isinf() macro should be used, which is defined as an alias to the system-defined isinf() if it is safe to use, or a workaround implementation otherwise.
[14 May 2007 13:15] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/26606

ChangeSet@1.2485, 2007-05-14 15:11:29+02:00, df@pippilotta.erinye.com +4 -0
  import of fix for bug#28240
[16 May 2007 8:10] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/26776

ChangeSet@1.2479, 2007-05-16 10:10:02+02:00, msvensson@pilot.blaudden +4 -0
  Fix for bug #28240: "isinf()" cannot be used in C++ for lack of prototype
  - Since isinf() portability across various platforms and
    compilers is a complicated question, we should not use
    it directly. Instead, the my_isinf() macro should be used,
    which is defined as an alias to the system-defined isinf()
    if it is safe to use, or a workaround implementation otherwise
[22 May 2007 17:00] Bugs System
Pushed into 5.1.19-beta
[22 May 2007 17:03] Bugs System
Pushed into 5.0.44
[24 May 2007 15:14] Bugs System
Pushed into 5.1.19-beta
[24 May 2007 19:31] Bugs System
Pushed into 5.0.44
[27 May 2007 16:23] Paul Dubois
Noted in 5.0.44, 5.1.19 changelogs.

Portability problems caused by use of isinf() were corrected.