mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Kyle Moffett <mrmacman_g4@mac.com>
To: David Woodhouse <dwmw2@infradead.org>
Cc: Ismail Donmez <ismail@pardus.org.tr>,
	LKML <linux-kernel@vger.kernel.org>,
	mchehab@infradead.org
Subject: Re: __STRICT_ANSI__ checks in headers
Date: Fri, 15 Sep 2006 09:27:32 -0400	[thread overview]
Message-ID: <96EE18FA-1682-4C73-B204-98DA3F525F90@mac.com> (raw)
In-Reply-To: <1158302578.4312.166.camel@pmac.infradead.org>

On Sep 15, 2006, at 02:42:58, David Woodhouse wrote:
> On Fri, 2006-09-15 at 09:01 +0300, Ismail Donmez wrote:
>> Kernel headers currently uses __STRICT_ANSI__ check before  
>> defining a long
>> long variable because ANSI-C doesn't allow long long variables.  
>> But this
>> seems to harsh because any project including linux/videodev2.h  
>> ( and similar
>> ones ) and using -ansi flag will not compile because some types  
>> like __s64
>> will not be defined.
>
> One possible fix is to let videodev2.h use int64_t, and in userspace
> they can include <stdint.h>
>
> Another is just to declare videodev2.h incompatible with -ansi, or  
> maybe
> just omit 'value64' from the union if __STRICT_ANSI__ is defined, and
> replace it with an array of two __s32s.

A mildly better alternative is (on 32-bit architectures, 64-bit archs  
have no problem) change the typedef from this:

> #if defined(__GNUC__) && !defined(__STRICT_ANSI__)
> typedef unsigned long long __u64;
> typedef   signed long long __s64;
> #endif

to this:

> #if defined(__GNUC__)
> __extension__ typedef unsigned long long __u64;
> __extension__ typedef   signed long long __s64;
> #endif

GCC always supports __extension__ to indicate not to warn or error on  
GCC-only extensions.  You only have to declare __extension__ on the  
typedef, any uses are considered OK.  I think this also works for  
code-expressions like this:

> int x = __extension__ ({ foo(); 1; })

but I don't remember exactly.  In certain really complex expressions  
GCC can get confused and give bogus errors, but as long as you don't  
start sprinkling it in macros you should be fine.

Cheers,
Kyle Moffett


  reply	other threads:[~2006-09-15 13:27 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200609150901.33644.ismail@pardus.org.tr>
2006-09-15  6:42 ` David Woodhouse
2006-09-15 13:27   ` Kyle Moffett [this message]
     [not found]     ` <200609211200.25214.ismail@pardus.org.tr>
2006-09-21  9:02       ` David Woodhouse
2006-09-21 12:53         ` Ismail Donmez
2006-09-28  7:03           ` Ismail Donmez
2006-09-28  7:06             ` David Woodhouse
2006-09-28  7:30               ` Ismail Donmez
2006-10-01  4:53                 ` Andrew Morton
2006-10-01  5:20                   ` Kyle Moffett
2006-10-01  7:34                     ` Ismail Donmez
2006-10-01  9:14                       ` Sam Ravnborg
2006-10-01 12:54                         ` Ismail Donmez
2006-10-05  8:16                         ` Ismail Donmez
2006-10-05  8:56                           ` Kyle Moffett
2006-10-06  8:26                           ` David Woodhouse
2006-10-07  7:17                             ` Kyle Moffett

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=96EE18FA-1682-4C73-B204-98DA3F525F90@mac.com \
    --to=mrmacman_g4@mac.com \
    --cc=dwmw2@infradead.org \
    --cc=ismail@pardus.org.tr \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mchehab@infradead.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

all inboxes | Powered by JetHome®