2002-04-11 17:37:49

by Rik van Riel

[permalink] [raw]
Subject: [PATCH] remove compiler.h from mmap.c


compiler.h is included via other include files now and its
#include has been removed from most C files, this patch
finishes the job for mm/*

Rik
--
Will hack the VM for food.

http://www.surriel.com/ http://distro.conectiva.com/


diff -Nru a/mm/mmap.c b/mm/mmap.c
--- a/mm/mmap.c Thu Apr 11 14:21:58 2002
+++ b/mm/mmap.c Thu Apr 11 14:21:58 2002
@@ -14,7 +14,6 @@
#include <linux/file.h>
#include <linux/fs.h>
#include <linux/personality.h>
-#include <linux/compiler.h>

#include <asm/uaccess.h>
#include <asm/pgalloc.h>



2002-04-11 17:53:26

by Tom Rini

[permalink] [raw]
Subject: Re: [PATCH] remove compiler.h from mmap.c

On Thu, Apr 11, 2002 at 02:37:23PM -0300, Rik van Riel wrote:

> compiler.h is included via other include files now and its
> #include has been removed from most C files, this patch
> finishes the job for mm/*

What #include file is mm/mmap.c getting <linux/compiler.h> from now?
Hiding (or relying on indirect) #includes isn't always a good thing...

--
Tom Rini (TR1265)
http://gate.crashing.org/~trini/

2002-04-11 17:58:30

by Rik van Riel

[permalink] [raw]
Subject: Re: [PATCH] remove compiler.h from mmap.c

On Thu, 11 Apr 2002, Tom Rini wrote:
> On Thu, Apr 11, 2002 at 02:37:23PM -0300, Rik van Riel wrote:
>
> > compiler.h is included via other include files now and its
> > #include has been removed from most C files, this patch
> > finishes the job for mm/*
>
> What #include file is mm/mmap.c getting <linux/compiler.h> from now?

slab.h -> mm.h -> sched.h -> kernel.h -> compiler.h

> Hiding (or relying on indirect) #includes isn't always a good thing...

Absolutely agreed, but likely/unlikely is such low-level
stuff that it shouldn't be included directly into .c files,
IMHO.

regards,

Rik
--
Will hack the VM for food.

http://www.surriel.com/ http://distro.conectiva.com/

2002-04-12 04:52:53

by Paul Mackerras

[permalink] [raw]
Subject: Re: [PATCH] remove compiler.h from mmap.c

Rik van Riel writes:

> Absolutely agreed, but likely/unlikely is such low-level
> stuff that it shouldn't be included directly into .c files,
> IMHO.

mm/mmap.c uses unlikely (line 570). Therefore it should include
compiler.h itself IMHO, not rely on some other header to include it.
I think that each .c and .h file should include the headers that
define the things it uses, but should not have to include headers just
to define things that subsequent headers use.

Regards,
Paul.