[LLVMdev] darwin dragon-egg build issues

Duncan Sands baldrick at free.fr
Tue Apr 13 07:06:45 PDT 2010


Hi Jack,

>     Doesn't i386_static.diff represent a violation of...
>
> https://www.securecoding.cert.org/confluence/display/seccode/DCL36-C.+Do+not+declare+an+identifier+with+conflicting+linkage+classifications
>
> since it first declares a function as extern and then
> redefines it locally?

I don't think so.  "Redefines it locally" is not the same as giving it internal
linkage.  By the way, if it was a problem, how would header files work?  It is
common practice to declare a function in a header file, eg "header.h" and then
include that header file in the file defining the function, eg "body.c".  For
example:

header.h:

void foo(void);

body.c:

#include "header.h"

void foo(void) {
...
}

After the preprocessor runs, you get:

body.i

void foo(void);

void foo(void) {
...
}

which is equivalent to what you get from my patch.  If this results in
undefined behavior, then a lot of software out there is broken!

Note that AFAIK

void foo(void);

and

extern void foo(void);

are equivalent.

Ciao,

Duncan.



More information about the llvm-dev mailing list