Rename struct ucontext tag (bug 21457)

Zack Weinberg zackw@panix.com
Mon Jun 26 21:11:00 GMT 2017


On 06/12/2017 07:58 PM, Joseph Myers wrote:
> The ucontext_t type has a tag struct ucontext.  As with previous such
> issues for siginfo_t and stack_t, this tag is not permitted by POSIX
> (is not in a reserved namespace), and so namespace conformance means
> breaking C++ name mangling for this type.
> 
> In this case, the type does need to have some tag rather than just a
> typedef name, because it includes a pointer to itself.  This patch
> uses struct ucontext_t as the new tag, so the type is mangled as
> ucontext_t (the POSIX *_t reservation applies in all namespaces, not
> just the namespace of ordinary identifiers).  Another reserved name
> such as struct __ucontext could of course be used.

This looks OK to me.

On the entirely arbitrary basis that the name mangling for

    typedef struct ucontext_t { ... } ucontext_t;

is the same as the name mangling for

    typedef struct { ... } ucontext_t;

whereas

    typedef struct __ucontext { ... } ucontext_t;

would put the string '__ucontext' into the mangled names, I vote for the
'ucontext_t' struct tag.

zw



More information about the Libc-alpha mailing list