linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Martin Schlemmer <azarah@gentoo.org>
To: "David S. Miller" <davem@redhat.com>
Cc: KML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] 2.4.21-rc1: byteorder.h breaks with __STRICT_ANSI__ defined (trivial)
Date: Thu, 06 Nov 2003 22:29:12 +0200	[thread overview]
Message-ID: <1068150552.12287.349.camel@nosferatu.lan> (raw)
In-Reply-To: <20031106120548.097ccc7c.davem@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1686 bytes --]

On Thu, 2003-11-06 at 22:05, David S. Miller wrote:
> On Thu, 06 Nov 2003 22:09:29 +0200
> Martin Schlemmer <azarah@gentoo.org> wrote:
> 
> > On Thu, 2003-11-06 at 21:37, David S. Miller wrote:
> > > Let's say that you end up using some inline function
> > > that takes u32 arguments, and internally it uses
> > > u64 types to speed up the calculation or make it more
> > > accurate or something like that.
> > 
> > So basically only in cases where the stuff in byteorder.h
> > was not inlined ... ?
> 
> No, exactly in the cases where it _IS_ inlined.  Imagine
> this:
> 
> static inline u32 swab_foo(u32 a, u32 b)
> {
> 	u64 tmp = ((u64)a<<32) | ((u64)b);
> 	u32 retval;
> 
> 	retval = compute(tmp);
> 
> 	return retval;
> }
> 
> If that's in a kernel header somewhere, and you build with -ansi,
> you lose.

If you look at asm/types.h, u64 is kernel only namespace, so in
theory that code will not be in userspace.  Also, the whole idea
of this patch (the first one that touched byteorder.h, and not the
second that touched types.h), was to encase everything that used
__u64 that _is_ in userspace in __STRICT_ANSI__.  If there thus
was another place that did use __u64 outside a ifdef __STRICT_ANSI__,
the compile would anyhow stop with -ansi.

Your above example would thus look more like:

--
#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
static inline __u32 swab_foo(__u32 a, __u32 b)
{
	__u64 tmp = ((__u64)a<<32) | ((__u64)b);
	__u32 retval;

	retval = compute(tmp);

	return retval;
}
#else
<code without __u64>
..
#endif
--

which in theory should not have an issue.


Thanks,

-- 

Martin Schlemmer




[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

  reply	other threads:[~2003-11-06 20:28 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-11-06 17:36 [PATCH] 2.4.21-rc1: byteorder.h breaks with __STRICT_ANSI__ defined (trivial) Martin Schlemmer
2003-11-06 17:37 ` David S. Miller
2003-11-06 18:32   ` Martin Schlemmer
2003-11-06 18:42     ` Martin Schlemmer
2003-11-06 19:37       ` David S. Miller
2003-11-06 20:09         ` Martin Schlemmer
2003-11-06 20:05           ` David S. Miller
2003-11-06 20:29             ` Martin Schlemmer [this message]
2003-11-06 20:27               ` David S. Miller
2003-11-06 21:18                 ` Martin Schlemmer
2003-11-06 21:18                   ` David S. Miller
2003-11-06 21:59                     ` Martin Schlemmer
2003-11-06 21:24                   ` Daniel Jacobowitz
2003-11-06 20:40               ` H. Peter Anvin
2003-11-06 22:31                 ` David S. Miller
2003-11-06 23:40                   ` H. Peter Anvin
2003-11-06 21:21             ` Daniel Jacobowitz
     [not found]   ` <1068489427.7910.147.camel@nosferatu.lan>
     [not found]     ` <3FAFE1E2.2020000@zytor.com>
     [not found]       ` <1068589739.19849.2.camel@nosferatu.lan>
     [not found]         ` <20031111145805.45206335.davem@redhat.com>
2003-11-15 13:09           ` [PATCH 2.4] " Martin Schlemmer
2003-11-15 13:24           ` [PATCH 2.6] " Martin Schlemmer
     [not found] <20030506110259.A29633@infradead.org>
2003-05-06 10:24 ` [PATCH] 2.4.21-rc1: " Thomas Horsten
  -- strict thread matches above, loose matches on Subject: below --
2003-05-06  9:16 Thomas Horsten
2003-05-06  9:19 ` David S. Miller
2003-05-06  9:38 ` Christoph Hellwig
2003-05-06  9:47   ` Thomas Horsten
2003-05-06  9:49     ` Christoph Hellwig
2003-05-06 10:03       ` David S. Miller
2003-05-06 14:10         ` Thomas Horsten
2003-05-06 13:06           ` David S. Miller
2003-05-06 15:40             ` Thomas Horsten
2003-05-07  5:50               ` ismail (cartman) donmez
2003-05-07  6:44                 ` Thomas Horsten
2003-05-07  6:45                   ` Christoph Hellwig
2003-05-07  5:44                     ` David S. Miller
2003-05-07  6:55                       ` Christoph Hellwig
2003-05-07  6:59                     ` Thomas Horsten
2003-05-07  5:53                       ` David S. Miller
2003-05-06 21:19           ` David Woodhouse
2003-05-07  3:06             ` David S. Miller
2003-05-07  5:26               ` Christoph Hellwig
2003-05-07  5:07                 ` David S. Miller
2003-05-07  6:20                   ` Christoph Hellwig
2003-05-07  5:19                     ` David S. Miller
2003-05-07  6:28                       ` Christoph Hellwig
2003-05-07  5:27                         ` David S. Miller
2003-05-07  6:41                           ` Christoph Hellwig
2003-05-07  5:42                             ` David S. Miller

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=1068150552.12287.349.camel@nosferatu.lan \
    --to=azarah@gentoo.org \
    --cc=davem@redhat.com \
    --cc=linux-kernel@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).