public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "rguenth at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/101446] -Wpedantic causes an error with zero size array
Date: Wed, 14 Jul 2021 09:46:38 +0000	[thread overview]
Message-ID: <bug-101446-4-4dxdfd4AZ0@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-101446-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101446

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-07-14
             Status|RESOLVED                    |NEW
                 CC|                            |jsm28 at gcc dot gnu.org
         Resolution|INVALID                     |---
     Ever confirmed|0                           |1

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
OK, so the complaint is that

> ./cc1 -quiet t.c -pedantic
t.c:1:47: warning: ISO C forbids empty initializer braces [-Wpedantic]
    1 | static const char __gbk_from_ucs4_tab9[][2] = {};
      |                                               ^
t.c:1:19: error: zero or negative size array '__gbk_from_ucs4_tab9'
    1 | static const char __gbk_from_ucs4_tab9[][2] = {};
      |                   ^~~~~~~~~~~~~~~~~~~~

errors and not only -pedantic-errors

> ./cc1 -quiet t.c -pedantic-errors
t.c:1:47: error: ISO C forbids empty initializer braces [-Wpedantic]
    1 | static const char __gbk_from_ucs4_tab9[][2] = {};
      |                                               ^
t.c:1:19: error: zero or negative size array '__gbk_from_ucs4_tab9'
    1 | static const char __gbk_from_ucs4_tab9[][2] = {};
      |                   ^~~~~~~~~~~~~~~~~~~~

-Wpedantic is just an alias for -pedantic - but see the documentation which
explicitely says some constructs are rejected (not only warned on).
-pedantic-errors says

@item -pedantic-errors
@opindex pedantic-errors
Give an error whenever the @dfn{base standard} (see @option{-Wpedantic})
requires a diagnostic, in some cases where there is undefined behavior
at compile-time and in some other cases that do not prevent compilation
of programs that are valid according to the standard. This is not
equivalent to @option{-Werror=pedantic}, since there are errors enabled
by this option and not enabled by the latter and vice versa.

so I still think it works as designed even if the new -Wpedantic alias
suggests that -pedantic is a pure warning option.

  parent reply	other threads:[~2021-07-14  9:46 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-14  8:26 [Bug c/101446] New: " ismail at i10z dot com
2021-07-14  9:35 ` [Bug c/101446] " redi at gcc dot gnu.org
2021-07-14  9:40 ` rguenth at gcc dot gnu.org
2021-07-14  9:42 ` ismail at i10z dot com
2021-07-14  9:42 ` rguenth at gcc dot gnu.org
2021-07-14  9:46 ` rguenth at gcc dot gnu.org [this message]
2021-07-14  9:47 ` ismail at i10z dot com
2021-07-14 10:25 ` ismail at i10z dot com
2021-07-14 15:21 ` joseph at codesourcery dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-101446-4-4dxdfd4AZ0@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).