================ @@ -0,0 +1,6 @@ +// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -std=c11 -pedantic-errors -verify %s ---------------- Susikrishna wrote:
Hi @AaronBallman, Thanks for the review. I checked it, and it seems the diagnostic is intentionally target-dependent. I'd be grateful if you could sanity-check my reasoning below: My understanding is that this all comes down to the behavior of isFunctionDefinitionDiscarded() in [this block in SemaDecl.cpp](https://github.com/llvm/llvm-project/blob/c0e4bced616cffe01dd6816638355ae14ced528a/clang/lib/Sema/SemaDecl.cpp#L8110C1-L8127C4): - On Windows (MSVC): Clang emulates the MSVC model, where inline acts like C++ and is the "real" external definition. The linker just merges all the identical copies. Because this definition is not "discardable," isFunctionDefinitionDiscarded() returns false, and our diagnostic (correctly) doesn't fire. - On Linux (GNU): Clang uses the C99 model, where inline is just a "discardable copy" that's separate from the "real" definition. Because this definition is "discardable," isFunctionDefinitionDiscarded() returns true, which is what triggers our ExtWarn. So, it seems the CI failed on Windows simply because, under MSVC's rules, this code isn't an error. If that sounds right, then adding the -triple x86_64-pc-linux-gnu to the test file feels like the correct solution, as it forces the test to check against the GNU/C99 semantics we're actually trying to fix. I'm not completely sure if this is the standard way to handle a target-specific test, though. Please let me know if there's a better approach! https://github.com/llvm/llvm-project/pull/166332 _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
