mirror of
https://github.com/VectorCamp/vectorscan.git
synced 2025-09-29 19:24:25 +03:00
msvc: use the vectorcall calling convention
This requires declaring external interfaces with the cdecl calling convention.
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
CHECK_FUNCTION_EXISTS(mmap HAVE_MMAP)
|
||||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CXX_FLAGS}")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CXX_FLAGS} ${HS_CXX_FLAGS}")
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}
|
||||
${PROJECT_SOURCE_DIR})
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2015, Intel Corporation
|
||||
* Copyright (c) 2015-2017, Intel Corporation
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
@@ -29,12 +29,14 @@
|
||||
#ifndef EXPRESSIONPARSER_H
|
||||
#define EXPRESSIONPARSER_H
|
||||
|
||||
#include "hs_common.h"
|
||||
|
||||
#include <string>
|
||||
|
||||
struct hs_expr_ext;
|
||||
|
||||
bool readExpression(const std::string &line, std::string &expr,
|
||||
unsigned int *flags, hs_expr_ext *ext,
|
||||
bool *must_be_ordered = nullptr);
|
||||
bool HS_CDECL readExpression(const std::string &line, std::string &expr,
|
||||
unsigned int *flags, hs_expr_ext *ext,
|
||||
bool *must_be_ordered = nullptr);
|
||||
|
||||
#endif
|
||||
|
@@ -115,9 +115,9 @@ void initExt(hs_expr_ext *ext) {
|
||||
ext->max_offset = MAX_OFFSET;
|
||||
}
|
||||
|
||||
bool readExpression(const std::string &input, std::string &expr,
|
||||
unsigned int *flags, hs_expr_ext *ext,
|
||||
bool *must_be_ordered) {
|
||||
bool HS_CDECL readExpression(const std::string &input, std::string &expr,
|
||||
unsigned int *flags, hs_expr_ext *ext,
|
||||
bool *must_be_ordered) {
|
||||
assert(flags);
|
||||
assert(ext);
|
||||
|
||||
|
@@ -102,7 +102,7 @@ void processLine(string &line, unsigned lineNum,
|
||||
#define S_ISDIR(st_m) (_S_IFDIR & (st_m))
|
||||
#define S_ISREG(st_m) (_S_IFREG & (st_m))
|
||||
#endif
|
||||
void loadExpressionsFromFile(const string &fname, ExpressionMap &exprMap) {
|
||||
void HS_CDECL loadExpressionsFromFile(const string &fname, ExpressionMap &exprMap) {
|
||||
struct stat st;
|
||||
if (stat(fname.c_str(), &st) != 0) {
|
||||
return;
|
||||
@@ -195,7 +195,7 @@ void loadExpressions(const string &inPath, ExpressionMap &exprMap) {
|
||||
}
|
||||
}
|
||||
#else // windows TODO: improve
|
||||
void loadExpressions(const string &inPath, ExpressionMap &exprMap) {
|
||||
void HS_CDECL loadExpressions(const string &inPath, ExpressionMap &exprMap) {
|
||||
// Is our input path a file or a directory?
|
||||
struct stat st;
|
||||
if (stat(inPath.c_str(), &st) != 0) {
|
||||
@@ -251,8 +251,8 @@ void loadExpressions(const string &inPath, ExpressionMap &exprMap) {
|
||||
}
|
||||
#endif
|
||||
|
||||
void loadSignatureList(const string &inFile,
|
||||
SignatureSet &signatures) {
|
||||
void HS_CDECL loadSignatureList(const string &inFile,
|
||||
SignatureSet &signatures) {
|
||||
ifstream f(inFile.c_str());
|
||||
if (!f.good()) {
|
||||
cerr << "Can't open file: '" << inFile << "'" << endl;
|
||||
|
@@ -29,6 +29,8 @@
|
||||
#ifndef EXPRESSIONS_H
|
||||
#define EXPRESSIONS_H
|
||||
|
||||
#include "hs_common.h"
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@@ -38,12 +40,12 @@ using SignatureSet = std::vector<unsigned>;
|
||||
|
||||
// load all of the expressions from the given directory into the given
|
||||
// expression map. Exits on failure.
|
||||
void loadExpressions(const std::string &inDir, ExpressionMap &exprMap);
|
||||
void HS_CDECL loadExpressions(const std::string &inDir, ExpressionMap &exprMap);
|
||||
|
||||
void loadExpressionsFromFile(const std::string &fname, ExpressionMap &exprMap);
|
||||
void HS_CDECL loadExpressionsFromFile(const std::string &fname, ExpressionMap &exprMap);
|
||||
|
||||
// load a list of signature IDs
|
||||
void loadSignatureList(const std::string &inFile, SignatureSet &signatures);
|
||||
void HS_CDECL loadSignatureList(const std::string &inFile, SignatureSet &signatures);
|
||||
|
||||
// trim expression map to only the given signatures, returning result
|
||||
ExpressionMap limitToSignatures(const ExpressionMap &exprMap,
|
||||
|
Reference in New Issue
Block a user