I am trying to refactor and use the old code, and I came across something like this:
struct foo;
typedef struct foo * foo;
When I try to compile it, I get the following error:
Source/Types/Types.h:27:18: error: redefinition of 'foo' as different kind of symbol
typedef struct foo * foo;
^
Does anyone know what causes this? I didn’t touch the code for a long time, but of course I don’t remember the errors associated with this. Its part of the most basic code in the code base, it all depends on it; I don’t see how I could miss such a blatant mistake, if it really is a mistake. Since the source foo
is a "struct tag" (only the correct link after the keyword struct
), how can it conflict with my new typedefd type foo
?
Change 1: . Has the whole actual file, maybe I missed something, but it looks pretty straight forward. It discards many of the errors described above, one for each type:
# if !defined(TYPE_DECLARATIONS)
# define TYPE_DECLARATIONS
# include "Core.h"
# warning "in Core.h"
static int class = 0;
struct e(fork);
typedef struct e(fork)* e(fork);
struct e(execution);
typedef struct e(execution)* e(execution);
struct e(thing);
typedef struct e(thing) e(thing);
struct e(typeRepresentation);
typedef struct e(typeRepresentation)* e(typeRepresentation);
struct e(typeRepresentation) {
void * family;
char name[64]; };
struct e(thing) {
void * const pointer;
e(typeRepresentation) const isa; };
# endif //!defined(TYPE_DECLARATIONS)
(Also, ignore the macro e()
; its noop in this case.)
source
share