Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build failure with GCC 15 (C23) #664

Closed
kostadinsh opened this issue Nov 18, 2024 · 3 comments · May be fixed by #665
Closed

Build failure with GCC 15 (C23) #664

kostadinsh opened this issue Nov 18, 2024 · 3 comments · May be fixed by #665

Comments

@kostadinsh
Copy link

Upcoming GCC 15 uses -std=gnu23 by default which makes rsync fail to build.

The issue can be reproduced on older GCC and Clang versions by adding -std=gnu23 (for GCC) and -std=c23 (for Clang) to CFLAGS.

Downstream bug report in Gentoo: https://bugs.gentoo.org/943745

lib/pool_alloc.c: In function ‘pool_create’:
lib/pool_alloc.c:85:20: error: assignment to ‘void (*)(void)’ from incompatible pointer type ‘void (*)(const char *, const char *, int)’ [-Wincompatible-pointer-types]
   85 |         pool->bomb = bomb;
      |                    ^
hlink.c: In function ‘match_gnums’:
hlink.c:120:56: warning: cast between incompatible function types from ‘int (*)(int *, int *)’ to ‘int (*)(void)’ [-Wcast-function-type]
  120 |         qsort(ndx_list, ndx_count, sizeof ndx_list[0], (int (*)()) hlink_compare_gnum);
      |                                                        ^
hlink.c:120:56: error: passing argument 4 of ‘qsort’ from incompatible pointer type [-Wincompatible-pointer-types]
  120 |         qsort(ndx_list, ndx_count, sizeof ndx_list[0], (int (*)()) hlink_compare_gnum);
      |                                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                        |
      |                                                        int (*)(void)
In file included from rsync.h:328,
                 from hlink.c:23:
/usr/include/stdlib.h:971:34: note: expected ‘__compar_fn_t’ {aka ‘int (*)(const void *, const void *)’} but argument is of type ‘int (*)(void)’
  971 |                    __compar_fn_t __compar) __nonnull ((1, 4));
      |                    ~~~~~~~~~~~~~~^~~~~~~~
lib/pool_alloc.c: In function ‘pool_alloc’:
lib/pool_alloc.c:171:18: error: too many arguments to function ‘pool->bomb’
  171 |                 (*pool->bomb)(bomb_msg, __FILE__, __LINE__);
      |                 ~^~~~~~~~~~~~
syscall.c: In function ‘do_lseek’:
syscall.c:394:17: error: conflicting types for ‘lseek64’; have ‘off64_t(void)’ {aka ‘long int(void)’}
  394 |         off64_t lseek64();
      |                 ^~~~~~~
In file included from rsync.h:354,
                 from syscall.c:23:
/usr/include/unistd.h:350:18: note: previous declaration of ‘lseek64’ with type ‘__off64_t(int,  __off64_t,  int)’ {aka ‘long int(int,  long int,  int)’}
  350 | extern __off64_t lseek64 (int __fd, __off64_t __offset, int __whence)
      |                  ^~~~~~~
syscall.c:396:16: error: too many arguments to function ‘lseek64’
  396 |         return lseek64(fd, offset, whence);
      |                ^~~~~~~
syscall.c:394:17: note: declared here
  394 |         off64_t lseek64();
      |                 ^~~~~~~

@hhoffstaette
Copy link
Contributor

Also see: #521

@WayneD
Copy link
Member

WayneD commented Nov 20, 2024

I assume this is fixed now that #521 was merged.

@WayneD WayneD closed this as completed Nov 20, 2024
@charmitro
Copy link
Contributor

I assume this is fixed now that #521 was merged.

Cast warning persists:

hlink.c: In function ‘match_gnums’:
hlink.c:120:56: warning: cast between incompatible function types from ‘int (*)(int *, int *)’ to ‘int (*)(void)’ [-Wcast-function-type]
  120 |         qsort(ndx_list, ndx_count, sizeof ndx_list[0], (int (*)()) hlink_compare_gnum);
      |                                                        ^
hlink.c:120:56: error: passing argument 4 of ‘qsort’ from incompatible pointer type [-Wincompatible-pointer-types]
  120 |         qsort(ndx_list, ndx_count, sizeof ndx_list[0], (int (*)()) hlink_compare_gnum);
      |                                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      |                                                        |
      |                                                        int (*)(void)
In file included from rsync.h:328,
                 from hlink.c:23:
/usr/include/stdlib.h:971:34: note: expected ‘__compar_fn_t’ {aka ‘int (*)(const void *, const void *)’} but argument is of type ‘int (*)(void)’
  971 |                    __compar_fn_t __compar) __nonnull ((1, 4));
      |                    ~~~~~~~~~~~~~~^~~~~~~~

I'll update #665 to only fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants