0
0
mirror of https://gitlab.nic.cz/labs/bird.git synced 2024-12-23 02:01:55 +00:00

Filter: Additional consistency checks

This commit is contained in:
Maria Matejka 2020-04-27 22:33:10 +02:00 committed by Maria Matejka
parent 8029ae527e
commit 57e52e8a90
2 changed files with 16 additions and 6 deletions

View File

@ -32,6 +32,7 @@ m4_divert(-1)m4_dnl
#
# 101 content of per-inst struct
# 102 constructor arguments
# 109 constructor attributes
# 103 constructor body
# 104 dump line item content
# (there may be nothing in dump-line content and
@ -44,6 +45,7 @@ m4_divert(-1)m4_dnl
# Here are macros to allow you to _divert to the right directions.
m4_define(FID_STRUCT_IN, `m4_divert(101)')
m4_define(FID_NEW_ARGS, `m4_divert(102)')
m4_define(FID_NEW_ATTRIBUTES, `m4_divert(109)')
m4_define(FID_NEW_BODY, `m4_divert(103)')
m4_define(FID_DUMP_BODY, `m4_divert(104)m4_define([[FID_DUMP_BODY_EXISTS]])')
m4_define(FID_LINEARIZE_BODY, `m4_divert(105)')
@ -104,15 +106,18 @@ FID_STRUCT_IN()m4_dnl
struct f_inst * f$1;
FID_NEW_ARGS()m4_dnl
, struct f_inst * f$1
FID_NEW_ATTRIBUTES()m4_dnl
NONNULL(m4_eval($1+1))
FID_NEW_BODY()m4_dnl
whati->f$1 = f$1;
for (const struct f_inst *child = f$1; child; child = child->next) {
what->size += child->size;
const struct f_inst *child$1 = f$1;
do {
what->size += child$1->size;
FID_IFCONST([[
if (child->fi_code != FI_CONSTANT)
if (child$1->fi_code != FI_CONSTANT)
constargs = 0;
]])
}
} while (child$1 = child$1->next);
FID_LINEARIZE_BODY
pos = linearize(dest, whati->f$1, pos);
FID_INTERPRET_BODY()')
@ -303,7 +308,9 @@ m4_undivert(107)m4_dnl
FID_NEW()m4_dnl Constructor and interpreter code together
FID_HIC(
[[m4_dnl Public declaration of constructor in H file
struct f_inst *f_new_inst_]]INST_NAME()[[(enum f_instruction_code fi_code
struct f_inst *
m4_undivert(109)m4_dnl
f_new_inst_]]INST_NAME()[[(enum f_instruction_code fi_code
m4_undivert(102)m4_dnl
);]],
[[m4_dnl The one case in The Big Switch inside interpreter
@ -315,7 +322,9 @@ m4_undivert(102)m4_dnl
break;
]],
[[m4_dnl Constructor itself
struct f_inst *f_new_inst_]]INST_NAME()[[(enum f_instruction_code fi_code
struct f_inst *
m4_undivert(109)m4_dnl
f_new_inst_]]INST_NAME()[[(enum f_instruction_code fi_code
m4_undivert(102)m4_dnl
)
{

View File

@ -72,6 +72,7 @@ static inline int u64_cmp(u64 i1, u64 i2)
#define NORET __attribute__((noreturn))
#define UNUSED __attribute__((unused))
#define PACKED __attribute__((packed))
#define NONNULL(x) __attribute__((nonnull((x))))
#ifndef HAVE_THREAD_LOCAL
#define _Thread_local