From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS22989 209.51.188.0/24 X-Spam-Status: No, score=-3.7 required=3.0 tests=AWL,BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 48F341F47C for ; Sat, 28 Jan 2023 01:30:52 +0000 (UTC) Authentication-Results: dcvr.yhbt.net; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=clisp.org header.i=@clisp.org header.a=rsa-sha256 header.s=strato-dkim-0002 header.b=tobTINzM; dkim-atps=neutral Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pLa39-0000Ak-CL; Fri, 27 Jan 2023 20:30:35 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pLa37-0000AD-Su for bug-gnulib@gnu.org; Fri, 27 Jan 2023 20:30:34 -0500 Received: from mo4-p00-ob.smtp.rzone.de ([85.215.255.23]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pLa35-0003F1-FU for bug-gnulib@gnu.org; Fri, 27 Jan 2023 20:30:33 -0500 ARC-Seal: i=1; a=rsa-sha256; t=1674869428; cv=none; d=strato.com; s=strato-dkim-0002; b=tRg2M9eQO4h4notk8H8X+CBTy60B4dA1U3PBhlN+tts3krxgFnv1rDw6Hnfb/rgiRe DYmjPEFU5rYtiYdq4MVmR5RLz+t8YRFCB44aiWJ+dSQnLu6YNfykOXJRuOJMoo43mjIh dqGL8581Uo5MqT2he9dwY9ZgEZxfqpFus16kYdXFQlduuaXd7R9UFxC4hn2Z7YVkpKue SxVX90dcbd9eLEPuIYVRfWYtafQaPL/NoRTwh4TRA0ueREO/lJOtOLJqK0j65RITm22F t5fG1uoXPfTLKxd+izOqbRjwsOiCXLMFZ3pGYC50pRxb3CPCMXTjTmxrG0s3gJpdxqq0 gAjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1674869428; s=strato-dkim-0002; d=strato.com; h=Message-ID:Date:Subject:To:From:Cc:Date:From:Subject:Sender; bh=YEeVmiFQoMaqUS+1gIWES5RPutrjRklN5OLaUl+Ml9U=; b=WakhO/mp8tmj7mgRfba90r7NRU74Wb0uRjYCPmJtybu3CWQ/qPQ/GSwFiZ5Uc3lVUQ 4kPUsccCwnBVR7ATgAibdvr5qWbUD7n0w6u/YGe2uI7F+p2oNLQ2uua/ljM52rSe9Cq5 O2u+ecxickunPMhXy8E7GgEFPHJCca83T6q5wJYuJ4yTUTCJFMFsmxdQW0vIOaMGo1/C wm5sRA5G37iP+6JJnA2uv4LQAY/4bbbbuCbo7zSIQLZE2WCBMneZPuCdeGc/6CXFy/0s kQqla7wTnSoTO3xoIUyJAyiN+hHjp+FSFyWcpy8emcx/4t1bse4wL0ZrSrIUeM8qBwqU zbqQ== ARC-Authentication-Results: i=1; strato.com; arc=none; dkim=none X-RZG-CLASS-ID: mo00 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1674869428; s=strato-dkim-0002; d=clisp.org; h=Message-ID:Date:Subject:To:From:Cc:Date:From:Subject:Sender; bh=YEeVmiFQoMaqUS+1gIWES5RPutrjRklN5OLaUl+Ml9U=; b=tobTINzMI7VqWK+OmxqdeAcWXcWNy+ev5Ev2Nuodkpa2R51uB502B4omjtVdnh42kN GJY4R+Hp672XEARoVzavUikKHoa2DxZDAeErq2A5KYVZtZGKQ7Qi+o87lltYNV69QSSd kdQdy6XH2/8IWThu1D+qt0PbD7q2GlcP3NifY8AYLDS8Nttm9iI6g8jcSP7LGcpl/JFZ fG/BSV7j7r1tC7jfW5Di2L9RxePWVXrIHnLpbpBleATet1DcQcxT4EFdPPEwy//8MEZO i14gEQvArSqXqGV5GhbyB9xCxcdGhltKOctHOBqRqfU/I2m82wTYK+AARHWzzSuvF/qn 7WCQ== X-RZG-AUTH: ":Ln4Re0+Ic/6oZXR1YgKryK8brlshOcZlIWs+iCP5vnk6shH0WWb0LN8XZoH94zq68+3cfpPDjvwA7022TV+YfjovfFy3RIl4" Received: from nimes.localnet by smtp.strato.de (RZmta 49.2.2 AUTH) with ESMTPSA id 098542z0S1URMDA (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256 bits)) (Client did not present a certificate); Sat, 28 Jan 2023 02:30:27 +0100 (CET) From: Bruno Haible To: bug-gnulib@gnu.org Subject: stdalign: Ensure alignof is actually defined on FreeBSD Date: Sat, 28 Jan 2023 02:30:27 +0100 Message-ID: <4723862.tfcYcld1sP@nimes> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Received-SPF: none client-ip=85.215.255.23; envelope-from=bruno@clisp.org; helo=mo4-p00-ob.smtp.rzone.de X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_PASS=-0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: bug-gnulib@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gnulib discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnulib-bounces+normalperson=yhbt.net@gnu.org Sender: bug-gnulib-bounces+normalperson=yhbt.net@gnu.org Building a testdir of all of Gnulib on FreeBSD 11.0/x86 or FreeBSD 12.0/x86, I get this compilation error: depbase=`echo rawmemchr.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`; cc -ferror-limit=0 -DHAVE_CONFIG_H -DEXEEXT=\"\" -DEXEEXT=\"\" -DNO_XMALLOC -DEXEEXT=\"\" -I. -I../../gllib -I.. -DGNULIB_STRICT_CHECKING=1 -I/home/bruno/include -Wall -D_THREAD_SAFE -fvisibility=hidden -g -O2 -MT rawmemchr.o -MD -MP -MF $depbase.Tpo -c -o rawmemchr.o ../../gllib/rawmemchr.c && mv -f $depbase.Tpo $depbase.Po ../../gllib/rawmemchr.c:45:31: warning: implicit declaration of function 'alignof' is invalid in C99 [-Wimplicit-function-declaration] (uintptr_t) char_ptr % alignof (longword) != 0; ^ ../../gllib/rawmemchr.c:45:40: error: unexpected type name 'longword': expected expression (uintptr_t) char_ptr % alignof (longword) != 0; ^ 1 warning and 1 error generated. The cause is that alignof is not defined, neither as a keyword or compiler built-in (since the compiler is clang 3.8.0 or 6.0.1, respectively), nor as a macro by Gnulib's stdalign.h override. alignof *is* defined as a macro in /usr/include/stdalign.h, but since Gnulib's stdalign.h overrides it, it gets never included. This is a regression from 2023-01-15 (since I am not seeing this error on the stable-201301 branch). This patch fixes it. 2023-01-27 Bruno Haible stdalign: Ensure alignof is defined on FreeBSD (regression 2023-01-15). * lib/stdalign.in.h: Include the system's when it exists. * m4/stdalign.m4 (gl_ALIGNASOF): Invoke gl_CHECK_NEXT_HEADERS. Set HAVE_STDALIGN_H. * modules/stdalign (Makefile.am): Substitute GUARD_PREFIX, HAVE_STDALIGN_H, INCLUDE_NEXT, PRAGMA_SYSTEM_HEADER, PRAGMA_COLUMNS, NEXT_STDALIGN_H. diff --git a/lib/stdalign.in.h b/lib/stdalign.in.h index 6523546f16..b616c100fd 100644 --- a/lib/stdalign.in.h +++ b/lib/stdalign.in.h @@ -20,8 +20,22 @@ /* Define two obsolescent C11 macros, assuming alignas and alignof are either keywords or alignasof-defined macros. */ -#ifndef _GL_STDALIGN_H -#define _GL_STDALIGN_H +#ifndef _@GUARD_PREFIX@_STDALIGN_H + +#if __GNUC__ >= 3 +@PRAGMA_SYSTEM_HEADER@ +#endif +@PRAGMA_COLUMNS@ + +/* We need to include the system's when it exists, because it might + define 'alignof' as a macro when it's not a keyword or compiler built-in. */ +#if @HAVE_STDALIGN_H@ +/* The include_next requires a split double-inclusion guard. */ +# @INCLUDE_NEXT@ @NEXT_STDALIGN_H@ +#endif + +#ifndef _@GUARD_PREFIX@_STDALIGN_H +#define _@GUARD_PREFIX@_STDALIGN_H #if (defined alignas \ || (defined __STDC_VERSION__ && 202311 <= __STDC_VERSION__) \ @@ -31,4 +45,5 @@ #define __alignof_is_defined 1 -#endif /* _GL_STDALIGN_H */ +#endif /* _@GUARD_PREFIX@_STDALIGN_H */ +#endif /* _@GUARD_PREFIX@_STDALIGN_H */ diff --git a/m4/stdalign.m4 b/m4/stdalign.m4 index 6a0ab2c102..3e83a2ca58 100644 --- a/m4/stdalign.m4 +++ b/m4/stdalign.m4 @@ -179,9 +179,17 @@ AC_DEFUN([gl_ALIGNASOF], AC_DEFUN([gl_STDALIGN_H], [ AC_REQUIRE([gl_ALIGNASOF]) - GL_GENERATE_STDALIGN_H=false - AS_IF([test "$gl_cv_header_working_stdalign_h" = no], - [GL_GENERATE_STDALIGN_H=true]) - - AC_CHECK_HEADERS_ONCE([stdalign.h]) + if test "$gl_cv_header_working_stdalign_h" = no; then + GL_GENERATE_STDALIGN_H=true + else + GL_GENERATE_STDALIGN_H=false + fi + + gl_CHECK_NEXT_HEADERS([stdalign.h]) + if test $ac_cv_header_stdalign_h = yes; then + HAVE_STDALIGN_H=1 + else + HAVE_STDALIGN_H=0 + fi + AC_SUBST([HAVE_STDALIGN_H]) ]) diff --git a/modules/stdalign b/modules/stdalign index c5c29d3088..ceeab546a2 100644 --- a/modules/stdalign +++ b/modules/stdalign @@ -26,7 +26,14 @@ BUILT_SOURCES += $(STDALIGN_H) if GL_GENERATE_STDALIGN_H stdalign.h: stdalign.in.h $(top_builddir)/config.status @NMD@ $(AM_V_GEN)$(MKDIR_P) '%reldir%' - $(gl_V_at)$(SED_HEADER_TO_AT_t) $(srcdir)/stdalign.in.h + $(gl_V_at)$(SED_HEADER_STDOUT) \ + -e 's|@''GUARD_PREFIX''@|${gl_include_guard_prefix}|g' \ + -e 's|@''HAVE_STDALIGN_H''@|$(HAVE_STDALIGN_H)|g' \ + -e 's|@''INCLUDE_NEXT''@|$(INCLUDE_NEXT)|g' \ + -e 's|@''PRAGMA_SYSTEM_HEADER''@|@PRAGMA_SYSTEM_HEADER@|g' \ + -e 's|@''PRAGMA_COLUMNS''@|@PRAGMA_COLUMNS@|g' \ + -e 's|@''NEXT_STDALIGN_H''@|$(NEXT_STDALIGN_H)|g' \ + $(srcdir)/stdalign.in.h > $@-t $(AM_V_at)mv $@-t $@ else stdalign.h: $(top_builddir)/config.status