[gnome-online-accounts/wip/rishi/posix-pthread-semantics-reeentrant] build: Don't define _POSIX_PTHREAD_SEMANTICS and _REENTRANT



commit 9f01adeec1e8be23eaea856cd384b81d79f26c66
Author: Debarshi Ray <debarshir gnome org>
Date:   Mon Oct 1 17:21:20 2018 +0200

    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 GLib's 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] https://gitlab.gnome.org/GNOME/glib/issues/1432
    
    https://gitlab.gnome.org/GNOME/gnome-online-accounts/merge_requests/14

 meson.build                 | 6 +-----
 src/daemon/Makefile.am      | 1 -
 src/examples/Makefile.am    | 1 -
 src/goa/Makefile.am         | 1 -
 src/goabackend/Makefile.am  | 1 -
 src/goaidentity/Makefile.am | 1 -
 6 files changed, 1 insertion(+), 10 deletions(-)
---
diff --git a/meson.build b/meson.build
index 6a706a76..d462fe87 100644
--- a/meson.build
+++ b/meson.build
@@ -62,10 +62,6 @@ config_h.set('GOA_MINOR_VERSION', goa_minor_version)
 config_h.set('GOA_MICRO_VERSION', goa_micro_version)
 
 # compiler flags
-common_flags = [
-  '-D_POSIX_PTHREAD_SEMANTICS',
-  '-D_REENTRANT'
-]
 compiler_flags = []
 
 if goa_buildtype.contains('debug')
@@ -82,7 +78,7 @@ if goa_buildtype.contains('debug')
   ])
 endif
 
-add_project_arguments(common_flags + compiler_flags, language: 'c')
+add_project_arguments(compiler_flags, language: 'c')
 
 glib_req_version = '>= 2.52'
 
diff --git a/src/daemon/Makefile.am b/src/daemon/Makefile.am
index 662d18ae..ee6a7c17 100644
--- a/src/daemon/Makefile.am
+++ b/src/daemon/Makefile.am
@@ -14,7 +14,6 @@ AM_CPPFLAGS =                                                         \
        -DPACKAGE_LOCALSTATE_DIR=\""$(localstatedir)"\"         \
        -DPACKAGE_LOCALE_DIR=\""$(localedir)"\"                 \
        -DPACKAGE_LIB_DIR=\""$(libdir)"\"                       \
-       -D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT                 \
        -DGOA_API_IS_SUBJECT_TO_CHANGE                          \
        -DGOA_BACKEND_API_IS_SUBJECT_TO_CHANGE                  \
        $(WARN_CFLAGS)                                          \
diff --git a/src/examples/Makefile.am b/src/examples/Makefile.am
index 2daa07c5..01176353 100644
--- a/src/examples/Makefile.am
+++ b/src/examples/Makefile.am
@@ -11,7 +11,6 @@ AM_CPPFLAGS =                                                         \
        -DPACKAGE_LOCALSTATE_DIR=\""$(localstatedir)"\"         \
        -DPACKAGE_LOCALE_DIR=\""$(localedir)"\"                 \
        -DPACKAGE_LIB_DIR=\""$(libdir)"\"                       \
-       -D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT                 \
        $(WARN_CFLAGS)                                          \
        $(NULL)
 
diff --git a/src/goa/Makefile.am b/src/goa/Makefile.am
index 7d45ea36..aa0bcf35 100644
--- a/src/goa/Makefile.am
+++ b/src/goa/Makefile.am
@@ -19,7 +19,6 @@ AM_CPPFLAGS =                                                         \
        -DPACKAGE_LOCALSTATE_DIR=\""$(localstatedir)"\"         \
        -DPACKAGE_LOCALE_DIR=\""$(localedir)"\"                 \
        -DPACKAGE_LIB_DIR=\""$(libdir)"\"                       \
-       -D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT                 \
        $(WARN_CFLAGS)                                          \
        $(NULL)
 
diff --git a/src/goabackend/Makefile.am b/src/goabackend/Makefile.am
index ed04d0fd..0c1fb795 100644
--- a/src/goabackend/Makefile.am
+++ b/src/goabackend/Makefile.am
@@ -20,7 +20,6 @@ AM_CPPFLAGS =                                                         \
        -DPACKAGE_LOCALE_DIR=\""$(localedir)"\"                 \
        -DPACKAGE_LIB_DIR=\""$(libdir)"\"                       \
        -DPACKAGE_WEB_EXTENSIONS_DIR=\""$(libdir)/goa-1.0/web-extensions"\" \
-       -D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT                 \
        $(WARN_CFLAGS)                                          \
        $(NULL)
 
diff --git a/src/goaidentity/Makefile.am b/src/goaidentity/Makefile.am
index fd933ad4..ec3dad80 100644
--- a/src/goaidentity/Makefile.am
+++ b/src/goaidentity/Makefile.am
@@ -16,7 +16,6 @@ AM_CPPFLAGS =                                                         \
        -DPACKAGE_LOCALSTATE_DIR=\""$(localstatedir)"\"         \
        -DPACKAGE_LOCALE_DIR=\""$(localedir)"\"                 \
        -DPACKAGE_LIB_DIR=\""$(libdir)"\"                       \
-       -D_POSIX_PTHREAD_SEMANTICS -D_REENTRANT                 \
        -DGOA_API_IS_SUBJECT_TO_CHANGE                          \
        -DGOA_BACKEND_API_IS_SUBJECT_TO_CHANGE                  \
        $(WARN_CFLAGS)                                          \


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]