Dan Espen wrote:
fork> gcc x.c x.c: In function `warn':
x.c:13: warning: assignment makes pointer from integer without a cast
x.c:13: warning: assignment makes integer from pointer without a cast
x.c:14: warning: assignment makes integer from pointer without a cast
x.c:14: warning: assignment from incompatible pointer type

Maybe someone else on the list can clarify.


After a little experimentation and research, it seems that nested functions are forbidden by ISO C but allowed by ANSI (resulting in functions with limited scope.) gcc will generate a warning about the nested function if you compile with -pedantic; Forte is notorious for being pedantic all the time ;)

Anyway, the actual test is defined in configure.in:

dnl catch -Werror and similar options when running configure
AC_TRY_COMPILE([#include <stdio.h>],
[int warn(void) {
  int i; static j; int *p; char *c;
  switch (*p = p = *c) { case 0: printf("%Q", c, p); }
  *c = &i; c = p;
  while (1 || (unsigned int)3 >= 0 || ((int)-1) == ((unsigned int)1));
  return; }], , AC_MSG_ERROR("
configure is not able to compile programs with warnings.  Please
remove all offending options like -Werror from the CFLAGS and
CPPFLAGS variables and run configure again."))

According to the autoconf manual, only the function body is supposed to be passed as the second argument--the function declaration itself ('int warn(void) {') should be dropped, and that will hopefully fix the problem. I don't have a Solaris box to test that on, though.

--
Ben

Attachment: pgp00000.pgp
Description: PGP signature



Reply via email to