msvc: use the vectorcall calling convention

This requires declaring external interfaces with the cdecl
calling convention.
This commit is contained in:
Matthew Barr
2017-03-10 15:48:38 +11:00
parent 73765f1f84
commit dba2470ec9
19 changed files with 271 additions and 207 deletions

View File

@@ -311,9 +311,10 @@ void runSmallWriteEngine(const struct SmallWriteEngine *smwr,
}
HS_PUBLIC_API
hs_error_t hs_scan(const hs_database_t *db, const char *data, unsigned length,
unsigned flags, hs_scratch_t *scratch,
match_event_handler onEvent, void *userCtx) {
hs_error_t HS_CDECL hs_scan(const hs_database_t *db, const char *data,
unsigned length, unsigned flags,
hs_scratch_t *scratch, match_event_handler onEvent,
void *userCtx) {
if (unlikely(!scratch || !data)) {
return HS_INVALID;
}
@@ -503,8 +504,9 @@ void init_stream(struct hs_stream *s, const struct RoseEngine *rose,
}
HS_PUBLIC_API
hs_error_t hs_open_stream(const hs_database_t *db, UNUSED unsigned flags,
hs_stream_t **stream) {
hs_error_t HS_CDECL hs_open_stream(const hs_database_t *db,
UNUSED unsigned flags,
hs_stream_t **stream) {
if (unlikely(!stream)) {
return HS_INVALID;
}
@@ -656,7 +658,8 @@ void report_eod_matches(hs_stream_t *id, hs_scratch_t *scratch,
}
HS_PUBLIC_API
hs_error_t hs_copy_stream(hs_stream_t **to_id, const hs_stream_t *from_id) {
hs_error_t HS_CDECL hs_copy_stream(hs_stream_t **to_id,
const hs_stream_t *from_id) {
if (!to_id) {
return HS_INVALID;
}
@@ -683,11 +686,11 @@ hs_error_t hs_copy_stream(hs_stream_t **to_id, const hs_stream_t *from_id) {
}
HS_PUBLIC_API
hs_error_t hs_reset_and_copy_stream(hs_stream_t *to_id,
const hs_stream_t *from_id,
hs_scratch_t *scratch,
match_event_handler onEvent,
void *context) {
hs_error_t HS_CDECL hs_reset_and_copy_stream(hs_stream_t *to_id,
const hs_stream_t *from_id,
hs_scratch_t *scratch,
match_event_handler onEvent,
void *context) {
if (!from_id || !from_id->rose) {
return HS_INVALID;
}
@@ -906,9 +909,10 @@ hs_error_t hs_scan_stream_internal(hs_stream_t *id, const char *data,
}
HS_PUBLIC_API
hs_error_t hs_scan_stream(hs_stream_t *id, const char *data, unsigned length,
unsigned flags, hs_scratch_t *scratch,
match_event_handler onEvent, void *context) {
hs_error_t HS_CDECL hs_scan_stream(hs_stream_t *id, const char *data,
unsigned length, unsigned flags,
hs_scratch_t *scratch,
match_event_handler onEvent, void *context) {
if (unlikely(!id || !scratch || !data ||
!validScratch(id->rose, scratch))) {
return HS_INVALID;
@@ -924,8 +928,9 @@ hs_error_t hs_scan_stream(hs_stream_t *id, const char *data, unsigned length,
}
HS_PUBLIC_API
hs_error_t hs_close_stream(hs_stream_t *id, hs_scratch_t *scratch,
match_event_handler onEvent, void *context) {
hs_error_t HS_CDECL hs_close_stream(hs_stream_t *id, hs_scratch_t *scratch,
match_event_handler onEvent,
void *context) {
if (!id) {
return HS_INVALID;
}
@@ -947,9 +952,10 @@ hs_error_t hs_close_stream(hs_stream_t *id, hs_scratch_t *scratch,
}
HS_PUBLIC_API
hs_error_t hs_reset_stream(hs_stream_t *id, UNUSED unsigned int flags,
hs_scratch_t *scratch, match_event_handler onEvent,
void *context) {
hs_error_t HS_CDECL hs_reset_stream(hs_stream_t *id, UNUSED unsigned int flags,
hs_scratch_t *scratch,
match_event_handler onEvent,
void *context) {
if (!id) {
return HS_INVALID;
}
@@ -972,7 +978,8 @@ hs_error_t hs_reset_stream(hs_stream_t *id, UNUSED unsigned int flags,
}
HS_PUBLIC_API
hs_error_t hs_stream_size(const hs_database_t *db, size_t *stream_size) {
hs_error_t HS_CDECL hs_stream_size(const hs_database_t *db,
size_t *stream_size) {
if (!stream_size) {
return HS_INVALID;
}
@@ -1019,10 +1026,13 @@ void dumpData(const char *data, size_t len) {
#endif
HS_PUBLIC_API
hs_error_t hs_scan_vector(const hs_database_t *db, const char * const * data,
const unsigned int *length, unsigned int count,
UNUSED unsigned int flags, hs_scratch_t *scratch,
match_event_handler onEvent, void *context) {
hs_error_t HS_CDECL hs_scan_vector(const hs_database_t *db,
const char * const * data,
const unsigned int *length,
unsigned int count,
UNUSED unsigned int flags,
hs_scratch_t *scratch,
match_event_handler onEvent, void *context) {
if (unlikely(!scratch || !data || !length)) {
return HS_INVALID;
}