Graham Percival 13efdcb010 Add const to arguments 1 year ago
..
README 79efbf1c9b build: add DISABLE_POSIX_RUNTIME_CHECKS 3 years ago
posix-abstract-declarator.c 6fd116f24f POSIX: nitpick newline in function definition 4 years ago
posix-cflags.sh 79497e00dc scripts: always use double quotes and curly braces 1 year ago
posix-clock_gettime.c 7d2d7492ac libcperciva: import the POSIX compatibility layer 5 years ago
posix-clock_realtime.c 7d2d7492ac libcperciva: import the POSIX compatibility layer 5 years ago
posix-inet-addrstrlen.c 6a5bfb28f5 POSIX: check for INET?_ADDRSTRLEN in <netinet/in.h> 4 years ago
posix-inet6-addrstrlen.c 6a5bfb28f5 POSIX: check for INET?_ADDRSTRLEN in <netinet/in.h> 4 years ago
posix-l.sh 79497e00dc scripts: always use double quotes and curly braces 1 year ago
posix-msg_nosignal.c 7d2d7492ac libcperciva: import the POSIX compatibility layer 5 years ago
posix-restrict.c 13efdcb010 Add const to arguments 1 year ago
posix-stat-st_mtim.c 3599ea71d9 POSIX: struct stat should contain st_mtim 4 years ago
posix-trivial.c aa8a97ee34 POSIX: rename posix-l.c -> posix-trivial.c 3 years ago

README

POSIX compatibility code
------------------------

This code exists to work around some common POSIX compatibility issues.
POSIX specifies that if the first line of a Makefile is ".POSIX:" then the
Makefile should be processed according to POSIX rules, including with CC=c99;
thus we should see behaviour consistent with a standard-compliant C99
compiler.

One POSIX compatibility check requires a runtime test. This will be
automatically disabled if the build system detects that you are
cross-compiling for another platform, or it can be manually disabled by
setting DISABLE_POSIX_RUNTIME_CHECKS to a non-zero value.

- posix-cflags.sh: Detects if ${CC} supports certain POSIX features, and
outputs a POSIXFAIL_ define if it is not supported so that we can work around
the problem.

The potential command-line flags are:
- DPOSIXFAIL_MSG_NOSIGNAL: not defining MSG_NOSIGNAL.
- DPOSIXFAIL_CLOCK_REALTIME: not defining CLOCK_REALTIME.
- DPOSIXFAIL_CLOCK_GETTIME: not declaring clock_gettime(), or
clock_gettime() is not linkable. The latter test requires a runtime check.
- DPOSIXFAIL_INET_ADDRSTRLEN: not defining
INET_ADDRSTRLEN.
- DPOSIXFAIL_INET6_ADDRSTRLEN: not defining
INET6_ADDRSTRLEN.
- DPOSIXFAIL_ABSTRACT_DECLARATOR: ${CC} does not accept
qualifiers in an abstract declarator.
- DPOSIXFAIL_STAT_ST_MTIM: struct stat does not contain st_mtim.
- std=c99: ${CC} does not accept the `restrict` keyword by default, but
accepts it when given this flag.

- posix-cflags-filter.sh: Detects if ${CC} supports expected ${CFLAG} value(s).

The potential ${CFLAGS} flags it checks are:
- O2: some compilers only accept -O.

- posix-l.sh: Detects whether the linker supports certain POSIX features.

The potential command-line flags are:
- lrt lxnet: c99 is required to understand these options, and ignore them if
the routines for which they specify linkage are already in the standard C
library