Summary: | compilation error on AIX 6.1 (implicit declaration of function 'getline') | ||
---|---|---|---|
Product: | cairo | Reporter: | Michael Haubenwallner <michael.haubenwallner> |
Component: | general | Assignee: | Chris Wilson <chris> |
Status: | RESOLVED FIXED | QA Contact: | cairo-bugs mailing list <cairo-bugs> |
Severity: | normal | ||
Priority: | medium | ||
Version: | unspecified | ||
Hardware: | Other | ||
OS: | AIX | ||
Whiteboard: | |||
i915 platform: | i915 features: | ||
Attachments: | define _GETDELIM for getline() on AIX |
Description
Michael Haubenwallner
2015-02-27 09:44:11 UTC
Created attachment 113863 [details] [review] define _GETDELIM for getline() on AIX Thanks! Hi Michael, Thanks for the patch to fix this compilation issue. Offhand this looks fine, although I wonder if the define could be placed in a shared header or something rather than defined in each .c file. However, I'd like to understand why exactly this define makes it work. Can you point me at the code or an explanation of what _GETDELIM causes to happen on AIX? The explanation is quite simple: AIX 6.1 <stdio.h> contains these lines: #ifdef _GETDELIM extern ssize_t getdelim(char **, size_t *, int, FILE *); extern ssize_t getline(char **, size_t *, FILE *); #endif /* GETDELIM */ But the configure check for getline is on the library-level only, not on the compiler-level. However, on AIX 7.1 these lines have changed a little: #ifndef _NOGETDELIM extern ssize_t getdelim(); extern ssize_t getline(); #endif /* _NOGETDELIM */ So actually this define is necessary for AIX 6.1 (cannot check for earlier versions), but not for AIX 7.1. For moving this define into some shared header: Indeed the proper place would be "config.h" as a result of some extra configure check, but I doubt that's really worth the effort here - unless more platforms come up with a similar problem. OTOH, gnulib does check for missing getdelim declaration as well: https://www.gnu.org/software/gnulib/manual/html_node/getdelim.html I wonder if util/cairo-missing/cairo-missing.h would be a better location for this define. That already is providing a getline reimplementation. But unfortunately none of the affected utilities include any local headers, so there's not really a central place to put them that wouldn't risk introducing some side effects. The solution you provided is minimal and safe of any side effects, so I agree we should go with that for now. Besides, the utilities affected by this issue have a lot of redundancy between them already. Thanks for the explanation, applied: f72bd7c..e9a615a master -> master |
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.