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

warning: 'finite' is deprecated: first deprecated in macOS 10.9

Details

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

    Description

      /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

            abychko Alexey Bychko (Inactive) added a comment - - edited

            #ifndef isfinite
            #ifdef HAVE_FINITE
            #define isfinite(x) finite(x)
            #else
            #define finite(x) (1.0 / fabs(x) > 0.0)
            #endif /* HAVE_FINITE */
            #elif (__cplusplus >= 201103L)
            #include <cmath>
            static inline bool isfinite(double x) { return std::isfinite(x); }
            #endif /* isfinite */
            

            isfinite() is a macros in C99 and a function is c++ 11, so atm isfinite is always undefined. so, defines are not correct with c++11

            abychko Alexey Bychko (Inactive) added a comment - - edited #ifndef isfinite #ifdef HAVE_FINITE #define isfinite(x) finite(x) #else #define finite(x) (1.0 / fabs(x) > 0.0) #endif /* HAVE_FINITE */ #elif (__cplusplus >= 201103L) #include <cmath> static inline bool isfinite(double x) { return std::isfinite(x); } #endif /* isfinite */ isfinite() is a macros in C99 and a function is c++ 11, so atm isfinite is always undefined. so, defines are not correct with c++11

            is may be required to make a fix in CS first, because that check for isfinite definition was added 11 years ago

            abychko Alexey Bychko (Inactive) added a comment - is may be required to make a fix in CS first, because that check for isfinite definition was added 11 years ago

            possible fix in my_global.h (requires additional checks)

            #ifndef isfinite
            # ifdef HAVE_STD_ISFINITE
            #   define isfinite(x) std::isfinite(x)
            # else
            #   ifndef HAVE_ISFINITE
            #     ifndef HAVE_FINITE
            #       define finite(x) (1.0 / fabs(x) > 0.0)
            #      endif  /* HAVE_FINITE */
            #     define isfinite(x) finite((double)x)
            #   endif /* HAVE_ISFINITE */
            # endif /* HAVE_STD_ISFINITE */
            #endif /* isfinite */
            

            checks in config.h.cmake:

            #cmakedefine HAVE_ISFINITE 1
            #cmakedefine HAVE_STD_ISFINITE 1
            

            checks in configure.cmake:

            CHECK_SYMBOL_EXISTS(isfinite math.h HAVE_ISFINITE)
            CHECK_CXX_SYMBOL_EXISTS(std::isfinite cmath HAVE_STD_ISFINITE)
            

            abychko Alexey Bychko (Inactive) added a comment - possible fix in my_global.h (requires additional checks) #ifndef isfinite # ifdef HAVE_STD_ISFINITE # define isfinite(x) std::isfinite(x) # else # ifndef HAVE_ISFINITE # ifndef HAVE_FINITE # define finite(x) (1.0 / fabs(x) > 0.0) # endif /* HAVE_FINITE */ # define isfinite(x) finite((double)x) # endif /* HAVE_ISFINITE */ # endif /* HAVE_STD_ISFINITE */ #endif /* isfinite */ checks in config.h.cmake: #cmakedefine HAVE_ISFINITE 1 #cmakedefine HAVE_STD_ISFINITE 1 checks in configure.cmake: CHECK_SYMBOL_EXISTS(isfinite math.h HAVE_ISFINITE) CHECK_CXX_SYMBOL_EXISTS(std::isfinite cmath HAVE_STD_ISFINITE)

            this fix removes a lot of garbage output during compilation on MacOS and makes the log readable

            abychko Alexey Bychko (Inactive) added a comment - this fix removes a lot of garbage output during compilation on MacOS and makes the log readable

            People

              vlad.lesin Vladislav Lesin
              abychko Alexey Bychko (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 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.