[LLVMbugs] [Bug 10233] New: extern keyword for inline definition should trigger function emission
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Thu Jun 30 15:30:57 PDT 2011
http://llvm.org/bugs/show_bug.cgi?id=10233
Summary: extern keyword for inline definition should trigger
function emission
Product: clang
Version: trunk
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P
Component: -New Bugs
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: nlewycky at google.com
CC: llvmbugs at cs.uiuc.edu
This file:
inline double ms2kph(double ms)
{
return (ms * 3.6);
}
extern double ms2kph(double ms);
when compiled in C99 mode should produce a definition of ms2kph, but it does
not. GCC gets this right:
nlewycky at ducttape:~$ gcc -std=c99 z.c -c -o z.o
nlewycky at ducttape:~$ nm z.o
0000000000000000 T ms2kph
nlewycky at ducttape:~$ clang -std=c99 z.c -c -o z.o
nlewycky at ducttape:~$ nm z.o
nlewycky at ducttape:~$
The relevant rule in C99 6.7.4/6 is "If all of the file scope declarations for
a function in a translation unit include the inline function specifier without
extern, then the definition in that translation unit is an inline definition.
An inline definition does not provide an external definition ...".
The example in para 7/8 makes the intended behaviour much more clear.
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list