Skip to content

Commit 0d35a14

Browse files
authored
Fix compiler warnings in strict C99 mode (#487)
Redefining a typedef is a C11 feature: In file included from src/hnsw.c:10: src/hnsw.h:147:5: warning: redefinition of typedef 'HnswElementData' is a C11 feature [-Wtypedef-redefinition] } HnswElementData; ^ src/hnsw.h:118:32: note: previous definition is here typedef struct HnswElementData HnswElementData; ^ src/hnsw.h:163:5: warning: redefinition of typedef 'HnswNeighborArray' is a C11 feature [-Wtypedef-redefinition] } HnswNeighborArray; ^ src/hnsw.h:119:34: note: previous definition is here typedef struct HnswNeighborArray HnswNeighborArray; ^ 2 warnings generated. I got these warnings when I built PostgreSQL with "CC=clang CFLAGS=-std=gnu99"; other similar options would surely produce the warnings too.
1 parent 3ea2ce8 commit 0d35a14

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/hnsw.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ HnswPtrDeclare(HnswNeighborArray, HnswNeighborArrayRelptr, HnswNeighborArrayPtr)
129129
HnswPtrDeclare(HnswNeighborArrayPtr, HnswNeighborsRelptr, HnswNeighborsPtr);
130130
HnswPtrDeclare(char, DatumRelptr, DatumPtr);
131131

132-
typedef struct HnswElementData
132+
struct HnswElementData
133133
{
134134
HnswElementPtr next;
135135
ItemPointerData heaptids[HNSW_HEAPTIDS];
@@ -144,7 +144,7 @@ typedef struct HnswElementData
144144
BlockNumber neighborPage;
145145
DatumPtr value;
146146
LWLock lock;
147-
} HnswElementData;
147+
};
148148

149149
typedef HnswElementData * HnswElement;
150150

@@ -155,12 +155,12 @@ typedef struct HnswCandidate
155155
bool closer;
156156
} HnswCandidate;
157157

158-
typedef struct HnswNeighborArray
158+
struct HnswNeighborArray
159159
{
160160
int length;
161161
bool closerSet;
162162
HnswCandidate items[FLEXIBLE_ARRAY_MEMBER];
163-
} HnswNeighborArray;
163+
};
164164

165165
typedef struct HnswPairingHeapNode
166166
{

0 commit comments

Comments
 (0)