Files
simdjson-simdjson/fuzz/supported_implementations.h
Paul Dreik 8a68163905 simplify fuzzing only dynamically supported implementations (#1201)
This refactors the dynamic check of which implementations are supported at runtime.

It also reduces duplicated effort in the CI fuzzing job, the differential fuzzers don't need to run with different values of SIMDJSON_FORCE_IMPLEMENTATION.

There is also a convenience script to run the fuzzers locally, to quickly check that the fuzzers still build, run and no easy to find bugs are there. It should be handy not only when developing the fuzzers, but also when modifying simdjson.
2020-10-09 05:29:54 +02:00

31 lines
816 B
C++

#pragma once
#include "simdjson.h"
#include <vector>
#include <cstdlib>
/**
* @brief get_runtime_supported_implementations
* Returns a vector of implementations, which both
* have been compiled *and* are dynamically checked to
* be supported at runtime.
*
* Aborts if no implementations are available (should not happen, fallback
* should always be there for us!)
* @return
*/
std::vector<const simdjson::implementation*>
get_runtime_supported_implementations() {
std::vector<const simdjson::implementation*> ret;
for(auto& e: simdjson::available_implementations) {
if(e->supported_by_runtime_system()) {
ret.emplace_back(e);
}
}
if(ret.empty()) {
// No implementations available, not even fallback, weird.
std::abort();
}
return ret;
}