public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "egallager at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/105939] New: "warning: anonymous struct declared inside parameter list will not be visible outside of this definition or declaration" should have a warning flag attached to it
Date: Mon, 13 Jun 2022 00:37:22 +0000	[thread overview]
Message-ID: <bug-105939-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 105939
           Summary: "warning: anonymous struct declared inside parameter
                    list will not be visible outside of this definition or
                    declaration" should have a warning flag attached to it
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Keywords: diagnostic
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: egallager at gcc dot gnu.org
            Blocks: 44209
  Target Milestone: ---

This is a more specific example of bug 44209. Code taken from here:
https://twitter.com/icculus/status/1536140541200584710

$ cat icculus_twitter_thread.c
#include <stdio.h>

int main(void) {
    int x = 0;
    do printf("%d\n", x++); while (x < 10);
    return 0;
}

const const const static const inline int xx;

xxx();

int xxxx(struct { int a; int b; } x) {}
$ /usr/local/bin/gcc -c -Wall -Wextra -Wshadow -pedantic -Wconversion
-Wold-style-definition -Wold-style-declaration -Wduplicated-branches
-Wduplicated-cond -Wlogical-op -Wnull-dereference -Wc++-compat -Wnested-externs
-Wstrict-prototypes -Wmissing-declarations -Wmissing-prototypes
icculus_twitter_thread.c
icculus_twitter_thread.c:9:7: warning: duplicate 'const' declaration specifier
[-Wduplicate-decl-specifier]
    9 | const const const static const inline int xx;
      |       ^~~~~
icculus_twitter_thread.c:9:13: warning: duplicate 'const' declaration specifier
[-Wduplicate-decl-specifier]
    9 | const const const static const inline int xx;
      |             ^~~~~
icculus_twitter_thread.c:9:1: warning: 'static' is not at beginning of
declaration [-Wold-style-declaration]
    9 | const const const static const inline int xx;
      | ^~~~~
icculus_twitter_thread.c:9:26: warning: duplicate 'const' declaration specifier
[-Wduplicate-decl-specifier]
    9 | const const const static const inline int xx;
      |                          ^~~~~
icculus_twitter_thread.c:9:1: warning: 'inline' is not at beginning of
declaration [-Wold-style-declaration]
    9 | const const const static const inline int xx;
      | ^~~~~
icculus_twitter_thread.c:9:43: warning: variable 'xx' declared 'inline'
    9 | const const const static const inline int xx;
      |                                           ^~
icculus_twitter_thread.c:9:43: warning: uninitialized 'const xx' is invalid in
C++ [-Wc++-compat]
icculus_twitter_thread.c:11:1: warning: data definition has no type or storage
class
   11 | xxx();
      | ^~~
icculus_twitter_thread.c:11:1: warning: type defaults to 'int' in declaration
of 'xxx' [-Wimplicit-int]
icculus_twitter_thread.c:11:1: warning: function declaration isn't a prototype
[-Wstrict-prototypes]
icculus_twitter_thread.c:13:10: warning: anonymous struct declared inside
parameter list will not be visible outside of this definition or declaration
   13 | int xxxx(struct { int a; int b; } x) {}
      |          ^~~~~~
icculus_twitter_thread.c:13:5: warning: no previous prototype for 'xxxx'
[-Wmissing-prototypes]
   13 | int xxxx(struct { int a; int b; } x) {}
      |     ^~~~
icculus_twitter_thread.c: In function 'xxxx':
icculus_twitter_thread.c:13:35: warning: unused parameter 'x'
[-Wunused-parameter]
   13 | int xxxx(struct { int a; int b; } x) {}
      |          ~~~~~~~~~~~~~~~~~~~~~~~~~^
icculus_twitter_thread.c:13:39: warning: control reaches end of non-void
function [-Wreturn-type]
   13 | int xxxx(struct { int a; int b; } x) {}
      |                                       ^
icculus_twitter_thread.c: At top level:
icculus_twitter_thread.c:9:43: warning: 'xx' defined but not used
[-Wunused-const-variable=]
    9 | const const const static const inline int xx;
      |                                           ^~
$

Should I open separate bugs for how the warnings that say "warning: variable
'xx' declared 'inline'" and "warning: data definition has no type or storage
class" don't have flags linked to them as well? Or can we track those here,
too?


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44209
[Bug 44209] [meta-bug] Some warnings are not linked to diagnostics options

             reply	other threads:[~2022-06-13  0:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-13  0:37 egallager at gcc dot gnu.org [this message]
2022-06-13  1:06 ` [Bug c/105939] " egallager at gcc dot gnu.org

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-105939-4@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).