public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "sam at gentoo dot org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c/107583] New: Missing fixit for struct members (e.g. time_t, missing <time.h> include)
Date: Tue, 08 Nov 2022 22:37:10 +0000	[thread overview]
Message-ID: <bug-107583-4@http.gcc.gnu.org/bugzilla/> (raw)

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

            Bug ID: 107583
           Summary: Missing fixit for struct members (e.g. time_t, missing
                    <time.h> include)
           Product: gcc
           Version: 12.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sam at gentoo dot org
  Target Milestone: ---

Created attachment 53855
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=53855&action=edit
a-foo.i

```
$ cat /tmp/foo.c
struct foo {
        time_t mytime; /* missing <time.h> include should trigger fixit */
}

$ gcc /tmp/foo.c
foo.c:2:9: error: unknown type name 'time_t'
    2 |         time_t mytime; /* missing <time.h> include should trigger fixit
*/
      |         ^~~~~~
foo.c:3:1: error: expected identifier or '(' at end of input
    3 | }
      | ^
```

```
# gcc --version
gcc (Gentoo 12.2.1_p20221008 p1) 12.2.1 20221008
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
```

Expected output is a <time.h> "fixit" like:
```
test.c:3:13: error: unknown type name 'time_t'
    3 | void myfunc(time_t test) {
      |             ^~~~~~
test.c:2:1: note: 'time_t' is defined in header '<time.h>'; did you forget to
'#include <time.h>'?
    1 | #include <stdio.h>
  +++ |+#include <time.h>
    2 |
```

             reply	other threads:[~2022-11-08 22:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-08 22:37 sam at gentoo dot org [this message]
2022-11-09 13:14 ` [Bug c/107583] " redi at gcc dot gnu.org
2023-06-15 13:45 ` dmalcolm at gcc dot gnu.org
2023-06-15 13:52 ` dmalcolm at gcc dot gnu.org
2023-06-16  0:59 ` cvs-commit at gcc dot gnu.org
2023-06-16  1:03 ` dmalcolm 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-107583-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).