Open Quuxplusone opened 10 years ago
Bugzilla Link | PR20983 |
Status | REOPENED |
Importance | P release blocker |
Reported by | Yuri (yuri@tsoft.com) |
Reported on | 2014-09-17 15:31:05 -0700 |
Last modified on | 2014-09-18 22:16:15 -0700 |
Version | trunk |
Hardware | PC FreeBSD |
CC | llvm-bugs@lists.llvm.org, rnk@google.com |
Fixed by commit(s) | |
Attachments | |
Blocks | |
Blocked by | |
See also |
Clang defaults to C99, and gcc to C89 with gnu inline rules, which are
incompatible.
The program as written is ill-formed in C99 because it doesn't provide a strong
definition for setRGB. Simply add 'static' if setRGB is local to the TU or
redeclare it without inline after the definition if it is not.
This is a FAQ:
http://clang.llvm.org/compatibility.html#inline
I would like to suggest that compiler issues a warning (or an error) in such case.
It sees the function is declared inline, defined inline, and used, it knows that this function is essentially unusable under the C99 standard, so it should say:
module.c:NN: warning: Function 'setRGB' lacks the strong definition, required by C99 standard.
This situation may and will cause user questions, because the linker error isn't descriptive enough.