Skip to contentSkip to conversation

include/asm-mips/processor.h: "extern inline" -> "static inline"

PATCH In review Adrian Bunk 3 participants 5 messages Jul 7, 2007 – Jul 9, 2007 MIPS

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 include/asm-mips/processor.h: "extern inline" -> "static inline"

"extern inline" will have different semantics with gcc 4.3, and "static inline" is correct here.

---

include/asm-mips/processor.h renamed from include/asm-mips/processor.h.old +1 -1
@@ -237,7 +237,7 @@
 
 #define ARCH_HAS_PREFETCH
 
-extern inline void prefetch(const void *addr)
+static inline void prefetch(const void *addr)
 {
 	__asm__ __volatile__(
 	"	.set	mips4		\n"
#1 lore raw
Quoted 2 lines · Adrian Bunk

"extern inline" will have different semantics with gcc 4.3, and "static inline" is correct here.

The idea was to have a linker error in case gcc should deciede for some reason not to inline this function which as I understand will continue to be the behaviour of gcc 4.3?

Ralf

#2 lore raw

Hi,

Quoted 9 lines · Ralf Baechle
Quoted 2 lines · Adrian Bunk

"extern inline" will have different semantics with gcc 4.3, and "static inline" is correct here.

The idea was to have a linker error in case gcc should deciede for some reason not to inline this function which as I understand will continue to be the behaviour of gcc 4.3?

I don't know for this peculiar case but it usually is a good thing to let gcc decide if the function needs to be inlined or not.

If we really want this function to be inlined in all cases, maybe we should use __always_inline attribute instead ?

Signature · 1 line
              Franck
#3 lore raw
In reply to Ralf Baechle
Quoted 7 lines · Ralf Baechle
Quoted 2 lines · Adrian Bunk

"extern inline" will have different semantics with gcc 4.3, and "static inline" is correct here.

The idea was to have a linker error in case gcc should deciede for some reason not to inline this function

If that's the intention, please use __always_inline instead.

Quoted 2 lines

which as I understand will continue
to be the behaviour of gcc 4.3?

In C99 (and therefore in gcc >= 4.3), "extern inline" means that the function should be compiled inline where the inline definition is seen, and that the compiler should also emit a copy of the function body with an externally visible symbol.

You don't want this.

Quoted 1 line

Ralf

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
#4 lore raw
Quoted 4 lines · Adrian Bunk

In C99 (and therefore in gcc >= 4.3), "extern inline" means that the function should be compiled inline where the inline definition is seen, and that the compiler should also emit a copy of the function body with an externally visible symbol.

Uh, indeed. Thanks for the reminder. Patch applied.

Ralf