This is a collection of notes on the topic of compiling R with using a strict ANSI C compatible compiler. We (Kurt and I) used the -ansi flag for gcc and encountered the following problems.

arithmetic.c:

struct exception and DOMAIN are in math.h iff __USE_SVID is defined. See features.h. STRICT_ANSI leaves this symbol undefined.

connections.c

IFDIR and IFIFO
See /usr/include/sys/stat.h and this conditionally defines __USE_XOPEN is probably the offender. Also, neither __USE_MISC or __USE_BSD are defined.

devPS.c:

popen not declared.

platform.c

S_IFDIR not there.

src/modules/X11

devX11.c: caddr_t is not defined. sys/types.h has definition within __USE_BSD

This actually looks like it should be XPointer anyway, not caddr_t. (Some) Solaris doesn't declare this as XPointer for XSaveContext. Instead it uses _Xconst char *!

fd_set in eventloop.h is not defined.

rotated.c:

M_PI
Problem is __USE_XOPEN again.

sock.c:

struct sigaction not defined. This is within a #if defined(SIGPIPE)

Miscellaneous Notes

The output showing the setting sat the end of running configure should show the CPPFLAGS as part of the different compiler flags. Since -ansi is part of CPPFLAGS, enabling it with
  ./configure CPPFLAGS=-ansi
means that is not visible in the displayed settings of the flags.
Duncan Temple Lang <duncan@research.bell-labs.com>
Last modified: Mon Aug 19 07:43:50 EDT 2002