From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id AB48E385840C; Sat, 12 Oct 2024 07:07:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org AB48E385840C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1728716824; bh=a07KMA1iRUAKpdCPQp98SQV8Z5amjzSott+bOnFQQMM=; h=From:To:Subject:Date:From; b=GGxadlBxc0ECBbJrbxXYmiJptyWC/RFFwWIMKB7wiRy9GLBOuh4IbrwvDzG6l/nBq eyBIJHLpG1zmPz6qjEtLu470lbinYPoUqYGPaDLZnzCp0rBwnekysRkeJMviiryKHN hCfd9rzbNmYafIsOJ6FoiVVZvbfABDRLFr67xfRo= From: "jeffrey.cliff at gmail dot com" To: gdb-prs@sourceware.org Subject: [Bug gdb/32265] New: some c23 changes Date: Sat, 12 Oct 2024 07:07:03 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gdb X-Bugzilla-Component: gdb X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: enhancement X-Bugzilla-Who: jeffrey.cliff at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D32265 Bug ID: 32265 Summary: some c23 changes Product: gdb Version: unknown Status: UNCONFIRMED Severity: enhancement Priority: P2 Component: gdb Assignee: unassigned at sourceware dot org Reporter: jeffrey.cliff at gmail dot com Target Milestone: --- gdb 15.2 CFLAGS: -std=3Dgnu23 -Oz -march=3Dnative gcc (GCC) 15.0.0 20240509 (experimental) Readline: 8.2=20 1)=20 if configure script defines RETSIGTYPE to be void (ie ac_cv_type_signal=3Dv= oid)=20 it's defined to be void in ./readline/readline/config.h=20 but if the configure script *also* does not define VOID_SIGHANDLER ( bash_cv_void_sighandler=3Dno )=20 SIGHANDLER_RETURN is defined to be "return (0)"; but this causes return values for functions like _rl_signal_handler which remain void this breaks compilation when an int is attempted to be returned but the function returns void (this may have just been a warning before c23) ie this results in=20 signals.c: In function =E2=80=98_rl_signal_handler=E2=80=99: signals.c:62:36: error: =E2=80=98return=E2=80=99 with a value, in function = returning void [-Wreturn-mismatch] 62 | # define SIGHANDLER_RETURN return (0) | ^ signals.c:163:3: note: in expansion of macro =E2=80=98SIGHANDLER_RETURN=E2= =80=99 163 | SIGHANDLER_RETURN; | ^~~~~~~~~~~~~~~~~ signals.c:140:1: note: declared here 140 | _rl_signal_handler (int sig) | ^~~~~~~~~~~~~~~~~~ one possible fix for that is to specify, when RETSIGTYPE is void but VOID_SIGHANDLER is not defined=20 ie something like #if (RETSIGTYPE) =3D=3D void #define VOID_SIGHANDLER 1 #endif #if defined (VOID_SIGHANDLER) # define SIGHANDLER_RETURN return #else # define SIGHANDLER_RETURN return (0) #endif at L65 of readline/readline/signals.c 2)=20 K&R function declaration syntax is no longer valid in c23 ie for one of the functions in rlmbutil.h diff -r gdb-15.2/readline/readline/rlmbutil.h gdb-15.2-wip/readline/readline/rlmbutil.h 129,130c129 < _rl_wcwidth (wc) < wchar_t wc; --- > _rl_wcwidth ( wchar_t wc)=20 3) there's also a syntax change for empty parameter lists in c23 so perhaps th= is is what will be required? diff -r gdb-15.2/gdb/testsuite/gdb.base/callfuncs.c gdb-15.2-wip/gdb/testsuite/gdb.base/callfuncs.c 23c23 < #define PARAMS(paramlist) () --- > #define PARAMS(paramlist) (void) diff -r gdb-15.2/readline/readline/examples/rlfe/extern.h gdb-15.2-wip/readline/readline/examples/rlfe/extern.h 34c34 < # define __P(protos) () --- > # define __P(protos) (void) diff -r gdb-15.2/readline/readline/tilde.h gdb-15.2-wip/readline/readline/tilde.h 38c38 < # define PARAMS(protos) () --- > # define PARAMS(protos) (void)=20 4) even with this, gdb still also fails to compile at=20 signals.c: In function =E2=80=98rl_sigwinch_handler=E2=80=99: signals.c:358:32: error: passing argument 2 of =E2=80=98rl_set_sighandler= =E2=80=99 from incompatible pointer type [-Wincompatible-pointer-types] 358 | rl_set_sighandler (SIGWINCH, rl_sigwinch_handler, &dummy_winch); | ^~~~~~~~~~~~~~~~~~~ | | | void (*)(int) In file included from rldefs.h:31, from signals.c:37: signals.c:94:51: note: expected =E2=80=98void (*)(void)=E2=80=99 but argume= nt is of type =E2=80=98void (*)(int)=E2=80=99 94 | static SigHandler *rl_set_sighandler PARAMS((int, SigHandler *, sighandler_cxt *)); | ^~~~~~~~~~~~ [I haven't figured how rl_set_sighandler is getting void(*)(int) yet] --=20 You are receiving this mail because: You are on the CC list for the bug.=