[Bug c/84500] diagnostic says "array of chars" for arrays of wchar_t, char16_t and char32_t

2021-09-24 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84500

--- Comment #5 from Andrew Pinski  ---
(In reply to Jonathan Wakely from comment #4)
> Well Martin suggested it should include the array length, but I'm content
> with not saying "chars".

What is interesting is the C++ front-end with that change got it right (see PR
84501). I have not looked to see if the array length can be there or not.

[Bug c/84500] diagnostic says "array of chars" for arrays of wchar_t, char16_t and char32_t

2021-09-24 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84500

--- Comment #4 from Jonathan Wakely  ---
Well Martin suggested it should include the array length, but I'm content with
not saying "chars".

[Bug c/84500] diagnostic says "array of chars" for arrays of wchar_t, char16_t and char32_t

2021-09-24 Thread pinskia at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84500

--- Comment #3 from Andrew Pinski  ---
We get in GCC 10+ (r10-464-ga9c697b88395a, same revision which fixed PR 84501):

:4:18: warning: initializer-string for array of 'int' is too long
4 |   wchar_t w[3] = L"abcd";
  |  ^~~
:5:21: warning: initializer-string for array of 'short unsigned int' is
too long
5 |   char16_t u16[3] = u"abcd";
  | ^~~
:6:21: warning: initializer-string for array of 'unsigned int' is too
long
6 |   char32_t u32[3] = U"abcd";
  | ^~~

So fixed enough?

[Bug c/84500] diagnostic says "array of chars" for arrays of wchar_t, char16_t and char32_t

2018-02-21 Thread msebor at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84500

Martin Sebor  changed:

   What|Removed |Added

 Status|UNCONFIRMED |NEW
   Last reconfirmed||2018-02-21
 CC||msebor at gcc dot gnu.org
 Ever confirmed|0   |1

--- Comment #2 from Martin Sebor  ---
Confirmed.  I think the warning would be the most informative and the least
vague if it instead used the name of the array type, and also mentioned the
size of the initializer in case it's hidden behind a macro:

  warning: initializer-string for an object of 'wchar_t[3]' has 5 elements

as long as there is a way to get at the name of the typedef.  Otherwise,
printing the underlying type would be an alternative.

[Bug c/84500] diagnostic says "array of chars" for arrays of wchar_t, char16_t and char32_t

2018-02-21 Thread redi at gcc dot gnu.org
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=84500

--- Comment #1 from Jonathan Wakely  ---
Saying "chars" implies narrow characters. The standard uses "character array"
for the general case.