[PATCH] D106614: [Clang] add btf_tag attribute

Yonghong Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Aug 11 17:31:01 PDT 2021


yonghong-song added a comment.

> Assuming I have that correct now, this approach looks correct to me (without diagnosing the ignored duplicates).

I agree that we don't need to diagnose the ignored duplicates. The following is an example,

$ cat t.c
int g __attribute__((section("a"))) __attribute__((section("a")));
$ clang -g -c t.c -Wall -Werror
$

duplicates are silently ignored and there is no warning.

A warning/error will be issued if two section names are different.
$ cat t.c
int g __attribute__((section("a"))) __attribute__((section("b")));
$ clang -g -c t.c -Wall -Werror
t.c:1:22: error: section does not match previous declaration [-Werror,-Wsection]
int g __attribute__((section("a"))) __attribute__((section("b")));

  ^

t.c:1:52: note: previous attribute is here
int g __attribute__((section("a"))) __attribute__((section("b")));

  ^

1 error generated.
$

So for btf_tag attributes, since we just ignore duplicated attributes, we should be fine without emitting any warn/error messages.

> Assuming we're back on the same page again, I think the only thing left in this review is a commenting nit.

There are a couple of nits in AttrDocs.td. Will fix them and resubmit the patch.
Thanks for your careful review!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D106614/new/

https://reviews.llvm.org/D106614



More information about the cfe-commits mailing list