GNOME Bugzilla – Bug 71184
Missing includes
Last modified: 2004-12-22 21:47:04 UTC
Solaris, when using gcc, handles 64-bit stuff using a lot of #define open open64 type of defines. Thus special case is required to make sure all files that use such an identifier have consistent includes. Also, some files lack <sys/stat.h> outright.
Created attachment 6692 [details] [review] Patch to fix libgnomevfs
Sorry, could you explain this again? This sounds the same as Linux, and I'm having trouble understanding why gnome-vfs-mime.h needs to include <sys/stat.h> on Solaris, but not on Linux. Could you perhaps show me some of the errors that occur without this patch?
Let me see... 1. The Makefile ends up doing -D_FILE_OFFSET_BITS=64 2. On solaris, this is implemented as [slighly edited]: #if !defined(_LP64) && _FILE_OFFSET_BITS == 64 #ifdef __PRAGMA_REDEFINE_EXTNAME #pragma redefine_extname open open64 #else #define open open64 #endif #endif /* !_LP64 && _FILE_OFFSET_BITS == 64 */ 3. gcc does not have __PRAGMA_REDEFINE_EXTNAME. (cc does.) 4. GnomeVFSSpecificOp is a union that contains an "open" member. Conclusion: the definition (gnome-vfs-job.h) must be included *after* the relevant system header(s). Otherwise I get a "union has no open64 member" or some such. 5. "struct stat *" requires <sys/stat.h>, even on Linux. I actually see the problem because of a "#define stat stat64".
Ah, it's your point #4 that I missed. That explains it! Lets put a comment to that effect at the top of gnome-vfs-job.h to explain why we have to include headers even though we don't use anything in those headers. And I understand your point #5 too. What's the explanation for gnome-vfs-method.h? And I made a similar change to the stable branch, so we probably need these fixes there too.
> What's the explanation for gnome-vfs-method.h? Some variation of the same thing. Maybe the "open" member of struct GnomeVFSMethod.
Well, you definitely have my OK to commit these changes, with brief comments explaining why those includes are in there so that future maintainers don't remove the "unneeded" includes.
fixed in cvs.
*** Bug 92494 has been marked as a duplicate of this bug. ***