On 7/29/22 3:12 AM, Quentin Monnet wrote:
On 28/07/2022 19:25, Yonghong Song wrote:
On 7/28/22 9:56 AM, Jörn-Thorben Hinz wrote:
Hi,
after compiling a skeleton-using program with -pedantic once and
stumbling across a tiniest incorrectness in skeletons with it[1], I was
debating whether it makes sense to suppress warnings from skeleton
headers.
Happy about comments about this. This change might be too suppressive
towards warnings and maybe ignoring only -Woverlength-strings directly
in OBJ_NAME__elf_bytes() be a better idea. Or keep all warnings from
skeletons available as-is to have them more visible in and around
bpftool’s development.
This is my 2cents. As you mentioned, skeleton file are per program
and not in system header file directory. I would like not to mark
these header files as system files. Since different program will
generate different skeleton headers, suppressing warnings
will prevent from catching potential issues in certain cases.
Also, since the warning is triggered by extra user flags like -pedantic
when building bpftool, user can also add -Wno-overlength-strings
in the extra user flags.
I agree with Yonghong, I don't think it's a good idea to mark the whole
file as a system header. I would maybe consider the other solution where
we can disable the warning locally in the skeleton, just around
OBJ_NAME__elf_bytes() as you suggested. Although I suppose we'd need
several pragmas if we want to silence it for GCC and clang, for example?
It looks like your patch was only addressing GCC?
Quentin, "#pragma GCC system_header" also works for clang. Basically
clang implemented system_header pragma identical to gcc counterpart.
Thanks for the contribution,
Quentin