actually, just cast off the const inside h_compile
This commit is contained in:
parent
ebcfa86911
commit
369dbcd21f
3 changed files with 8 additions and 7 deletions
|
|
@ -21,11 +21,11 @@
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
HBenchmarkResults *h_benchmark(HParser* parser, HParserTestcase* testcases) {
|
HBenchmarkResults *h_benchmark(const HParser* parser, HParserTestcase* testcases) {
|
||||||
return h_benchmark__m(&system_allocator, parser, testcases);
|
return h_benchmark__m(&system_allocator, parser, testcases);
|
||||||
}
|
}
|
||||||
|
|
||||||
HBenchmarkResults *h_benchmark__m(HAllocator* mm__, HParser* parser, HParserTestcase* testcases) {
|
HBenchmarkResults *h_benchmark__m(HAllocator* mm__, const HParser* parser, HParserTestcase* testcases) {
|
||||||
// For now, just output the results to stderr
|
// For now, just output the results to stderr
|
||||||
HParserTestcase* tc = testcases;
|
HParserTestcase* tc = testcases;
|
||||||
HParserBackend backend = PB_MIN;
|
HParserBackend backend = PB_MIN;
|
||||||
|
|
|
||||||
|
|
@ -7,10 +7,11 @@ static HParserBackendVTable *backends[PB_MAX] = {
|
||||||
&h__ll_backend_vtable,
|
&h__ll_backend_vtable,
|
||||||
};
|
};
|
||||||
|
|
||||||
int h_compile(HParser* parser, HParserBackend backend, const void* params) {
|
int h_compile(const HParser* parser, HParserBackend backend, const void* params) {
|
||||||
return h_compile__m(&system_allocator, parser, backend, params);
|
return h_compile__m(&system_allocator, parser, backend, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
int h_compile__m(HAllocator* mm__, HParser* parser, HParserBackend backend, const void* params) {
|
int h_compile__m(HAllocator* mm__, const HParser* parser, HParserBackend backend, const void* params) {
|
||||||
return backends[backend]->compile(mm__, parser, params);
|
// be naughty and cast off the const
|
||||||
|
return backends[backend]->compile(mm__, (HParser *)parser, params);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -565,7 +565,7 @@ HAMMER_FN_DECL(void, h_pprint, FILE* stream, const HParsedToken* tok, int indent
|
||||||
*
|
*
|
||||||
* Returns -1 if grammar cannot be compiled with the specified options; 0 otherwise.
|
* Returns -1 if grammar cannot be compiled with the specified options; 0 otherwise.
|
||||||
*/
|
*/
|
||||||
HAMMER_FN_DECL(int, h_compile, HParser* parser, HParserBackend backend, const void* params);
|
HAMMER_FN_DECL(int, h_compile, const HParser* parser, HParserBackend backend, const void* params);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* TODO: Document me
|
* TODO: Document me
|
||||||
|
|
@ -590,7 +590,7 @@ const uint8_t* h_bit_writer_get_buffer(HBitWriter* w, size_t *len);
|
||||||
void h_bit_writer_free(HBitWriter* w);
|
void h_bit_writer_free(HBitWriter* w);
|
||||||
|
|
||||||
// {{{ Benchmark functions
|
// {{{ Benchmark functions
|
||||||
HAMMER_FN_DECL(HBenchmarkResults *, h_benchmark, HParser* parser, HParserTestcase* testcases);
|
HAMMER_FN_DECL(HBenchmarkResults *, h_benchmark, const HParser* parser, HParserTestcase* testcases);
|
||||||
void h_benchmark_report(FILE* stream, HBenchmarkResults* results);
|
void h_benchmark_report(FILE* stream, HBenchmarkResults* results);
|
||||||
void h_benchmark_dump_optimized_code(FILE* stream, HBenchmarkResults* results);
|
void h_benchmark_dump_optimized_code(FILE* stream, HBenchmarkResults* results);
|
||||||
// }}}
|
// }}}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue