Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-21082

isnan/isinf compilation errors, isfinite warnings on MacOS

    XMLWordPrintable

Details

    • Bug
    • Status: Closed (View Workflow)
    • Critical
    • Resolution: Fixed
    • 10.2(EOL)
    • 10.2.30
    • Compiling
    • None

    Description

      10.2 ES compilation fails under current MacOS due to incomplete or wrong definitions:

      #if (__cplusplus >= 201103L)
      #define my_isnan(x) std::isnan(x)
      #else /* (__cplusplus >= 201103L) */
      #ifndef HAVE_ISNAN
      #define isnan(x) ((x) != (x))
      #endif
      #define my_isnan(x) isnan(x)
      #endif /* (__cplusplus >= 201103L) */
       
      #if (__cplusplus >= 201103L)
      #define my_isinf(x) std::isinf(x)
      #else /* (__cplusplus >= 201103L) */
      #ifdef HAVE_ISINF
      #define my_isinf(X) isinf(X)
      #else /* !HAVE_ISINF */
      #define my_isinf(X) (!finite(X) && !isnan(X))
      #endif /* !HAVE_ISINF */
      #endif /* (__cplusplus >= 201103L) */
      

      it results in compilation failure:

      [ 34%] Building CXX object sql/CMakeFiles/sql.dir/field.cc.o
      /Users/abychko/GitHub/MariaDB/MariaDBEnterprise/sql/field.cc:4824:7: error: no member named 'isnan' in namespace 'std'; did you mean simply 'isnan'?
        if (my_isnan(res))
            ^~~~~~~~~~~~~
      /Users/abychko/GitHub/MariaDB/MariaDBEnterprise/include/my_global.h:826:21: note: expanded from macro 'my_isnan'
      #define my_isnan(x) std::isnan(x)
                          ^~~~~
      /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/math.h:541:1: note: 'isnan' declared here
      isnan(long double __lcpp_x) _NOEXCEPT { return __libcpp_isnan(__lcpp_x); }
      ^
      /Users/abychko/GitHub/MariaDB/MariaDBEnterprise/sql/field.cc:4846:10: error: no member named 'isinf' in namespace 'std'; did you mean simply 'isinf'?
          if (!my_isinf(res))
               ^~~~~~~~~~~~~
      /Users/abychko/GitHub/MariaDB/MariaDBEnterprise/include/my_global.h:835:21: note: expanded from macro 'my_isinf'
      #define my_isinf(x) std::isinf(x)
                          ^~~~~
      /Library/Developer/CommandLineTools/usr/bin/../include/c++/v1/math.h:497:1: note: 'isinf' declared here
      isinf(long double __lcpp_x) _NOEXCEPT { return __libcpp_isinf(__lcpp_x); }
      ^
      2 errors generated.
      make[2]: *** [sql/CMakeFiles/sql.dir/field.cc.o] Error 1
      make[1]: *** [sql/CMakeFiles/sql.dir/all] Error 2
      make: *** [all] Error 2
      

      to solve that we might need to define 3d matrix - HAVE_

      {IFINF,ISNAN},platform, compiler to handle cases like following:
      linux && gcc || clang (+ versions if needed)
      apple && clang (+ versions if needed)
      HAVE_{IFINF,ISNAN}

      || default fallback
      std::isnan or isnan() from math.h

      10.2 built successfully with properly defined my_isnan() and my_isinf()

      Besides there is another issue on MacOS 10.9:

      /Users/abychko/GitHub/MariaDB/MariaDBEnterprise/sql/item_func.h:244:12: warning: 'finite' is deprecated: first deprecated in macOS 10.9 - Use
       
            `isfinite((double)x)` instead. [-Wdeprecated-declarations]
       
          return isfinite(value) ? value : raise_float_overflow();
       
                 ^
       
      /Users/abychko/GitHub/MariaDB/MariaDBEnterprise/include/my_global.h:820:21: note: expanded from macro 'isfinite'
       
      #define isfinite(x) finite(x)
       
                          ^
       
      /Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include/math.h:749:12: note: 'finite' has been explicitly marked deprecated here
       
      extern int finite(double)
      

      Attachments

        Issue Links

          Activity

            People

              vlad.lesin Vladislav Lesin
              abychko Alexey Bychko (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.