Skip to contentSkip to conversation

Warn for extern prototypes

DISCUSSION Sam Ravnborg 2 participants 3 messages Apr 30, 2014 Sparse checker

lore
Share & tools
lore
#0 lore raw

Hi all.

Is it possible to get a warning when sparse encounter a function prototype declared using "extern"?

So the following code:

extern void foo(void);
void bar(int x);

Would generate warnings because the declaration of foo() uses extern.

I took a very short peek at evaluate.c - but decided to ask as maybe there is already something that I overlooked or it is maybe trivial.

The rationale behind this is that at least in some areas of the kernel, the use of "extern" for prototypes are no longer accepted.
A sparse warnings would be good to tell me all the cases I missed in the conversion.

Sam

#1 lore raw
Quoted 4 lines · Sam Ravnborg

The rationale behind this is that at least in some areas of the kernel, the use of "extern" for prototypes are no longer accepted.
A sparse warnings would be good to tell me all the cases I missed in the conversion.

Doesn't checkpatch.pl already check for this?

regards,
dan carpenter

#2 lore raw
Quoted 7 lines · Dan Carpenter
Quoted 4 lines · Sam Ravnborg

The rationale behind this is that at least in some areas of the kernel, the use of "extern" for prototypes are no longer accepted.
A sparse warnings would be good to tell me all the cases I missed in the conversion.

Doesn't checkpatch.pl already check for this?

checkpatch --strict -f foo.h will include this check.

But then there are so much other noise...

It is much simpler to do:

make C=2 arch/sparc/

and the process the sparse warnings.

Sam