]> gcc.gnu.org Git - gcc.git/commit
attribs: Improve diagnostics
authorJakub Jelinek <jakub@redhat.com>
Fri, 23 Sep 2022 07:10:16 +0000 (09:10 +0200)
committerJakub Jelinek <jakub@redhat.com>
Fri, 23 Sep 2022 07:10:16 +0000 (09:10 +0200)
commit2ec6489d7a595c78cae4584244afd4ca91d6c8ff
treec33aaffb1043c4b6e42f1f31aa54b720b89a1082
parenta282f086ef26d90e9785e992cd09a0d118b24695
attribs: Improve diagnostics

When looking at the attribs code, I've noticed weird diagnostics
like
int a __attribute__((section ("foo", "bar")));
a.c:1:1: error: wrong number of arguments specified for ‘section’ attribute
    1 | int a __attribute__((section ("foo", "bar")));
      | ^~~
a.c:1:1: note: expected between 1 and 1, found 2
As roughly 50% of attributes that accept any arguments have
spec->min_length == spec->max_length, I think it is worth it to have
separate wording for such common case and just write simpler
a.c:1:1: note: expected 1, found 2

2022-09-23  Jakub Jelinek  <jakub@redhat.com>

* attribs.cc (decl_attributes): Improve diagnostics, instead of
saying expected between 1 and 1, found 2 just say expected 1, found 2.
gcc/attribs.cc
This page took 0.051458 seconds and 5 git commands to generate.