]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Lib: Fix macro/keyword collisions
authorOndrej Zajicek (work) <santiago@crfreenet.org>
Sun, 10 Dec 2017 12:16:31 +0000 (13:16 +0100)
committerOndrej Zajicek (work) <santiago@crfreenet.org>
Sun, 10 Dec 2017 12:16:31 +0000 (13:16 +0100)
Old code breaks with some versions of bison

lib/buffer.h
lib/flowspec.h
lib/timer.h
proto/static/static.h

index 6fc18852be5b1ab343862e4ea295c87f95e39ef5..cd9bab867851027cb778f61a96136bb7c855f752 100644 (file)
 #include "lib/resource.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_SIZE(v)         ((v).size * sizeof(* (v).data))
 
+#ifndef PARSER
+#define BUFFER(type) BUFFER_(type)
+#endif
+
 #define BUFFER_INIT(v,pool,isize)                                      \
   ({                                                                   \
     (v).used = 0;                                                      \
index 4fe23da115ce9a9faf3859ff81494bd9730b34de..fa90c70d07c17a1660222b45f85d2b9b2e839e58 100644 (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 */
 struct flow_builder {
-  BUFFER(byte) data;
+  BUFFER_(byte) data;
   enum flow_type this_type;
   enum flow_type last_type;
   u16 last_op_offset;                  /* Position of last operator in data.data */
index eeb7dcb7ef352b7cf18aef270f248c77d2f0e5c1..ed8f0d025035a4b38d2690fbcdd23af23f934a93 100644 (file)
@@ -30,7 +30,7 @@ typedef struct timer
 
 struct timeloop
 {
-  BUFFER(timer *) timers;
+  BUFFER_(timer *) timers;
   btime last_time;
   btime real_time;
 };
index b202c0b1d336241e5ae85e453b3a56c860a70678..a3c30b87189cfe18bef6e2fb443ee3983698305e 100644 (file)
@@ -25,7 +25,7 @@ struct static_proto {
   struct proto p;
 
   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_ip6;               /* Table for recursive IPv6 next hop lookups */
 };