From owner-freebsd-hackers@FreeBSD.ORG Sat Jul 2 23:37:33 2011 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BB6561065674 for ; Sat, 2 Jul 2011 23:37:33 +0000 (UTC) (envelope-from kabaev@gmail.com) Received: from mail-qw0-f54.google.com (mail-qw0-f54.google.com [209.85.216.54]) by mx1.freebsd.org (Postfix) with ESMTP id 714218FC12 for ; Sat, 2 Jul 2011 23:37:33 +0000 (UTC) Received: by qwc9 with SMTP id 9so2802636qwc.13 for ; Sat, 02 Jul 2011 16:37:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:in-reply-to:references:x-mailer :mime-version:content-type; bh=mWOuVUVDd3sQqaOpfww+VYuKkMLEhFrxfUSt4x+t+bg=; b=ma0YhNaOpQ89gX2z067hvS8doIzf4ZOMWUxOhjMU9973S2nxe9JS1F1ed6v/Wm14sI Pu6EPS93OnxwKl5ca94+TTX/CLSMdXYtbI2YsTMgj0hl9Psp0d9EslCci4DbWrqMtXFT QwGrzMfe57439PwMGgiNdyLJfrcdkE+j6GUoM= Received: by 10.224.2.130 with SMTP id 2mr707717qaj.145.1309649852773; Sat, 02 Jul 2011 16:37:32 -0700 (PDT) Received: from kan.dnsalias.net (c-24-63-226-98.hsd1.ma.comcast.net [24.63.226.98]) by mx.google.com with ESMTPS id i7sm2132180qcb.22.2011.07.02.16.37.30 (version=SSLv3 cipher=OTHER); Sat, 02 Jul 2011 16:37:31 -0700 (PDT) Date: Sat, 2 Jul 2011 19:37:24 -0400 From: Alexander Kabaev To: Robert Millan Message-ID: <20110702193724.5c55a6c9@kan.dnsalias.net> In-Reply-To: References: X-Mailer: Claws Mail 3.7.9 (GTK+ 2.22.1; amd64-portbld-freebsd9.0) Mime-Version: 1.0 Content-Type: multipart/signed; micalg=PGP-SHA1; boundary="Sig_/3HvI1cYopZiG0sWUe_I2/=u"; protocol="application/pgp-signature" Cc: freebsd-hackers@freebsd.org Subject: Re: [PATCH] __FreeBSD_kernel__ X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 02 Jul 2011 23:37:33 -0000 --Sig_/3HvI1cYopZiG0sWUe_I2/=u Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Sat, 2 Jul 2011 17:41:03 +0200 Robert Millan wrote: > Since their inception, GNU/kFreeBSD systems had defined > "__FreeBSD_kernel__" as builtin macro to indicate this is a system > that uses the kernel of FreeBSD. We couldn't define "__FreeBSD__" > because this implies a full FreeBSD system, and a lot of software > checks for this macro when it is concerned with userland (usually > libc). >=20 > As a result of this, and of the considerable porting effort that > followed, many 3rd party programs with kernel-specific extensions have > been ported to recognize __FreeBSD_kernel__ as well. E.g.: >=20 > #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) > // code for FreeBSD kernel > #endif >=20 > My request is that FreeBSD also defines __FreeBSD_kernel__. If this > happens, life would be made a bit easier on both sides, as it'd be > more natural for porters of either system to support both using a > single macro [1]. >=20 > [1] When porting software to support FreeBSD and systems with kernel > of FreeBSD myself (as I did with e.g. GRUB), I generally took care to > ensure both macros are checked for, but this isn't always the case. > Having a unified macro would make it easier for developers of both > systems to cooperate. >=20 > --=20 > Robert Millan I do not think this belongs in GCC at all. You should already have a defined symbol to identify your OS and that should be used in cases where it matters. Alternatively, you should provide the symbol in similar way in which we provide __FreeBSD_version, through well-known header like sys/param.h and not pollute GCC. GCC is on the way to be pushed out into ports in FreeBSD and it will not the the only usable compiler before long. Your proposal will force similar changes in Clang, Path64 and PCC, , to be really universal which is not practical. All IMHO. --=20 Alexander Kabaev --Sig_/3HvI1cYopZiG0sWUe_I2/=u Content-Type: application/pgp-signature; name=signature.asc Content-Disposition: attachment; filename=signature.asc -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.17 (FreeBSD) iD8DBQFOD6u5Q6z1jMm+XZYRAnvBAKDOKiLssa0qHDhU5vtPs1yIBfopDQCfaCjc D0u+O7Ox/7CyStJHv4D7okY= =AaJt -----END PGP SIGNATURE----- --Sig_/3HvI1cYopZiG0sWUe_I2/=u--