public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/94382] New: conflicting function types should show more context
@ 2020-03-28 15:39 matthew at wil dot cx
  2020-04-20 23:08 ` [Bug c/94382] " dmalcolm at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: matthew at wil dot cx @ 2020-03-28 15:39 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 94382
           Summary: conflicting function types should show more context
           Product: gcc
           Version: 9.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: matthew at wil dot cx
  Target Milestone: ---

The diagnostic would be better if it showed the entire function prototype:

../fs/iomap/apply.c:13:1: error: conflicting types for ‘__iomap_apply’
   13 | __iomap_apply(struct inode *inode, loff_t pos, loff_t length, unsigned
flags,
      | ^~~~~~~~~~~~~
In file included from ../fs/iomap/apply.c:9:
../include/linux/iomap.h:152:1: note: previous declaration of ‘__iomap_apply’
was here
  152 | __iomap_apply(struct inode *inode, loff_t pos, loff_t length, unsigned
flags,
      | ^~~~~~~~~~~~~

$ grep -A3 __iomap_apply include/linux/iomap.h fs/iomap/apply.c 
include/linux/iomap.h:__iomap_apply(struct inode *inode, loff_t pos, loff_t
length, unsigned flags,
include/linux/iomap.h-          const struct iomap_ops *ops, iomap_actor_t
actor,
include/linux/iomap.h-          struct iomap *iomap, struct iomap *srcmap);
include/linux/iomap.h-
--
include/linux/iomap.h:  length = __iomap_apply(inode, pos, length, flags, ops,
actor,
include/linux/iomap.h-                                  &iomap, &srcmap);
include/linux/iomap.h-  /*
include/linux/iomap.h-   * Now that we have guaranteed that the space
allocation will succeed,
--
fs/iomap/apply.c:__iomap_apply(struct inode *inode, loff_t pos, loff_t length,
unsigned flags,
fs/iomap/apply.c-               struct iomap *iomap, struct iomap *srcmap,
fs/iomap/apply.c-               const struct iomap_ops *ops, iomap_actor_t
actor)
fs/iomap/apply.c-{

The bug in my code is fairly obvious, but the diagnostic doesn't show the part
of the function signature that doesn't match.

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

* [Bug c/94382] conflicting function types should show more context
  2020-03-28 15:39 [Bug c/94382] New: conflicting function types should show more context matthew at wil dot cx
@ 2020-04-20 23:08 ` dmalcolm at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2020-04-20 23:08 UTC (permalink / raw)
  To: gcc-bugs

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

David Malcolm <dmalcolm at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dmalcolm at gcc dot gnu.org

--- Comment #1 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Beyond simply showing the entire prototype, some other ideas:

./fs/iomap/apply.c:13:1: error: conflicting types for ‘__iomap_apply’
   13 | __iomap_apply(struct inode *inode, loff_t pos, loff_t length, unsigned
flags,
   14 |               struct iomap *iomap, struct iomap *srcmap,
      |               -------------------  --------------------
      |                       |                    |
      |                       param 5              param 6
   15 |               const struct iomap_ops *ops, iomap_actor_t actor)
      |               ---------------------------  -------------------
      |                       |                            |
      |                       param 7                      param 8
In file included from ../fs/iomap/apply.c:9:
../include/linux/iomap.h:152:1: note: previous declaration of ‘__iomap_apply’
was here
  152 | __iomap_apply(struct inode *inode, loff_t pos, loff_t length, unsigned
flags,
  153 |               const struct iomap_ops *ops, iomap_actor_t actor,
      |               ---------------------------  -------------------
      |                            |                       |
      |                            param 5                 param 6
  154 |               struct iomap *iomap, struct iomap *srcmap);
      |               -------------------  --------------------
      |                            |                       |
      |                            param 7                 param 8
note: you've transposed params 5 and 7, and params 6 and 8

But it's probably simplest to just show the full prototype.

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

end of thread, other threads:[~2020-04-20 23:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-28 15:39 [Bug c/94382] New: conflicting function types should show more context matthew at wil dot cx
2020-04-20 23:08 ` [Bug c/94382] " 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).