Skip to content

build: Don't define _POSIX_PTHREAD_SEMANTICS and _REENTRANT

These two pre-processor macros have existed since the first commit, but it isn't clear why. They were used with the Settings panel while it lived in gnome-online-accounts.git, but were dropped when it was moved to gnome-control-center.git [1], again, it isn't clear why.

The _POSIX_PTHREAD_SEMANTICS documentation [2] says that it will "enable threading extensions on Solaris", and is covered under the AC_USE_SYSTEM_EXTENSIONS banner. The code in gnome-online-accounts.git uses threads, but does so via the GLib and GIO APIs, and doesn't use the POSIX threads (or pthreads) API directly. GLib itself defines it as part of AC_USE_SYSTEM_EXTENSIONS in its Autotools build [3] but not in the Meson build. The Meson build does define other AC_USE_SYSTEM_EXTENSIONS components, but not _POSIX_PTHREAD_SEMANTICS.

Therefore, it seems safe to conclude that the _POSIX_PTHREAD_SEMANTICS doesn't serve any purpose here in gnome-online-accounts.git.

The _REENTRANT documentation [4] says that it's obsolete. GLib defines it on Solaris and Mac OS X in its Autotools build, but that's solely for the Oracle compilers on Solaris and possibly other historical reasons. Both GCC and Clang appear to expand -pthread to define _REENTRANT on their own [5]. Since Meson doesn't support the Oracle compiler, it's not present in the Meson build at all [6].

Given the current momentum towards Meson in GNOME, and that Meson doesn't support it, it's safe to ignore anything specific to the Oracle compiler. Hence _REENTRANT can be removed.

[1] https://bugzilla.gnome.org/show_bug.cgi?id=653334 https://bugzilla.gnome.org/show_bug.cgi?id=653335

[2] https://www.gnu.org/software/autoconf/manual/autoconf-2.64/html_node/Posix-Variants.html

[3] https://bugzilla.gnome.org/show_bug.cgi?id=684123

[4] https://www.gnu.org/software/libc/manual/html_node/Feature-Test-Macros.html

[5] https://stackoverflow.com/questions/875789/do-i-need-d-reentrant-with-pthreads https://github.com/mesonbuild/meson/issues/3810

[6] glib#1432 (closed)

Merge request reports