From rmh@io.debian.net  Fri Feb 10 14:24:44 2006
Return-Path: <rmh@io.debian.net>
Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125])
	by hub.freebsd.org (Postfix) with ESMTP id 7E0D216A420
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 10 Feb 2006 14:24:44 +0000 (GMT)
	(envelope-from rmh@io.debian.net)
Received: from io.debian.net (io.ethz.ch [129.132.80.17])
	by mx1.FreeBSD.org (Postfix) with ESMTP id 26AF043D45
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 10 Feb 2006 14:24:44 +0000 (GMT)
	(envelope-from rmh@io.debian.net)
Received: from rmh by io.debian.net with local (Exim 4.60)
	(envelope-from <rmh@io.debian.net>)
	id 1F7ZCU-000KFz-UG
	for FreeBSD-gnats-submit@freebsd.org; Fri, 10 Feb 2006 15:24:42 +0100
Message-Id: <E1F7ZCU-000KFz-UG@io.debian.net>
Date: Fri, 10 Feb 2006 15:24:42 +0100
From: Robert Millan <rmh@aybabtu.com>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: [PATCH] add __FreeBSD_kernel__ to pre-defines
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         93127
>Category:       gnu
>Synopsis:       [patch] add __FreeBSD_kernel__ to pre-defines
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    rmh
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Fri Feb 10 14:30:03 GMT 2006
>Closed-Date:    Mon Jun 17 21:07:36 UTC 2013
>Last-Modified:  Mon Jun 17 21:07:36 UTC 2013
>Originator:     Robert Millan
>Release:        
>Organization:
>Environment:
System: GNU/kFreeBSD io.debian.net 5.4-1-586 #0 Mon Dec 5 19:45:10 CET 2005 i586 i386 AMD-K6(tm) 3D processor GNU/kFreeBSD
Architecture: i586

	
>Description:
Please could you consider adding __FreeBSD_kernel__ to the list of gcc pre-defines?  This macro is
used by GNU/kFreeBSD to allow programs to determine the kernel regardless of its userland.

Currently, programs have to check things like this:

#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
[ code specific to kernel of FreeBSD ]
#endif

When FreeBSD defines __FreeBSD_kernel__, it'll be much simpler:

#ifdef __FreeBSD_kernel__
[ code specific to kernel of FreeBSD ]
#endif

>How-To-Repeat:
	
>Fix:

Index: contrib/gcc/config/freebsd-spec.h
===================================================================
RCS file: /home/ncvs/src/contrib/gcc/config/freebsd-spec.h,v
retrieving revision 1.22
diff -u -r1.22 freebsd-spec.h
--- contrib/gcc/config/freebsd-spec.h	30 Oct 2005 19:04:47 -0000	1.22
+++ contrib/gcc/config/freebsd-spec.h	10 Feb 2006 14:16:04 -0000
@@ -54,6 +54,7 @@
   do									\
     {									\
 	builtin_define_with_int_value ("__FreeBSD__", FBSD_MAJOR);	\
+	builtin_define ("__FreeBSD_kernel__");				\
 	builtin_define_std ("unix");					\
 	builtin_define ("__KPRINTF_ATTRIBUTE__");		       	\
 	builtin_assert ("system=unix");					\
>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->rmh 
Responsible-Changed-By: emaste 
Responsible-Changed-When: Fri Nov 30 20:37:53 UTC 2012 
Responsible-Changed-Why:  
Submitter is now a committer, and can follow up with the details of this 
change. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=93127 
State-Changed-From-To: open->closed 
State-Changed-By: rmh 
State-Changed-When: Mon Jun 17 21:07:35 UTC 2013 
State-Changed-Why:  
After discussion, different solution was adopted (see rev 227827) 

http://www.freebsd.org/cgi/query-pr.cgi?pr=93127 
>Unformatted:
