Skip to contentSkip to conversation

expression: add __EXPR_MAX and use it to define EXPR_MAX

PATCH New Pablo Neira Ayuso 1 participant 1 message Mar 26, 2025 netfilter

lore
Share & tools
lore

Pablo Neira Ayuso

author maintainer
#0 lore raw

PATCH 1/1 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")
---
 include/expression.h | 4 ++--
 src/expression.c     | 1 +
 2 files changed, 3 insertions(+), 2 deletions(-)
include/expression.h +2 -2
index 8472748621ef..6e8675b0cc1a 100644
@@ -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,
src/expression.c +1 -0
index 156a66eb37f0..52e4c7d187ac 100644
@@ -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;
Signature · 1 line
2.30.2