[cfe-commits] r158683 - in /cfe/trunk: include/clang/Basic/DiagnosticSemaKinds.td lib/Sema/SemaExpr.cpp test/Sema/inline.c test/SemaCXX/inline.cpp

Jordan Rose jordan_rose at apple.com
Mon Jun 18 15:28:43 PDT 2012


On Jun 18, 2012, at 15:23 , Eli Friedman <eli.friedman at gmail.com> wrote:

> On Mon, Jun 18, 2012 at 3:09 PM, Jordan Rose <jordan_rose at apple.com> wrote:
>> Author: jrose
>> Date: Mon Jun 18 17:09:19 2012
>> New Revision: 158683
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=158683&view=rev
>> Log:
>> Support -Winternal-linkage-in-inline in C++ code.
>> 
>> This includes treating anonymous namespaces like internal linkage, and allowing
>> const variables to be used even if internal. The whole thing's been broken out
>> into a separate function to avoid nested ifs.
> 
> I think it's worth pointing out that in the C++ case, the given
> testcase doesn't strictly violate ODR because the  definition of the
> function in question isn't actually used in multiple files.  Because
> of that, it shouldn't be an error with -pedantic-errors (the
> diagnostic should use Warning rather than Extension/ExtWarn), and you
> should watch to see if there are any bug reports with false positives.
> (I think false positives are unlikely, but not impossible.)

Ah, I see. Without cross-TU analysis, we can't tell if a function is used in multiple files or not. I think it's valid to leave this as ExtWarn when it's in a header fileā€¦it's kind of a ticking time bomb. But in the main source file it's not even Extension.

Jordan



More information about the cfe-commits mailing list