include/linux/bio.h: "extern inline" -> "static inline"
PATCH 1/1 include/linux/bio.h: "extern inline" -> "static inline"
"extern inline" doesn't make much sense.
---
include/linux/bio.h | 7 +++---- 1 files changed, 3 insertions(+), 4 deletions(-)
include/linux/bio.h renamed from include/linux/bio.h.old +3 -4
@@ -314,9 +314,8 @@* bvec_kmap_irq and bvec_kunmap_irq!! * * This function MUST be inlined - it plays with the CPU interrupt flags. -* Hence the `extern inline'. */ -extern inline char *bvec_kmap_irq (struct bio_vec *bvec,unsigned long *flags) +static inline char *bvec_kmap_irq (struct bio_vec *bvec,unsigned long *flags) {unsigned long addr;
@@ -332,7 +331,7 @@return (char *) addr + bvec->bv_offset; } -extern inline void bvec_kunmap_irq (char *buffer,unsigned long *flags) +static inline void bvec_kunmap_irq (char *buffer,unsigned long *flags) {unsigned long ptr = (unsigned long ) buffer &PAGE_MASK ;
@@ -345,7 +344,7 @@#define bvec_kunmap_irq (buf, flags) do { *(flags) = 0; } while (0)#endif -extern inline char *__bio_kmap_irq (struct bio *bio,unsigned short idx, +static inline char *__bio_kmap_irq (struct bio *bio,unsigned short idx,unsigned long *flags) {return bvec_kmap_irq (bio_iovec_idx (bio, idx), flags);
Quoted 1 line · Adrian Bunk
"extern inline" doesn't make much sense.
The gcc info here (4.0.1-4 on Fedora rawhide) says it means that the function should be inlined, and no local copy should be generated ever. This way the build will bomb out when something isn't inlined.
It also says you should use:
static inline void foo(some args) __attribute__((always_inline));
as a prototype in this case for future proofing (gcc inlining is not C99 compatible!), but I don't know if that is supported as far back as 2.95.3 (as per Documentation/Changes the required compiler).
Side question: Is there anybody still seriously using such ancient compilers? I'd guess almost everybody is using newer versions, so this would really be not a supported combination anymore.
Signature · 4 lines
Dr. Horst H. von Brand User #22616 counter.li.org Departamento de Informatica Fono: +56 32 654431 Universidad Tecnica Federico Santa Maria +56 32 654239 Casilla 110-V, Valparaiso, Chile Fax: +56 32 797513
Quoted 10 lines · Horst von Brand
Quoted 1 line · Adrian Bunk
"extern inline" doesn't make much sense.
The gcc info here (4.0.1-4 on Fedora rawhide) says it means that the function should be inlined, and no local copy should be generated ever. This way the build will bomb out when something isn't inlined.
It also says you should use:
static inline void foo(some args) __attribute__((always_inline));
We are already doing this automatically.
Quoted 3 lines
as a prototype in this case for future proofing (gcc inlining is not C99 compatible!), but I don't know if that is supported as far back as 2.95.3 (as per
Documentation/Changesthe required compiler).
__attribute__((always_inline)) is supported since gcc 3.1 .
Quoted 3 lines
Side question: Is there anybody still seriously using such ancient compilers? I'd guess almost everybody is using newer versions, so this would really be not a supported combination anymore.
gcc 2.95 is still a 100% supported compiler.
Compilation of the complete kernel sources usually works [1] and I know several people still using gcc 2.95 for several reasons.
cu
Adrian
[1] on i386
Signature · 4 lines
"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon SeedQuoted 1 line · Adrian Bunk
"extern inline" doesn't make much sense.
Yep, thanks.
Signature · 1 line
Jens Axboe
Quoted 11 lines · Jens Axboe
Quoted 3 lines · Adrian Bunk
"extern inline" doesn't make much sense.
Yep, thanks.
IIRC, there was a time when the extern inline construct was used to catch cases where the compiler did not inline the function (you'd get a link error). Seems like it still works. Try building the attached files in each of the following ways:
gcc -o foo foo.c
and
gcc -O2 -o foo foo.c
In the first case, you get a link error, because there is no inlining.
-kimball
#include "bar.h"
void foo(void) {
bar();
}int main(int argc, char *argv[])
{
foo();
return 0;
}extern inline void bar(void)
{
}
Quoted 18 lines · Kimball Murray
Quoted 11 lines · Jens Axboe
Quoted 3 lines · Adrian Bunk
"extern inline" doesn't make much sense.
Yep, thanks.
IIRC, there was a time when the extern inline construct was used to catch cases where the compiler did not inline the function (you'd get a link error). Seems like it still works. Try building the attached files in each of the following ways:
Quoted 7 lines
gcc -o foo
foo.cand
gcc -O2 -o foo
foo.cIn the first case, you get a link error, because there is no inlining.
In the kernel, we have a
# define inline inline __attribute__((always_inline))
This doesn't leave gcc any choice to not inline the function.
Quoted 9 lines
-kimball
#include "
bar.h"void foo(void) { bar(); }int
main(int argc, char *argv[])
Quoted 8 lines
{ foo(); return 0; }extern inline void bar(void)
{
}
cu
Adrian
Signature · 4 lines
"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed