Clang warning: A attribute ignored on inline function [-Wignored-attributes] (warn_attribute_ignored_on_inline)
Jump to navigation
Jump to search
Text | error: A attribute ignored on inline function |
---|---|
Type | Warning |
Category | Semantic Issue |
Internal Id | warn_attribute_ignored_on_inline |
Active by Default | Yes |
Flags | -Wno-attributes (85 elements) -Wno-ignored-attributes (84 elements) |
Internal Message | %0 attribute ignored on inline function
|
Regular Expression | (?:warning|error|fatal error)\: (.*?) attribute ignored on inline function \[(?:\-Werror,)?\-Wignored\-attributes[^\]]*\]
|
First Commit | 2014-11-03 606bd6dcc547 Don't dllimport inline functions when targeting MinGW (PR21366) |
Description
Example
Flags | -xc++ -target i686-pc-windows-gnu
|
|
---|---|---|
Source |
__attribute__((dllimport)) inline void f() {}
// dllimport on inline function
| |
Compiler Output |
<source>:1:16: warning: 'dllimport' attribute ignored on inline function [-Wignored-attributes] |
Clang Internals (17.0.6)
Git Commit Message
Don't dllimport inline functions when targeting MinGW (PR21366) It turns out that MinGW never dllimports of exports inline functions. This means that code compiled with Clang would fail to link with MinGW-compiled libraries since we might try to import functions that are not imported. To fix this, make Clang never dllimport inline functions when targeting MinGW. llvm-svn: 221154
Used in Clang Sources
This section lists all occurrences of the diagnostic within the Clang's codebase. For each occurrence, an auto-extracted snipped from the source code is listed including key elements like control structures, functions, or classes. It should illustrate the conditions under which the diagnostic is activated.
clang/lib/Sema/SemaDeclAttr.cpp (line 8039)
static void handleDLLAttr(Sema &S, Decl *D, const ParsedAttr &A) {
// ...
if (const auto *FD = dyn_cast<FunctionDecl>(D)) {
if (FD->isInlined() && A.getKind() == ParsedAttr::AT_DLLImport && !(S.Context.getTargetInfo().shouldDLLImportComdatSymbols())) {
// ...
S.Diag(A.getRange().getBegin(), diag::warn_attribute_ignored_on_inline) << A;
Triggered in Clang Tests
This section lists all internal Clang test cases that trigger the diagnostic.
clang/test/Sema/dllimport.c
- clang/test/Sema/dllimport.c:172:12: warning: 'dllimport' attribute ignored on inline function [-Wignored-attributes]
- clang/test/Sema/dllimport.c:173:28: warning: 'dllimport' attribute ignored on inline function [-Wignored-attributes]
- clang/test/Sema/dllimport.c:217:12: warning: 'dllimport' attribute ignored on inline function [-Wignored-attributes]