Skip to content

Report inlining location when using __attribute__((__warning__(msg))) #1571

@kees

Description

@kees

When __warning__(msg) reports from usage within an inline, there's no information about where the inline was used. For example:

gcc says inlined from 'main' at /app/example.c

In file included from /app/example.c:5: In function 'indirection', inlined from 'main' at /app/example.c:9:5: example.h:6:9: error: call to '__write_overflow' declared with attribute warning: eek [-Werror=attribute-warning] 6 | __write_overflow(); | ^~~~~~~~~~~~~~~~~~ 

Clang doesn't include that hint:

In file included from /app/example.c:5: example.h:6:9: error: call to __write_overflow declared with 'warning' attribute: eek [-Werror,-Wattribute-warning] __write_overflow(); ^ 

https://godbolt.org/z/W9PjxsE6z

Which makes FORTIFY_SOURCE warnings much harder to find. :)

In file included from net/mptcp/protocol.c:10: In file included from ./include/linux/module.h:13: In file included from ./include/linux/stat.h:19: In file included from ./include/linux/time.h:60: In file included from ./include/linux/time32.h:13: In file included from ./include/linux/timex.h:65: In file included from ./arch/x86/include/asm/timex.h:5: In file included from ./arch/x86/include/asm/processor.h:22: In file included from ./arch/x86/include/asm/msr.h:11: In file included from ./arch/x86/include/asm/cpumask.h:5: In file included from ./include/linux/cpumask.h:12: In file included from ./include/linux/bitmap.h:11: In file included from ./include/linux/string.h:253: ./include/linux/fortify-string.h:230:4: warning: call to __write_overflow_field declared with 'warning' attribute: detected write beyond size of field (1st parameter); maybe use struct_group()? [-Wattribute-warning] __write_overflow_field(p_size_field, size); ^ 

Metadata

Metadata

Labels

[BUG] llvmA bug that should be fixed in upstream LLVMenhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions