https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113143

--- Comment #3 from Alexander von Gluck <kallisti5 at unixzen dot com> ---
Good call out.  It looks like in 2004 these functions were flagged as
obsolescent though:
https://pubs.opengroup.org/onlinepubs/009695399/functions/makecontext.html

Here's the note on it in the linux man page for getcontext:
"
  glibc 2.1.  SUSv2, POSIX.1-2001.  Removed in POSIX.1-2008, citing
  portability issues, and recommending that applications be
  rewritten to use POSIX threads instead.
"


upstream go usage:

* makecontext: no code matches as of go 1.22 (main)
* getcontext:  netbsd,solaris,freebsd code usage as of go 1.22 (main)
* setcontext:  netbsd,freebsd code usages as of go 1.22 (main)
* swapcontext: freebsd code usages as of go 1.22 (main)


Per the 2004 spec:

"The obsolescent functions getcontext(), makecontext(), and swapcontext() can
be replaced using POSIX threads functions."

Essentially, for quite some time, (get|make|set)context are only used on the
BSD's and Solaris... thus invocation of include<ucontext.h> should be guarded /
masked off on all other platforms.

Reply via email to