public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/27523] New: makecontext(3): Incorrect type for the 2nd parameter
@ 2021-03-05 12:30 alx.manpages at gmail dot com
  0 siblings, 0 replies; only message in thread
From: alx.manpages at gmail dot com @ 2021-03-05 12:30 UTC (permalink / raw)
  To: glibc-bugs

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

            Bug ID: 27523
           Summary: makecontext(3): Incorrect type for the 2nd parameter
           Product: glibc
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: libc
          Assignee: unassigned at sourceware dot org
          Reporter: alx.manpages at gmail dot com
                CC: drepper.fsp at gmail dot com
  Target Milestone: ---

POSIX.1-2001 uses the following prototype for makecontext():

void makecontext(ucontext_t *ucp, void (*func)(),
       int argc, ...);

<https://pubs.opengroup.org/onlinepubs/009695399/>

It correctly makes use of the (obsolescent in standard C since C89) feature of
function declarators with empty parentheses that means "any parameters", which
is what 'func' expects: a pointer to a function with any number of parameters.


Glibc, however, uses a function pointer that explicitly asks for zero
parameters, by using the following prototype:

.../glibc$ grep_glibc_prototype makecontext
stdlib/ucontext.h:51:
extern void makecontext (ucontext_t *__ucp, void (*__func) (void),
                         int __argc, ...) __THROW;
.../glibc$

Even though this is more conforming to standard C (while the empty parentheses
feature is obsolescent, '(void)' is perfectly valid, and function pointers are
interchangeable anyway), it feels wrong, by asking for a prototype that is
conceptually different from the actual function that is being used.  I didn't
test, but it might also produce warnings, which are being silenced by the fact
that it's library code, but I guess it's producing warnings at glibc compile
time.

See related discussion:
<https://lore.kernel.org/linux-man/87tupp6gke.fsf@igel.home/T/#md190ac21eb020415e8917a14e855c28587f64b2a/T/>

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-03-05 12:30 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-05 12:30 [Bug libc/27523] New: makecontext(3): Incorrect type for the 2nd parameter alx.manpages at gmail dot com

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).