public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/55613] New: Better warning for reference to struct type
@ 2012-12-07 11:58 rui.maciel at gmail dot com
  2012-12-09  0:34 ` [Bug c/55613] Add suggestion of adding struct if the name exists in the struct tag pinskia at gcc dot gnu.org
  2015-09-17 23:34 ` manu at gcc dot gnu.org
  0 siblings, 2 replies; 3+ messages in thread
From: rui.maciel at gmail dot com @ 2012-12-07 11:58 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55613

             Bug #: 55613
           Summary: Better warning for reference to struct type
    Classification: Unclassified
           Product: gcc
           Version: 4.6.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: rui.maciel@gmail.com


Consider the following code:

<code>
struct Foo
{
        int i;
};

int main(void)
{
        Foo foo;
        return 0;
}
</code>

When compiled with gcc 4.6.3, the following error message is displayed:

<message>
main.c: In function ‘main’:
main.c:8:2: error: unknown type name ‘Foo’
</message>

The problem with this code is that Foo isn't preceded by the keyword "struct". 
Yet, as the compiler only returns a vague message about Foo being an unknown
type name, it may mislead the programmer into assuming that the problem might
lie somewhere else, such as a typo somewhere, particularly if the code contains
a significant number of typedef structs.

A significantly better way to handle this error is to warn that the "struct"
keyword is missing.  This happens to be the way other compilers, such as clang,
handle this error.  The following is clang's error message for this scenario:

<message>
main.c:8:2: error: must use 'struct' tag to refer to type 'Foo'
        Foo foo;
        ^
        struct 
1 error generated.
</message>


It would be great if gcc improved its error diagnostics for this error.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c/55613] Add suggestion of adding struct if the name exists in the struct tag
  2012-12-07 11:58 [Bug c/55613] New: Better warning for reference to struct type rui.maciel at gmail dot com
@ 2012-12-09  0:34 ` pinskia at gcc dot gnu.org
  2015-09-17 23:34 ` manu at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu.org @ 2012-12-09  0:34 UTC (permalink / raw)
  To: gcc-bugs


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55613

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
           Keywords|                            |diagnostic
   Last reconfirmed|                            |2012-12-09
     Ever Confirmed|0                           |1
            Summary|Better warning for          |Add suggestion of adding
                   |reference to struct type    |struct if the name exists
                   |                            |in the struct tag
           Severity|normal                      |enhancement


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug c/55613] Add suggestion of adding struct if the name exists in the struct tag
  2012-12-07 11:58 [Bug c/55613] New: Better warning for reference to struct type rui.maciel at gmail dot com
  2012-12-09  0:34 ` [Bug c/55613] Add suggestion of adding struct if the name exists in the struct tag pinskia at gcc dot gnu.org
@ 2015-09-17 23:34 ` manu at gcc dot gnu.org
  1 sibling, 0 replies; 3+ messages in thread
From: manu at gcc dot gnu.org @ 2015-09-17 23:34 UTC (permalink / raw)
  To: gcc-bugs

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

Manuel López-Ibáñez <manu at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |manu at gcc dot gnu.org
         Resolution|---                         |DUPLICATE

--- Comment #1 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
Fixed in GCC 6

*** This bug has been marked as a duplicate of bug 67580 ***
>From gcc-bugs-return-497463-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org Thu Sep 17 23:34:07 2015
Return-Path: <gcc-bugs-return-497463-listarch-gcc-bugs=gcc.gnu.org@gcc.gnu.org>
Delivered-To: listarch-gcc-bugs@gcc.gnu.org
Received: (qmail 45421 invoked by alias); 17 Sep 2015 23:34:07 -0000
Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm
Precedence: bulk
List-Id: <gcc-bugs.gcc.gnu.org>
List-Archive: <http://gcc.gnu.org/ml/gcc-bugs/>
List-Post: <mailto:gcc-bugs@gcc.gnu.org>
List-Help: <mailto:gcc-bugs-help@gcc.gnu.org>
Sender: gcc-bugs-owner@gcc.gnu.org
Delivered-To: mailing list gcc-bugs@gcc.gnu.org
Received: (qmail 45399 invoked by uid 48); 17 Sep 2015 23:34:03 -0000
From: "redi at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/67617] Non-standard const requirements imposed on associative container comparison objects
Date: Thu, 17 Sep 2015 23:34:00 -0000
X-Bugzilla-Reason: CC
X-Bugzilla-Type: changed
X-Bugzilla-Watch-Reason: None
X-Bugzilla-Product: gcc
X-Bugzilla-Component: libstdc++
X-Bugzilla-Version: 4.8.4
X-Bugzilla-Keywords:
X-Bugzilla-Severity: normal
X-Bugzilla-Who: redi at gcc dot gnu.org
X-Bugzilla-Status: UNCONFIRMED
X-Bugzilla-Resolution:
X-Bugzilla-Priority: P3
X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org
X-Bugzilla-Target-Milestone: ---
X-Bugzilla-Flags:
X-Bugzilla-Changed-Fields:
Message-ID: <bug-67617-4-9ClspTEO00@http.gcc.gnu.org/bugzilla/>
In-Reply-To: <bug-67617-4@http.gcc.gnu.org/bugzilla/>
References: <bug-67617-4@http.gcc.gnu.org/bugzilla/>
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 7bit
X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/
Auto-Submitted: auto-generated
MIME-Version: 1.0
X-SW-Source: 2015-09/txt/msg01441.txt.bz2
Content-length: 182

https://gcc.gnu.org/bugzilla/show_bug.cgi?idg617

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
If that code is conforming then it's a defect in the standard.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-09-17 23:34 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-12-07 11:58 [Bug c/55613] New: Better warning for reference to struct type rui.maciel at gmail dot com
2012-12-09  0:34 ` [Bug c/55613] Add suggestion of adding struct if the name exists in the struct tag pinskia at gcc dot gnu.org
2015-09-17 23:34 ` manu at gcc dot gnu.org

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).