From nobody Tue May 14 23:22:42 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4VfC7l2G8mz5LBQh; Tue, 14 May 2024 23:22:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4VfC7l1KpNz4gXy; Tue, 14 May 2024 23:22:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715728963; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=iYJ6LLcvClaWzcHeD5CqBEvnutFQQ89x34YvN0Nn3eQ=; b=WukNJwZZwGccMjiBIXs1OIlKyMzG+KMMTsrZcZKASwrmZz1xnpvzgrrGN7YD2zMPIe18Xu 5vAqzEqb3gwkZ5ie46dvjEXfg83E0ZAhTWPKzk6Ko64JlsL8jtmpAaNNMJM265y8MsVzf0 E6hoP+56V3HRHFNqgBzIPT77ryvoelaU7EsE9vXxf/R6Lr8reEmrxU03ZfajQ6Et0JBh/E z2dRHOBrBdJx8dMjT5XcxtBRzHCbpnH0g/5XW8HpDp3MzE7BlINADBoXohfyKBXsB2DVOZ C8vGUPCCEyef+id4toYm7U5RKz7nCy7akwC5VGz/w6aUUhWSlvyZEru4zAiz0Q== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1715728963; a=rsa-sha256; cv=none; b=xvXaQfIRXVpbnWdtkC6XR6shhG5FkdVXJ7NJcCch/d8lMnEIHtJTfPK06lg1iTS+0vxI8B XDvEk+tkWvtwdshh87Bddr2Xu33sUZ11F9o/gxNoGKXBx8ZULMPx/9pm5IlRkcHLloJUKu sAYfP3/z/kPBusA2CXG8r1GNEUNGG5AQzWO1H1j7riCnXpe9wocnwt+cnuM5Ne6NVG3Ofe UQsad3VfGEwGb5d0idVL6k7n0BZN+SwNbNs2jydM6Q4Kv4WjGrDqVzNoDvxVUzyH5wvWUe 5W8eeayQcfv3LCrR3xDD5b/YtTu6JyG+3dh50XOvznZzmf3ChqTUMBUoDAv2sg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1715728963; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=iYJ6LLcvClaWzcHeD5CqBEvnutFQQ89x34YvN0Nn3eQ=; b=jRoaXQynUaNW6dUHYq5ieL+JEBY23UT4Gls9Oa6ominatt/fx65wrzvTNuk6ZIkd22iL3n EEU5jPuMShLmVIXQGP/vf7rOiJQ9inI8+pcP+z5xyuV3rw14MeOXDWrrWDAcVvQ3VRyqBM DjG+nBhohO9Z1ln8ZKA89MqL44WPnYxknsYY6vr5RLuj9vi/8dRbQkacxP8XA4roHDFtSY bXAiflMSAeu9EyFOlLj6xIkH1v+XZOO71ZFftqA1WFNMfUwSpD4z9n4SCHu/o7jhgR7ow4 3WUbUPIp0SYyNkvU60rXk0ydegCXgzPnt1NY6IL85KqRejLNX/4XzciQzn7BDQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4VfC7l0dRlzrt7; Tue, 14 May 2024 23:22:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 44ENMg3C080089; Tue, 14 May 2024 23:22:42 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 44ENMgqM080086; Tue, 14 May 2024 23:22:42 GMT (envelope-from git) Date: Tue, 14 May 2024 23:22:42 GMT Message-Id: <202405142322.44ENMgqM080086@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Kyle Evans Subject: git: 5af6fbd72790 - main - ssp: appease -Wgnu-statement-expression-from-macro-expansion List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kevans X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5af6fbd72790173e128222943effc5aa95272ce9 Auto-Submitted: auto-generated The branch main has been updated by kevans: URL: https://cgit.FreeBSD.org/src/commit/?id=5af6fbd72790173e128222943effc5aa95272ce9 commit 5af6fbd72790173e128222943effc5aa95272ce9 Author: Kyle Evans AuthorDate: 2024-05-14 23:16:58 +0000 Commit: Kyle Evans CommitDate: 2024-05-14 23:22:18 +0000 ssp: appease -Wgnu-statement-expression-from-macro-expansion It's a stupid warning, but some ports enable it by default and were already defining _FORTIFY_SOURCE, thus exposing the new macros immediately. This at least fixes the libfido2 build, perhaps others as well. While we're here, fix a fresh build of stand w/ FORTIFY_SOURCE enabled by not pulling in the ssp headers if _STANDALONE is defined. We do not have runtime support in libsa as of the time of writing. Reported by: netchild Sponsored by: Stormshield Sponsored by: Klara, Inc. --- include/ssp/stdio.h | 10 +++++----- include/ssp/string.h | 4 ++-- include/ssp/strings.h | 4 ++-- include/stdio.h | 2 +- include/string.h | 2 +- include/strings.h | 2 +- include/unistd.h | 2 +- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/include/ssp/stdio.h b/include/ssp/stdio.h index ed7303497a45..4bca1de7d4f9 100644 --- a/include/ssp/stdio.h +++ b/include/ssp/stdio.h @@ -53,31 +53,31 @@ __END_DECLS #if __SSP_FORTIFY_LEVEL > 0 -#define sprintf(str, ...) ({ \ +#define sprintf(str, ...) __extension__ ({ \ char *_ssp_str = (str); \ __builtin___sprintf_chk(_ssp_str, 0, __ssp_bos(_ssp_str), \ __VA_ARGS__); \ }) -#define vsprintf(str, fmt, ap) ({ \ +#define vsprintf(str, fmt, ap) __extension__ ({ \ char *_ssp_str = (str); \ __builtin___vsprintf_chk(_ssp_str, 0, __ssp_bos(_ssp_str), fmt, \ ap); \ }) -#define snprintf(str, len, ...) ({ \ +#define snprintf(str, len, ...) __extension__ ({ \ char *_ssp_str = (str); \ __builtin___snprintf_chk(_ssp_str, len, 0, __ssp_bos(_ssp_str), \ __VA_ARGS__); \ }) -#define vsnprintf(str, len, fmt, ap) ({ \ +#define vsnprintf(str, len, fmt, ap) __extension__ ({ \ char *_ssp_str = (str); \ __builtin___vsnprintf_chk(_ssp_str, len, 0, __ssp_bos(_ssp_str), \ fmt, ap); \ }) -#define fgets(str, len, fp) ({ \ +#define fgets(str, len, fp) __extension__ ({ \ char *_ssp_str = (str); \ __fgets_chk(_ssp_str, len, __ssp_bos(_ssp_str), fp); \ }) diff --git a/include/ssp/string.h b/include/ssp/string.h index 996020fda778..ceb4ba2a2174 100644 --- a/include/ssp/string.h +++ b/include/ssp/string.h @@ -51,7 +51,7 @@ __END_DECLS #if __SSP_FORTIFY_LEVEL > 0 #define __ssp_bos_check3_typed_var(fun, dsttype, dsrvar, dst, srctype, srcvar, \ - src, lenvar, len) ({ \ + src, lenvar, len) __extension__ ({ \ srctype srcvar = (src); \ dsttype dstvar = (dst); \ size_t lenvar = (len); \ @@ -69,7 +69,7 @@ __END_DECLS __ssp_bos_check3_typed_var(fun, void *, __ssp_var(dstv), dst, \ const void *, __ssp_var(srcv), src, __ssp_var(lenv), len) -#define __ssp_bos_check2_var(fun, dstvar, dst, srcvar, src) ({ \ +#define __ssp_bos_check2_var(fun, dstvar, dst, srcvar, src) __extension__ ({ \ const void *srcvar = (src); \ void *dstvar = (dst); \ ((__ssp_bos0(dstvar) != (size_t)-1) ? \ diff --git a/include/ssp/strings.h b/include/ssp/strings.h index 06c9c7cc0a09..51b11a14ee87 100644 --- a/include/ssp/strings.h +++ b/include/ssp/strings.h @@ -39,7 +39,7 @@ #if __SSP_FORTIFY_LEVEL > 0 -#define _ssp_bcopy(srcvar, src, dstvar, dst, lenvar, len) ({ \ +#define _ssp_bcopy(srcvar, src, dstvar, dst, lenvar, len) __extension__ ({ \ const void *srcvar = (src); \ void *dstvar = (dst); \ size_t lenvar = (len); \ @@ -52,7 +52,7 @@ #define bcopy(src, dst, len) \ _ssp_bcopy(__ssp_var(srcv), src, __ssp_var(dstv), dst, __ssp_var(lenv), len) -#define _ssp_bzero(dstvar, dst, lenvar, len) ({ \ +#define _ssp_bzero(dstvar, dst, lenvar, len) __extension__ ({ \ void *dstvar = (dst); \ size_t lenvar = (len); \ ((__ssp_bos0(dstvar) != (size_t)-1) ? \ diff --git a/include/stdio.h b/include/stdio.h index 30bc638082d8..ea53816cf1d4 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -530,7 +530,7 @@ extern int __isthreaded; __END_DECLS __NULLABILITY_PRAGMA_POP -#if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 +#if !defined(_STANDALONE) && defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 #include #endif #endif /* !_STDIO_H_ */ diff --git a/include/string.h b/include/string.h index a595f6e3e260..ce605117daa6 100644 --- a/include/string.h +++ b/include/string.h @@ -168,7 +168,7 @@ errno_t memset_s(void *, rsize_t, int, rsize_t); #endif /* __EXT1_VISIBLE */ __END_DECLS -#if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 +#if !defined(_STANDALONE) && defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 #include #endif #endif /* _STRING_H_ */ diff --git a/include/strings.h b/include/strings.h index 6fe6a09e7dd3..511f7c03cb3c 100644 --- a/include/strings.h +++ b/include/strings.h @@ -68,7 +68,7 @@ int strncasecmp(const char *, const char *, size_t) __pure; #endif __END_DECLS -#if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 +#if !defined(_STANDALONE) && defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 #include #endif #endif /* _STRINGS_H_ */ diff --git a/include/unistd.h b/include/unistd.h index 59738cbf6e68..48155bb2971b 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -37,7 +37,7 @@ #include #include -#if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 +#if !defined(_STANDALONE) && defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 0 #include #endif