unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: lloda <lloda@sarc.name>
To: 60971@debbugs.gnu.org
Subject: bug#60971: build failure of v3.0.9rc1 on mac os 12.6
Date: Fri, 20 Jan 2023 20:16:15 +0100	[thread overview]
Message-ID: <F45F98B5-AA18-48B6-9824-A22635420AC2@sarc.name> (raw)



Hello,

v3.0.9rc1 fails on mac os 12.6.2 & gcc 12.2 or clang 14, same error in either case. gcc's error is:

------------------------------------
CC       libguile_3.0_la-posix.lo
In file included from ../../../src/guile4/libguile/posix.c:82:
../../../src/guile4/libguile/posix.c:109:9: error: lvalue required as unary '&' operand
  109 | verify (WEXITSTATUS (W_EXITCODE (127, 0)) == 127);
      |         ^~~~~~~~~~~
../../../src/guile4/lib/verify.h:213:57: note: in definition of macro '_GL_VERIFY'
  213 | # define _GL_VERIFY(R, DIAGNOSTIC, ...) _Static_assert (R, DIAGNOSTIC)
      |                                                         ^
../../../src/guile4/libguile/posix.c:109:1: note: in expansion of macro 'verify'
  109 | verify (WEXITSTATUS (W_EXITCODE (127, 0)) == 127);
      | ^~~~~~
../../../src/guile4/libguile/posix.c:109:9: error: expression in static assertion is not an integer
  109 | verify (WEXITSTATUS (W_EXITCODE (127, 0)) == 127);
      |         ^~~~~~~~~~~
../../../src/guile4/lib/verify.h:213:57: note: in definition of macro '_GL_VERIFY'
  213 | # define _GL_VERIFY(R, DIAGNOSTIC, ...) _Static_assert (R, DIAGNOSTIC)
      |                                                         ^
../../../src/guile4/libguile/posix.c:109:1: note: in expansion of macro 'verify'
  109 | verify (WEXITSTATUS (W_EXITCODE (127, 0)) == 127);
      | ^~~~~~
------------------------------------

The problematic section in libguile/posix.c

...

#if HAVE_SYS_WAIT_H
# include <sys/wait.h>
#endif
#ifndef WEXITSTATUS
# define WEXITSTATUS(stat_val) ((unsigned)(stat_val) >> 8)
#endif
#ifndef WIFEXITED
# define WIFEXITED(stat_val) (((stat_val) & 255) == 0)
#endif

#ifndef W_EXITCODE
/* Macro for constructing a status value.  Found in glibc.  */
# ifdef _WIN32                            /* see Gnulib's posix-w32.h */
#  define W_EXITCODE(ret, sig)   (ret)
# else
#  define W_EXITCODE(ret, sig)   ((ret) << 8 | (sig))
# endif
#endif
verify (WEXITSTATUS (W_EXITCODE (127, 0)) == 127);
...

adding -o .libs/libguile_3.0_la-posix.i -E to the build line shows line 109 as

_Static_assert ( (((*(int *)&((( 127 ) << 8 | ( 0 )))) >> 8) & 0x000000ff) == 127, "verify (" "WEXITSTATUS (W_EXITCODE (127, 0)) == 127" ")");
                            ^

forcing redefinition of WEXITSTATUS shows the previous definition at /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/wait.h

...

#if defined(_POSIX_C_SOURCE) && !defined(_DARWIN_C_SOURCE)
#define _W_INT(i)       (i)
#else
#define _W_INT(w)       (*(int *)&(w))  /* convert union wait to int */   <------------- problem
#define WCOREFLAG       0200
#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */

/* These macros are permited, as they are in the implementation namespace */
#define _WSTATUS(x)     (_W_INT(x) & 0177)
#define _WSTOPPED       0177            /* _WSTATUS if process is stopped */

/*
 * [XSI] The <sys/wait.h> header shall define the following macros for
 * analysis of process status values
 */
#if __DARWIN_UNIX03
#define WEXITSTATUS(x)  ((_W_INT(x) >> 8) & 0x000000ff)
#else /* !__DARWIN_UNIX03 */
#define WEXITSTATUS(x)  (_W_INT(x) >> 8)
#endif /* !__DARWIN_UNIX03 */
/* 0x13 == SIGCONT */
#define WSTOPSIG(x)     (_W_INT(x) >> 8)
#define WIFCONTINUED(x) (_WSTATUS(x) == _WSTOPPED && WSTOPSIG(x) == 0x13)
#define WIFSTOPPED(x)   (_WSTATUS(x) == _WSTOPPED && WSTOPSIG(x) != 0x13)
#define WIFEXITED(x)    (_WSTATUS(x) == 0)
#define WIFSIGNALED(x)  (_WSTATUS(x) != _WSTOPPED && _WSTATUS(x) != 0)
#define WTERMSIG(x)     (_WSTATUS(x))
#if (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE))
#define WCOREDUMP(x)    (_W_INT(x) & WCOREFLAG)

#define W_EXITCODE(ret, sig)    ((ret) << 8 | (sig))
#define W_STOPCODE(sig)         ((sig) << 8 | _WSTOPPED)
#endif /* (!defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)) */

...

so that's the problem, but I'm not sure what the solution is. The way it's
written, W_EXITCODE() is always going to give up a number...

Thanks

  Daniel






             reply	other threads:[~2023-01-20 19:16 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-20 19:16 lloda [this message]
     [not found] ` <handler.60971.B.167424218722695.ack@debbugs.gnu.org>
2023-02-23 19:00   ` bug#61660: [feature request] optimization of case-lambda lloda
2023-02-24 17:26     ` lloda
2023-02-27 10:11       ` Ludovic Courtès
2023-02-27 17:19         ` lloda
     [not found] <87v8l15hb2.fsf@inria.fr>
     [not found] ` <rmiy1pv48rj.fsf@s1.lexort.com>
     [not found]   ` <562CD6BE-42D3-4D4C-AB4C-2B4A5341F525@sarc.name>
     [not found]     ` <rmiy1pu3a7e.fsf@s1.lexort.com>
     [not found]       ` <87h6wh34t0.fsf@gnu.org>
     [not found]         ` <079E639D-3A09-48E6-AAE1-913896DC692E@sarc.name>
2023-01-23 21:59           ` bug#60971: build failure of v3.0.9rc1 on mac os 12.6 Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=F45F98B5-AA18-48B6-9824-A22635420AC2@sarc.name \
    --to=lloda@sarc.name \
    --cc=60971@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).