public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/32265] New: some c23 changes
@ 2024-10-12  7:07 jeffrey.cliff at gmail dot com
  2024-10-12  8:13 ` [Bug gdb/32265] " schwab@linux-m68k.org
                   ` (27 more replies)
  0 siblings, 28 replies; 29+ messages in thread
From: jeffrey.cliff at gmail dot com @ 2024-10-12  7:07 UTC (permalink / raw)
  To: gdb-prs

https://sourceware.org/bugzilla/show_bug.cgi?id=32265

            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=gnu23 -Oz -march=native
gcc (GCC) 15.0.0 20240509 (experimental)
Readline: 8.2 

1) 

if configure script defines RETSIGTYPE to be void (ie ac_cv_type_signal=void) 
it's defined to be void in ./readline/readline/config.h 

but if the configure script *also* does not define VOID_SIGHANDLER (
bash_cv_void_sighandler=no ) 

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 
signals.c: In function ‘_rl_signal_handler’:
signals.c:62:36: error: ‘return’ with a value, in function returning void
[-Wreturn-mismatch]
   62 | #  define SIGHANDLER_RETURN return (0)
      |                                    ^
signals.c:163:3: note: in expansion of macro ‘SIGHANDLER_RETURN’
  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 

ie something like

#if (RETSIGTYPE) == 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) 

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) 


3)

there's also a syntax change for empty parameter lists in c23 so perhaps this
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) 

4) even with this, gdb still also fails to compile at 

signals.c: In function ‘rl_sigwinch_handler’:
signals.c:358:32: error: passing argument 2 of ‘rl_set_sighandler’ 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 ‘void (*)(void)’ but argument is of type ‘void
(*)(int)’
   94 | static SigHandler *rl_set_sighandler PARAMS((int, SigHandler *,
sighandler_cxt *));
      |                                                   ^~~~~~~~~~~~

[I haven't figured how rl_set_sighandler is getting void(*)(int) yet]

-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 29+ messages in thread

end of thread, other threads:[~2024-12-17 23:01 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-12  7:07 [Bug gdb/32265] New: some c23 changes jeffrey.cliff at gmail dot com
2024-10-12  8:13 ` [Bug gdb/32265] " schwab@linux-m68k.org
2024-10-12 15:02 ` [Bug gdb/32265] Import readline 8.2 tromey at sourceware dot org
2024-10-12 15:02 ` tromey at sourceware dot org
2024-10-12 15:02 ` tromey at sourceware dot org
2024-10-12 15:54 ` sam at gentoo dot org
2024-11-16  6:23 ` sam at gentoo dot org
2024-11-16  6:27 ` sam at gentoo dot org
2024-11-16 16:41 ` tromey at sourceware dot org
2024-11-16 18:01 ` tromey at sourceware dot org
2024-11-16 20:38 ` tromey at sourceware dot org
2024-11-16 20:52 ` tromey at sourceware dot org
2024-11-16 21:03 ` tromey at sourceware dot org
2024-11-18  3:40 ` jeffrey.cliff at gmail dot com
2024-11-22 23:51 ` tromey at sourceware dot org
2024-12-12 13:55 ` vvinayag at arm dot com
2024-12-12 20:50 ` tromey at sourceware dot org
2024-12-13 19:12 ` schwab@linux-m68k.org
2024-12-14  6:57 ` euloanty at live dot com
2024-12-14 16:12 ` tromey at sourceware dot org
2024-12-15 11:09 ` euloanty at live dot com
2024-12-16 20:15 ` cvs-commit at gcc dot gnu.org
2024-12-16 20:15 ` cvs-commit at gcc dot gnu.org
2024-12-16 20:16 ` tromey at sourceware dot org
2024-12-17  3:59 ` euloanty at live dot com
2024-12-17  4:01 ` euloanty at live dot com
2024-12-17  4:09 ` euloanty at live dot com
2024-12-17 10:26 ` rudi at heitbaum dot com
2024-12-17 23:01 ` tromey at sourceware dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).