POSIX 2008 requires that <stdio.h> expose ssize_t, va_list, and getline (among others) if _POSIX_C_SOURCE is 200809L or greater. However, this valid POSIX 2008 program fails to compile with glibc: $ cat file.c #define _POSIX_C_SOURCE 200809L #include <stdio.h> int main () { ssize_t s; va_list v; char *p = NULL; size_t s1 = 0; return getline (&p, &s1, stdin); } $ gcc -o file -Wall file.c file.c: In function 'main': file.c:5: error: 'ssize_t' undeclared (first use in this function) file.c:5: error: (Each undeclared identifier is reported only once file.c:5: error: for each function it appears in.) file.c:5: error: expected ';' before 's' file.c:6: error: 'va_list' undeclared (first use in this function) file.c:6: error: expected ';' before 'v' file.c:9: warning: implicit declaration of function 'getline' $
Can't reproduce the getline issue, it is prototyped (since 2009-02-26). va_list is defined only with -D_XOPEN_SOURCE=700, not with -D_POSIX_C_SOURCE=200809L, not sure what is right. If it is supposed to be defined also for _POSIX_C_SOURCE >= 200909L, then #ifdef __USE_XOPEN # ifdef __GNUC__ # ifndef _VA_LIST_DEFINED typedef _G_va_list va_list; # define _VA_LIST_DEFINED # endif # else # include <stdarg.h> # endif #endif would need to use #if defined __USE_XOPEN || defined __USE_XOPEN2K8 instead (or __USE_XOPEN2K?). ssize_t would need something like: #ifdef __USE_XOPEN2K8 # ifndef __ssize_t_defined typedef __ssize_t ssize_t; # define __ssize_t_defined # endif #endif in a right spot in libio/stdio.h.
Fixed in git.