hpc / mpifileutils

File utilities designed for scalability and performance.
https://hpc.github.io/mpifileutils
BSD 3-Clause "New" or "Revised" License
170 stars 68 forks source link

Fix compile warnings #605

Closed ofaaland closed 5 days ago

ofaaland commented 5 days ago

Fix three compile warnings observed when building with gcc (GCC) 12.2.1 20221121 (Red Hat 12.2.1-7)

  1. Extra token at end of #endif

            [ 21%] Building C object src/common/CMakeFiles/mfu_o.dir/mfu_io.c.o
            src/common/mfu_io.c:1673:8: warning: extra tokens at end of #endif directive [-Wendif-labels]
             1673 | #endif DCOPY_USE_XATTRS
                  |        ^~~~~~~~~~~~~~~~
  2. Implicit declaration of setgroups()

            src/dcp/dcp.c:416:13: warning: implicit declaration of function ‘setgroups’; did you mean ‘getgroups’? [-Wimplicit-function-declaration]
              416 |         if (setgroups(0, NULL) < 0) {
                  |             ^~~~~~~~~
                  |             getgroups
            [ 50%] Linking C executable dcp
  3. Incorrect type passed to getgroups()

            src/dcp/dcp.c:407:42: warning: passing argument 2 of ‘getgroups’ from incompatible pointer type [-Wincompatible-pointer-types]
              407 |         gids_count = getgroups(MAX_GIDS, &gids);
                  |                                          ^~~~~
                  |                                          |
                  |                                          uid_t (*)[100] {aka unsigned int (*)[100]}
            In file included from src/dcp/dcp.c:7:
            /usr/include/unistd.h:689:43: note: expected ‘__gid_t *’ {aka ‘unsigned int *’} but argument is of type ‘uid_t (*)[100]’ {aka ‘unsigned int (*)[100]’}
              689 | extern int getgroups (int __size, __gid_t __list[]) __THROW __wur;
ofaaland commented 5 days ago

@bdevcich see above minor fixes to gid-related code.

bdevcich commented 5 days ago

Thanks @ofaaland. Not sure how I missed this.