From 22e35e6860ba2b32652884188ed8472ee8f78f47 Mon Sep 17 00:00:00 2001 From: Shivampal157 Date: Tue, 3 Feb 2026 03:39:56 +0530 Subject: [PATCH] Fix entry addition logic for keyless match tables Signed-off-by: Shivampal157 --- .vscode/c_cpp_properties.json | 38 +++++++++++++++++++++++++++++++++++ src/bm_sim/match_units.cpp | 2 +- 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100644 .vscode/c_cpp_properties.json diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json new file mode 100644 index 000000000..61bc6cebd --- /dev/null +++ b/.vscode/c_cpp_properties.json @@ -0,0 +1,38 @@ +{ + "configurations": [ + { + "name": "Win32", + "includePath": [ + "${workspaceFolder}/**", + "${workspaceFolder}/include", + "${workspaceFolder}/src/BMI", + "${workspaceFolder}/third_party/jsoncpp/include", + "${workspaceFolder}/third_party/spdlog" + ], + "defines": [ + "_DEBUG", + "UNICODE", + "_UNICODE" + ], + "windowsSdkVersion": "", + "cStandard": "c17", + "cppStandard": "c++17", + "intelliSenseMode": "windows-clang-x64" + }, + { + "name": "Linux", + "includePath": [ + "${workspaceFolder}/**", + "${workspaceFolder}/include", + "${workspaceFolder}/src/BMI", + "${workspaceFolder}/third_party/jsoncpp/include", + "${workspaceFolder}/third_party/spdlog" + ], + "defines": [], + "cStandard": "c17", + "cppStandard": "c++17", + "intelliSenseMode": "linux-gcc-x64" + } + ], + "version": 4 +} diff --git a/src/bm_sim/match_units.cpp b/src/bm_sim/match_units.cpp index 699af024e..c47cfe83d 100644 --- a/src/bm_sim/match_units.cpp +++ b/src/bm_sim/match_units.cpp @@ -805,7 +805,7 @@ template MatchErrorCode MatchUnitAbstract::add_entry(const std::vector &match_key, V value, entry_handle_t *handle, int priority) { - if (this->get_size_key() == 0) return MatchErrorCode::NO_TABLE_KEY; + if (this->get_size_key() == 0 && match_key.size()) return MatchErrorCode::NO_TABLE_KEY; MatchErrorCode rc = add_entry_(match_key, std::move(value), handle, priority); if (rc != MatchErrorCode::SUCCESS) return rc; EntryMeta &meta = entry_meta[HANDLE_INTERNAL(*handle)];