Summary: | snprintf() is undefined by _XOPEN_SOURCE=500 on BSDs, making poppler 0.12.4 fail to compile. | ||
---|---|---|---|
Product: | poppler | Reporter: | Javier Villavicencio <the_paya> |
Component: | general | Assignee: | poppler-bugs <poppler-bugs> |
Status: | RESOLVED FIXED | QA Contact: | |
Severity: | normal | ||
Priority: | medium | ||
Version: | unspecified | ||
Hardware: | x86 (IA32) | ||
OS: | FreeBSD | ||
Whiteboard: | |||
i915 platform: | i915 features: |
Description
Javier Villavicencio
2010-04-12 20:45:54 UTC
Can you point to the spec that says that snprintf shall be undefined when -D_XOPEN_SOURCE=500 I added the strings.h include for strcasecmp (In reply to comment #1) > Can you point to the spec that says that snprintf shall be undefined when > -D_XOPEN_SOURCE=500 > > I added the strings.h include for strcasecmp Thanks. About the specs, my apologies I should have included the references while I had them at hand, and "correctly undefined" sounds a bit blunt. Silly of me. To correct myself on the subject, what I found while investigating this is that, since snprintf behavior was redefined between standards [1], the headers only define it (and a few others) when the standard the library supports is in use or requested, which is (usually) SUSv2 or ISO C99 or POSIX98 (not 100% sure on the posix one). While _XOPEN_SOURCE=500 goes back to pre-1998 (speaking of standards) and that (older) implementation of snprintf is not supported on BSD (neither on glibc I think), it's then left undefined (a suggestive way for programs to provide the implementation they want, if I may add). Linux glibc also behaves in a similar way: one of the requisites for defining snprintf in <stdio.h> is "_XOPEN_SOURCE > 500" (coming from <features.h>). But it's then ||or'ed to another define that comes from _BSD_SOURCE (it sets __USE_BSD), which is a bliss for glibc in this case, given that -D_BSD_SOURCE is also defined by poppler here. [1] http://www.opengroup.org/onlinepubs/009695399/functions/snprintf.html (at the bottom) Changed to 600, anyway, that option is only set if you use a non standard compile option that you should not be using unless you know what you are doing. |
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.