public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [Bug 219203] New: xfsprogs-6.10.0: missing cast in /usr/include/xfs/xfs_fs.h(xfs_getparents_next_rec) causes error in C++ compilations
@ 2024-08-27 21:07 bugzilla-daemon
  2024-08-27 21:40 ` Dave Chinner
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: bugzilla-daemon @ 2024-08-27 21:07 UTC (permalink / raw)
  To: linux-xfs

https://bugzilla.kernel.org/show_bug.cgi?id=219203

            Bug ID: 219203
           Summary: xfsprogs-6.10.0: missing cast in
                    /usr/include/xfs/xfs_fs.h(xfs_getparents_next_rec)
                    causes error in C++ compilations
           Product: File System
           Version: 2.5
          Hardware: All
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P3
         Component: XFS
          Assignee: filesystem_xfs@kernel-bugs.kernel.org
          Reporter: kernel@mattwhitlock.name
        Regression: No

C allows implicit casts from void* to any pointer type, but C++ does not. Thus,
when including <xfs/xfs_fs.h> in a C++ compilation unit, the compiler raises
this error:

/usr/include/xfs/xfs_fs.h: In function 'xfs_getparents_rec*
xfs_getparents_next_rec(xfs_getparents*, xfs_getparents_rec*)':
/usr/include/xfs/xfs_fs.h:915:16: error: invalid conversion from 'void*' to
'xfs_getparents_rec*' [-fpermissive]
  915 |         return next;
      |                ^~~~
      |                |
      |                void*


The return statement in xfs_getparents_next_rec() should have used an explicit
cast, as the return statement in xfs_getparents_first_rec() does.

--- /usr/include/xfs/xfs_fs.h
+++ /usr/include/xfs/xfs_fs.h
@@ -912,7 +912,7 @@
        if (next >= end)
                return NULL;

-       return next;
+       return (struct xfs_getparents_rec *)next;
 }

 /* Iterate through this file handle's directory parent pointers. */

-- 
You may reply to this email to add a comment.

You are receiving this mail because:
You are watching the assignee of the bug.

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

end of thread, other threads:[~2024-08-28  0:10 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-27 21:07 [Bug 219203] New: xfsprogs-6.10.0: missing cast in /usr/include/xfs/xfs_fs.h(xfs_getparents_next_rec) causes error in C++ compilations bugzilla-daemon
2024-08-27 21:40 ` Dave Chinner
2024-08-27 22:30   ` Darrick J. Wong
2024-08-28  0:10     ` Dave Chinner
2024-08-27 21:40 ` [Bug 219203] " bugzilla-daemon
2024-08-27 22:30 ` bugzilla-daemon
2024-08-27 23:12 ` bugzilla-daemon
2024-08-28  0:10 ` bugzilla-daemon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox