https://bugs.openldap.org/show_bug.cgi?id=9215

            Bug ID: 9215
           Summary: Embedded _XOPEN_SOURCE breaks Solaris build
                    [regression]
           Product: OpenLDAP
           Version: unspecified
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: ---
         Component: libraries
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

The commit [2020-03-26 57b7003 | thr_posix.c: fix implicit function declaration
for 'pthread_setconcurrency']

introduced in the bug 8676, comment 8:

> --- a/libraries/libldap_r/thr_posix.c
> +++ b/libraries/libldap_r/thr_posix.c
> @@ -15,4 +15,6 @@
>   */
>  
> +#define _XOPEN_SOURCE 500 /* For pthread_setconcurrency() on glibc */
> +
>  #include "portable.h"
breaks build on Solaris (likely any version; irrelevant compiling options
omitted):

| cc ... -c ../../../libraries/libldap_r/thr_posix.c -o .libs/thr_posix.o
| "/usr/include/sys/feature_tests.h", line 354: #error: "Compiler or options
invalid for pre-UNIX 03 X/Open applications and pre-2001 POSIX applications"

The system headers bear in mind:

    "If you are using c99-compatible compiler ..." 

and we all are using such compilers in 2020, isn't it?

    "... and want to use X/Open CAE, it must be at least Issue 6"

i.e., not the Issue 5 (_XOPEN_SOURCE=500).

This part of system headers came from the times when Solaris was Sun yet. Given
the long respectful history of Sun's commitment to standard conformance, I
trust this assertion.

The problem, however, is not an incorrect X/Open version this patch employs.

1st of all, this patch is a system-specific hack, that targets not even
GNU-based systems, but, I suppose, specifically, GNU linux, maybe, even
specific version and distro. E.g., there are no problems with
pthread_setconcurrency() visibility on Solaris.

2nd of all, the influence of configuration macros _XOPEN_SOURCE, _POSIX_SOURCE,
_POSIX_C_SOURCE, _XOPEN_VERSION, _XOPEN_SOURCE_EXTENDED, __EXTENSIONS__ etc is
very system- and compiler- specific, and embedding these macros directly in a
source is likely to cause problems.

I believe the best course of action is to put a test in autoconf to check what
is the best way to achieve pthread_setconcurrency() visibility on any given
system.

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

Reply via email to