https://sourceware.org/bugzilla/show_bug.cgi?id=33168

            Bug ID: 33168
           Summary: libsframe tests don't build on Solaris
           Product: binutils
           Version: 2.45
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libsframe
          Assignee: indu.bhagat at oracle dot com
          Reporter: ro at gcc dot gnu.org
  Target Milestone: ---
              Host: *-*-solaris2.11
            Target: *-*-solaris2.11
             Build: *-*-solaris2.11

I just noticed during make -k check that the libsframe tests don't build at
all on Solaris.  Since they aren't even built, the failures don't show up in
libsframe.sum and are easily missed.

The actual failure is

In file included from
/vol/src/gnu/binutils/hg/binutils-2.45-branch/local/libsframe/testsuite/libsframe.decode/be-flipping.c:28:
/usr/include/dejagnu.h:48:1: error: conflicting types for ‘wait’; have
‘void(void)’
   48 | wait (void)
      | ^~~~
In file included from /usr/include/stdlib.h:16,
                 from
/vol/src/gnu/binutils/hg/binutils-2.45-branch/local/libsframe/testsuite/libsframe.decode/be-flipping.c:21:
/usr/include/sys/wait.h:85:14: note: previous declaration of ‘wait’ with type
‘pid_t(int *)’ {aka ‘long int(int *)’}
   85 | extern pid_t wait(int *);
      |              ^~~~

We have a combination of two factors here:

* Solaris <stdlib.h> has

#if defined(__EXTENSIONS__) || defined(_XPG4)
#include <sys/wait.h>
#endif

  and configure.ac predefines __EXTENSIONS__ due to the use of
AC_USE_SYSTEM_EXTENSIONS.

* This conflicts with <dejagnu.h>'s definition

void
wait (void) 
{
...
}

  While this was removed in upstream DejaGnu, the removal only happened after
  the latest release, 1.6.3.

To fix this, I see two (non-intrusive) options:

* Remove AC_USE_SYSTEM_EXTENSIONS if it's not actually needed and just a
  copy&paste artefact.

* A patch like the following:

diff --git a/libsframe/configure.ac b/libsframe/configure.ac
--- a/libsframe/configure.ac
+++ b/libsframe/configure.ac
@@ -23,6 +23,13 @@ AC_CONFIG_SRCDIR(sframe.c)

 AC_CANONICAL_TARGET

+case "${host}" in
+  # __EXTENSIONS__ includes <sys/wait.h> on Solaris, conflicting with
+  # dejagnu.h's wait definition up to DejaGnu 1.6.3.
+  *-*-solaris*)
+    ac_cv_safe_to_define___extensions__=no
+    ;;
+esac
 AC_USE_SYSTEM_EXTENSIONS
 AM_INIT_AUTOMAKE
 AM_SILENT_RULES([yes])

  I used this successfully to test libsframe on i386-pc-solaris2.11:

                === libsframe Summary ===

# of expected passes            129

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

Reply via email to