NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

standards/57810: stdlib.h is unusable under _ANSI_SOURCE and _POSIX_C_SOURCE together



>Number:         57810
>Category:       standards
>Synopsis:       stdlib.h is unusable under _ANSI_SOURCE and _POSIX_C_SOURCE together
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    standards-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Jan 02 00:40:00 +0000 2024
>Originator:     Taylor R Campbell
>Release:        current
>Organization:
The _NETBSD_SOURCE Foundation
>Environment:
>Description:
Defining _ANSI_SOURCE and _POSIX_C_SOURCE breaks stdlib.h.
>How-To-Repeat:
$ cat pr.c
#define	_ANSI_SOURCE
#define	_POSIX_C_SOURCE	200809L
#include <stdlib.h>
$ make pr.o
cc -O2   -c pr.c
In file included from pr.c:3:0:
/usr/include/stdlib.h:227:1: error: unknown type name ?lldiv_t?; did you mean ?ldiv_t??
 lldiv_t  lldiv(long long int, long long int);
 ^~~~~~~
 ldiv_t
*** Error code 1

Stop.
make: stopped in /tmp/riastradh

>Fix:
Yes, please!

It looks like the conditions for defining lldiv_t don't quite match the conditions for declaring lldiv in stdlib.h; making them match should resolve the issue.



Home | Main Index | Thread Index | Old Index