public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/107583] New: Missing fixit for struct members (e.g. time_t, missing <time.h> include)
@ 2022-11-08 22:37 sam at gentoo dot org
  2022-11-09 13:14 ` [Bug c/107583] " redi at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: sam at gentoo dot org @ 2022-11-08 22:37 UTC (permalink / raw)
  To: gcc-bugs

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 |
```

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

end of thread, other threads:[~2023-06-16  1:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-08 22:37 [Bug c/107583] New: Missing fixit for struct members (e.g. time_t, missing <time.h> include) sam at gentoo dot org
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

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