Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@trofi
Copy link

@trofi trofi commented Nov 16, 2024

gcc-15 switched to -std=c23 by default:

https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=55e3bd376b2214e200fa76d12b67ff259b06c212

As a result ncompress fails the build as:

compress.c: In function 'main':
compress.c:382:40: error:
  passing argument 2 of 'signal' from incompatible pointer type [-Wincompatible-pointer-types]
  382 |                         signal(SIGINT, (SIG_TYPE)abort_compress);
      |                                        ^~~~~~~~~~~~~~~~~~~~~~~~
      |                                        |
      |                                        void (*)(void)
In file included from compress.c:30:
...-glibc-2.40-36-dev/include/signal.h:88:57: note:
  expected '__sighandler_t' {aka 'void (*)(int)'} but argument is of type 'void (*)(void)'
   88 | extern __sighandler_t signal (int __sig, __sighandler_t __handler)
      |                                          ~~~~~~~~~~~~~~~^~~~~~~~~

The change removes type casts around function prototypes and define signal handler as void(*)(int).

gcc-15 switched to -std=c23 by default:

    https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=55e3bd376b2214e200fa76d12b67ff259b06c212

As a result `ncompress` fails the build as:

    compress.c: In function 'main':
    compress.c:382:40: error:
      passing argument 2 of 'signal' from incompatible pointer type [-Wincompatible-pointer-types]
      382 |                         signal(SIGINT, (SIG_TYPE)abort_compress);
          |                                        ^~~~~~~~~~~~~~~~~~~~~~~~
          |                                        |
          |                                        void (*)(void)
    In file included from compress.c:30:
    ...-glibc-2.40-36-dev/include/signal.h:88:57: note:
      expected '__sighandler_t' {aka 'void (*)(int)'} but argument is of type 'void (*)(void)'
       88 | extern __sighandler_t signal (int __sig, __sighandler_t __handler)
          |                                          ~~~~~~~~~~~~~~~^~~~~~~~~

The change removes type casts around function prototypes and define
signal handler as `void(*)(int)`.
@kloczek
Copy link

kloczek commented May 5, 2025

IMO it would be good to merge this PR and release new version.

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 this pull request may close these issues.

2 participants