From: Pablo Neira Ayuso Date: Wed, 26 Mar 2025 20:54:01 +0000 (+0100) Subject: expression: add __EXPR_MAX and use it to define EXPR_MAX X-Git-Tag: v1.1.2~27 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=357820e7a21434ae91c97dd2ad65515f08ff92bd;p=thirdparty%2Fnftables.git expression: add __EXPR_MAX and use it to define EXPR_MAX EXPR_MAX was never updated to the newest expression, add __EXPR_MAX and use it to define EXPR_MAX. Add case to expr_ops() other gcc complains with a warning on the __EXPR_MAX case is not handled. Fixes: 347039f64509 ("src: add symbol range expression to further compact intervals") Suggested-by: Florian Westphal Signed-off-by: Pablo Neira Ayuso --- diff --git a/include/expression.h b/include/expression.h index 84727486..6e8675b0 100644 --- a/include/expression.h +++ b/include/expression.h @@ -84,9 +84,9 @@ enum expr_types { EXPR_FLAGCMP, EXPR_RANGE_VALUE, EXPR_RANGE_SYMBOL, - - EXPR_MAX = EXPR_FLAGCMP + __EXPR_MAX }; +#define EXPR_MAX (__EXPR_MAX - 1) enum ops { OP_INVALID, diff --git a/src/expression.c b/src/expression.c index 156a66eb..52e4c7d1 100644 --- a/src/expression.c +++ b/src/expression.c @@ -1794,6 +1794,7 @@ static const struct expr_ops *__expr_ops_by_type(enum expr_types etype) case EXPR_FLAGCMP: return &flagcmp_expr_ops; case EXPR_RANGE_VALUE: return &constant_range_expr_ops; case EXPR_RANGE_SYMBOL: return &symbol_range_expr_ops; + case __EXPR_MAX: break; } return NULL;