Lib: Fix macro/keyword collisions

Old code breaks with some versions of bison
This commit is contained in:
Ondrej Zajicek (work) 2017-12-10 13:16:31 +01:00
parent 7fc55925be
commit a32a7b58ce
4 changed files with 8 additions and 4 deletions

View file

@ -13,10 +13,14 @@
#include "lib/resource.h" #include "lib/resource.h"
#include "sysdep/config.h" #include "sysdep/config.h"
#define BUFFER(type) struct { type *data; uint used, size; } #define BUFFER_(type) struct { type *data; uint used, size; }
#define BUFFER_TYPE(v) typeof(* (v).data) #define BUFFER_TYPE(v) typeof(* (v).data)
#define BUFFER_SIZE(v) ((v).size * sizeof(* (v).data)) #define BUFFER_SIZE(v) ((v).size * sizeof(* (v).data))
#ifndef PARSER
#define BUFFER(type) BUFFER_(type)
#endif
#define BUFFER_INIT(v,pool,isize) \ #define BUFFER_INIT(v,pool,isize) \
({ \ ({ \
(v).used = 0; \ (v).used = 0; \

View file

@ -91,7 +91,7 @@ const byte *flow6_next_part(const byte *pos, const byte *end);
/* A data structure for keep a state of flow builder */ /* A data structure for keep a state of flow builder */
struct flow_builder { struct flow_builder {
BUFFER(byte) data; BUFFER_(byte) data;
enum flow_type this_type; enum flow_type this_type;
enum flow_type last_type; enum flow_type last_type;
u16 last_op_offset; /* Position of last operator in data.data */ u16 last_op_offset; /* Position of last operator in data.data */

View file

@ -30,7 +30,7 @@ typedef struct timer
struct timeloop struct timeloop
{ {
BUFFER(timer *) timers; BUFFER_(timer *) timers;
btime last_time; btime last_time;
btime real_time; btime real_time;
}; };

View file

@ -25,7 +25,7 @@ struct static_proto {
struct proto p; struct proto p;
struct event *event; /* Event for announcing updated routes */ struct event *event; /* Event for announcing updated routes */
BUFFER(struct static_route *) marked; /* Routes marked for reannouncement */ BUFFER_(struct static_route *) marked; /* Routes marked for reannouncement */
rtable *igp_table_ip4; /* Table for recursive IPv4 next hop lookups */ rtable *igp_table_ip4; /* Table for recursive IPv4 next hop lookups */
rtable *igp_table_ip6; /* Table for recursive IPv6 next hop lookups */ rtable *igp_table_ip6; /* Table for recursive IPv6 next hop lookups */
}; };