From owner-dev-commits-src-main@freebsd.org Thu May 6 22:22:05 2021 Return-Path: Delivered-To: dev-commits-src-main@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4E44D63012C; Thu, 6 May 2021 22:22:05 +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 4Fbp3K1mV4z57SR; Thu, 6 May 2021 22:22:05 +0000 (UTC) (envelope-from git@FreeBSD.org) 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 2F72D20225; Thu, 6 May 2021 22:22:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 146MM5XM067340; Thu, 6 May 2021 22:22:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 146MM5JN067339; Thu, 6 May 2021 22:22:05 GMT (envelope-from git) Date: Thu, 6 May 2021 22:22:05 GMT Message-Id: <202105062222.146MM5JN067339@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: a709a4f0d4e0 - main - headers: Implement _ISOC11_SOURCES macro when __POSIX_C_SOURCE defined MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a709a4f0d4e0303eb40ea1b39b4bb35837800805 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-main@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commit messages for the main branch of the src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 06 May 2021 22:22:05 -0000 The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=a709a4f0d4e0303eb40ea1b39b4bb35837800805 commit a709a4f0d4e0303eb40ea1b39b4bb35837800805 Author: Warner Losh AuthorDate: 2021-05-06 22:20:19 +0000 Commit: Warner Losh CommitDate: 2021-05-06 22:20:36 +0000 headers: Implement _ISOC11_SOURCES macro when __POSIX_C_SOURCE defined When _ISOC11_SOURCES is defined for glibc at the same time __POSIX_C_SOURCE is defined, it extends the __POSIX_C_SOURCE definition by exaclty what C11 adds to the spec for each system header. We follow both OpenBSD's and glibc's convention by also C11 or higher compliation mode is selected. The Open Group is working on issuing a new version of the POSIX standard that will realign the standard from C99 to a newer version of C. This commit is a stop-gap measure for greater compatibility until that environment has been standardized. Reviewed by: brooks@, arichards@, Olivier Certne (comments tweaked before commit) PR: 255290 Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D29902 --- sys/sys/cdefs.h | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/sys/sys/cdefs.h b/sys/sys/cdefs.h index ff461db9ec2e..309b2a4004a6 100644 --- a/sys/sys/cdefs.h +++ b/sys/sys/cdefs.h @@ -718,6 +718,17 @@ #define __POSIX_VISIBLE 198808 #define __ISO_C_VISIBLE 0 #endif /* _POSIX_C_SOURCE */ +/* + * Both glibc and OpenBSD enable c11 features when _ISOC11_SOURCE is defined, or + * when compiling with -stdc=c11. A strict reading of the standard would suggest + * doing it only for the former. However, a strict reading also requires C99 + * mode only, so building with C11 is already undefined. Follow glibc's and + * OpenBSD's lead for this non-standard configuration for maximum compatibility. + */ +#if _ISOC11_SOURCE || (defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) +#undef __ISO_C_VISIBLE +#define __ISO_C_VISIBLE 2011 +#endif #else /*- * Deal with _ANSI_SOURCE: