linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Wade Cline <clinew@linux.vnet.ibm.com>
To: linux-btrfs@vger.kernel.org, cmm@linux.vnet.ibm.com
Subject: Re: [RFC][PATCH] Btrfs-progs: Fix compiler warnings on PPC64.
Date: Fri, 14 Sep 2012 10:13:13 -0700	[thread overview]
Message-ID: <505365A9.2080900@linux.vnet.ibm.com> (raw)
In-Reply-To: <20120914135919.GN17430@twin.jikos.cz>

On 09/14/2012 06:59 AM, David Sterba wrote:
> On Wed, Sep 12, 2012 at 04:21:56PM -0700, clinew@linux.vnet.ibm.com wrote:
>> Defining __KERNEL__ before the file<asm/types.h>, or any file that
>> includes this file, will let PPC64 know to use unsigned long long
>> for u64 instead. This patch adds the defines and fixes the print
>> warnings on PPC64.
> Defining __KERNEL__ in random places does not seem clean, I understand
> it in kerncompat.h which should transparently fix any compatibility
> issues, and the files like cmd-receive.c should include this instead of
> the explicit defines.
>
>
> david
>

I agree that defining __KERNEL__ does not seem clean, but the problem is 
that
the various include files sort of "race" to include the type definition. 
For example,
in cmds-scrub.c:

#include <sys/ioctl.h>
#include <sys/wait.h>
#define __KERNEL__
#include <sys/stat.h>

will generate compiler warnings while:

#include <sys/ioctl.h>
#define __KERNEL__
#include <sys/wait.h>
#include <sys/stat.h>

will not. By the time kerncompat.h is included, u64 is almost always 
defined to
the non-compatible value. So either kerncompat.h needs to be defined as 
the -first-
included header file, or __KERNEL__ needs to be defined.

...it would also be possible to do something like:

#define __KERNEL__
#include <sys/wait.h>
#undef __KERNEL__

but that seems a bit too hacky.

I'm open to any other ideas, though.

Thank you,
Wade


  reply	other threads:[~2012-09-14 17:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-12 23:21 [RFC][PATCH] Btrfs-progs: Fix compiler warnings on PPC64 clinew
2012-09-14 13:59 ` David Sterba
2012-09-14 17:13   ` Wade Cline [this message]
2012-09-20 14:15     ` David Sterba

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=505365A9.2080900@linux.vnet.ibm.com \
    --to=clinew@linux.vnet.ibm.com \
    --cc=cmm@linux.vnet.ibm.com \
    --cc=linux-btrfs@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).