public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <dan@debian.org>
To: Linus Torvalds <torvalds@osdl.org>
Cc: Andrew Morton <akpm@osdl.org>, Jeff Chua <jchua@fedex.com>,
	jeffchua@silk.corp.fedex.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] warning: `__attribute_used__' redefined
Date: Tue, 10 Feb 2004 12:10:55 -0500	[thread overview]
Message-ID: <20040210171055.GA32612@nevyn.them.org> (raw)
In-Reply-To: <Pine.LNX.4.58.0402100827100.2128@home.osdl.org>

On Tue, Feb 10, 2004 at 08:31:24AM -0800, Linus Torvalds wrote:
> 
> 
> On Tue, 10 Feb 2004, Andrew Morton wrote:
> > 
> > ah, thanks.
> > 
> > Like this?
> 
> That will just break. The reason for the "compiler.h" include is the 
> "__user" part of fpstate, so now you'll get a parse error later if 
> non-kernel code includes this.
> 
> So the rule should still be: don't include kernel headers from user 
> programs. But if it's needed for some reason, that #ifdef needs to be 
> somewhere else (inside "compiler.h" or something).

This is what Debian has been using.  I believe the other folks with a
glibc-kernel-headers package based on 2.6 do something similar.  I
don't know how you'll feel about adding this sort of crap to the
kernel, though.  Someone else needs to find time to start linuxabi
moving again...

--- include/linux/compiler.h	2003-10-15 11:13:09.000000000 -0400
+++ include/linux/compiler.h.t	2003-11-01 18:04:19.000000000 -0500
@@ -9,6 +9,15 @@
 # define __kernel
 #endif
 
+#if !defined(__KERNEL__)
+/* Debian: Most of these are inappropriate for userspace.  */
+/* We don't define likely, unlikely, or barrier; they're namespace-intrusive
+   and should not be needed outside of __KERNEL__.  For __attribute_pure__
+   and __attribute_used__ we use glibc's definitions.  */
+# include <sys/cdefs.h>
+# define __deprecated
+#else
+
 #if __GNUC__ > 3
 # include <linux/compiler-gcc+.h>	/* catch-all for GCC 4, 5, etc. */
 #elif __GNUC__ == 3
@@ -86,4 +95,6 @@
     (typeof(ptr)) (__ptr + (off)); })
 #endif
 
+#endif /* __KERNEL__ */
+
 #endif /* __LINUX_COMPILER_H */

-- 
Daniel Jacobowitz
MontaVista Software                         Debian GNU/Linux Developer

  reply	other threads:[~2004-02-10 17:15 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-02-10  6:39 [PATCH] warning: `__attribute_used__' redefined Jeff Chua
2004-02-10  6:53 ` Andrew Morton
2004-02-10 13:59   ` Jeff Chua
2004-02-10 16:25     ` Andrew Morton
2004-02-10 16:31       ` Linus Torvalds
2004-02-10 17:10         ` Daniel Jacobowitz [this message]
2004-02-10 17:18           ` Linus Torvalds
2004-02-10 17:28           ` Valdis.Kletnieks
2004-02-10 17:37         ` Andrew Morton
2004-02-11 13:07         ` Jeff Chua

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040210171055.GA32612@nevyn.them.org \
    --to=dan@debian.org \
    --cc=akpm@osdl.org \
    --cc=jchua@fedex.com \
    --cc=jeffchua@silk.corp.fedex.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox