• Dmitry Shulga's avatar
    MDEV-23926: Fix warnings generated during compilation of... · 6dc14453
    Dmitry Shulga authored
    MDEV-23926: Fix warnings generated during compilation of plugin/auth_pam/mapper/pam_user_map.c on MacOS
    
    Compiler warnings like one listed below are generated during server build on MacOS:
    
    [88%] Building C object plugin/auth_pam/CMakeFiles/pam_user_map.dir/mapper/pam_user_map.c.o
    mariadb/server-10.2/plugin/auth_pam/mapper/pam_user_map.c:87:41: error: passing
    'gid_t *' (aka 'unsigned int *') to parameter of type 'int *' converts between pointers to integer types
    with different sign [-Werror,-Wpointer-sign]
      if (getgrouplist(user, user_group_id, loc_groups, &ng) < 0)
         ^~~~~~~~~~
    /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/include/unistd.h:650:43: note:
      passing argument to parameter here
      int getgrouplist(const char *, int, int *, int *);
          ^
    
    In case MariaDB server is build with -DCMAKE_BUILD_TYPE=Debug it results in
    build error.
    
    The reason of compiler warnings is that declaration of the Posix C API function
    getgrouplist() on MacOS differs from declaration of getgrouplist() proposed
    by Posix.
    
    To suppress this compiler warning cmake configure was adapted to detect what
    kind of getgrouplist() function is declared on the build platform and
    set the macros HAVE_POSIX_GETGROUPLIST in case the building platform supports
    Posix compatible interface for the getgrouplist() function. Depending on
    whether this macros is set the compatible type of arguments is used to pass
    parameter values to the function.
    6dc14453
CMakeLists.txt 1.7 KB