gnugo-devel
[Top][All Lists]
Advanced

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

[gnugo-devel] 3.5.4: Warnings on Tru64 when compiling pattern files.


From: Teun Burgers
Subject: [gnugo-devel] 3.5.4: Warnings on Tru64 when compiling pattern files.
Date: Mon, 16 Feb 2004 19:24:41 +0100
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.4) Gecko/20030624 Netscape/7.1 (ax)

On Tru64 with native cc, one gets warnings of the following
type when compiling the pattern files generated by mkpat.c.

cc: Warning: zzw.c, line 17: In this declaration, "read_attack" is
declared with both internal and external linkage.  The previous
declaration is at line number 7 in file zzw.c. (mixlinkage)

The generated executable functions normally, so not a big
problem. The attached file zzw.c shows a minimal example that reproduces
the warning. The problem is that the autohelper functions
are elements of the pattern array, but refer to the pattern
array itself. This necessitates the earlier extern declaration.

File zznw.c shows a way to avoid the warning by introducing
prototypes for the autohelpers, which requires modifications
to - the already complex - mkpat.c.

I don't think there is another simpler solution.

Teun
#include <stdio.h> 

typedef int (*helper)(int int1);

struct pv {helper h; int pv1;};

static int autohelper1(int trans);

static struct pv read_attack[] = {
  {autohelper1, 2},
  {NULL, 0}
};

static int
autohelper1(int trans)
{
   return read_attack[1].pv1;
}

#include <stdio.h> 

typedef int (*helper)(int int1);

struct pv {helper h; int pv1;};

extern struct pv read_attack[];

/* static int autohelper1(int trans); */

static int
autohelper1(int trans)
{
   return read_attack[1].pv1;
}

static struct pv read_attack[] = {
  {autohelper1, 2},
  {NULL, 0}
};


reply via email to

[Prev in Thread] Current Thread [Next in Thread]