mirror of
https://github.com/zeek/zeek.git
synced 2025-10-12 19:48:20 +00:00
Merge remote-tracking branch 'origin/topic/vern/macro-descriptions'
* origin/topic/vern/macro-descriptions: Add missing include for <vector> Extended ZAM validation to include macros
This commit is contained in:
commit
a919226b24
7 changed files with 29 additions and 9 deletions
|
@ -13,9 +13,11 @@ using std::string;
|
|||
namespace zeek::detail {
|
||||
|
||||
std::unordered_map<ZOp, ZAMInstDesc> zam_inst_desc = {
|
||||
#include "ZAM-OpDesc.h"
|
||||
};
|
||||
|
||||
#include "ZAM-Desc.h"
|
||||
|
||||
std::vector<std::pair<string, string>> zam_macro_desc = {
|
||||
#include "ZAM-MacroDesc.h"
|
||||
};
|
||||
|
||||
// While the following has commonalities that could be factored out,
|
||||
|
@ -107,7 +109,15 @@ void validate_ZAM_insts() {
|
|||
for ( auto& zid : zam_inst_desc )
|
||||
analyze_ZAM_inst(ZOP_name(zid.first), zid.second);
|
||||
|
||||
printf("%d valid, %d tested, %d skipped\n", num_valid, num_tested, num_skipped);
|
||||
int num_valid_macros = 0;
|
||||
for ( auto& md : zam_macro_desc ) {
|
||||
if ( std::regex_search(md.second, std::regex("\\$[0-9$]")) )
|
||||
reporter->InternalError("macro %s contains dollar parameter: %s", md.first.c_str(), md.second.c_str());
|
||||
++num_valid_macros;
|
||||
}
|
||||
|
||||
printf("%d valid ops, %d tested, %d skipped, %d valid macros\n", num_valid, num_tested, num_skipped,
|
||||
num_valid_macros);
|
||||
}
|
||||
|
||||
} // namespace zeek::detail
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
|
||||
namespace zeek::detail {
|
||||
|
||||
|
@ -72,6 +73,10 @@ struct ZAMInstDesc {
|
|||
// Provides access to the validation description of each operation.
|
||||
extern std::unordered_map<ZOp, ZAMInstDesc> zam_inst_desc;
|
||||
|
||||
// Same, for the associated macros. First field is macro name, second is
|
||||
// definition (including "#define" etc.).
|
||||
extern std::vector<std::pair<std::string, std::string>> zam_macro_desc;
|
||||
|
||||
// Maps an operand to its flavor.
|
||||
extern ZAMOp1Flavor op1_flavor[];
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue