--- /dev/null
+ o Minor feature (hs):
+ - Fix compiler warnings in equix and hashx when building with clang.
+ Closes ticket 40800.
message(STATUS "Setting default build type: ${CMAKE_BUILD_TYPE}")
endif()
-add_library(equix SHARED ${equix_sources})
-set_property(TARGET equix PROPERTY POSITION_INDEPENDENT_CODE ON)
-set_property(TARGET equix PROPERTY PUBLIC_HEADER include/equix.h)
-include_directories(equix
+include_directories(
include/
hashx/include/
hashx/src/)
+
+add_library(equix SHARED ${equix_sources})
+set_property(TARGET equix PROPERTY POSITION_INDEPENDENT_CODE ON)
+set_property(TARGET equix PROPERTY PUBLIC_HEADER include/equix.h)
target_compile_definitions(equix PRIVATE HASHX_STATIC)
target_compile_definitions(equix PRIVATE EQUIX_SHARED)
target_link_libraries(equix
set_target_properties(equix_static PROPERTIES OUTPUT_NAME equix)
target_compile_definitions(equix_static PRIVATE HASHX_STATIC)
target_compile_definitions(equix_static PRIVATE EQUIX_STATIC)
-include_directories(equix_static
- include/
- hashx/include/
- hashx/src/)
target_link_libraries(equix_static
PRIVATE hashx_static)
add_executable(equix-tests
src/tests.c)
-include_directories(equix-tests
- include/)
target_compile_definitions(equix-tests PRIVATE EQUIX_STATIC)
target_link_libraries(equix-tests
PRIVATE equix_static)
src/bench.c
hashx/src/hashx_thread.c
hashx/src/hashx_time.c)
-include_directories(equix-bench
- include/
- hashx/src/)
target_compile_definitions(equix-bench PRIVATE EQUIX_STATIC)
target_link_libraries(equix-bench
PRIVATE equix_static
endif()
endif()
+include_directories(include/)
+
add_library(hashx SHARED ${hashx_sources})
set_property(TARGET hashx PROPERTY POSITION_INDEPENDENT_CODE ON)
set_property(TARGET hashx PROPERTY PUBLIC_HEADER include/hashx.h)
-include_directories(hashx
- include/)
target_compile_definitions(hashx PRIVATE HASHX_SHARED)
set_target_properties(hashx PROPERTIES VERSION ${HASHX_VERSION_STR}
SOVERSION ${HASHX_VERSION})
add_executable(hashx-tests
src/tests.c)
-include_directories(hashx-tests
- include/)
target_compile_definitions(hashx-tests PRIVATE HASHX_STATIC)
target_link_libraries(hashx-tests
PRIVATE hashx_static)
src/bench.c
src/hashx_thread.c
src/hashx_time.c)
-include_directories(hashx-bench
- include/)
target_compile_definitions(hashx-bench PRIVATE HASHX_STATIC)
target_link_libraries(hashx-bench
PRIVATE hashx_static
if (!hashx_vm_rx(code, COMP_CODE_SIZE))
return false;
#ifdef __GNUC__
- __builtin___clear_cache(code, pos);
+ __builtin___clear_cache((void*)code, (void*)pos);
#endif
return true;
}
uint8_t hash_right[HASHX_SIZE];
hashx_result r_left = hashx_exec(hash_func, left, hash_left);
hashx_result r_right = hashx_exec(hash_func, right, hash_right);
- assert(r_left == HASHX_OK && r_right == HASHX_OK);
- return load64(hash_left) + load64(hash_right);
+ if (r_left == HASHX_OK && r_right == HASHX_OK) {
+ return load64(hash_left) + load64(hash_right);
+ }
+ assert(false);
+ return ~(uint64_t)0;
}
static equix_result verify_internal(hashx_ctx* hash_func, const equix_solution* solution) {
typedef stage2_idx_item s2_idx;
typedef stage3_idx_item s3_idx;
-static FORCE_INLINE uint64_t hash_value(hashx_ctx* hash_func, equix_idx index) {
+static FORCE_INLINE bool hash_value(hashx_ctx* hash_func, equix_idx index, uint64_t *value_out) {
char hash[HASHX_SIZE];
hashx_result result = hashx_exec(hash_func, index, hash);
- assert(result == HASHX_OK);
- return load64(hash);
+ if (result == HASHX_OK) {
+ *value_out = load64(hash);
+ return true;
+ } else {
+ assert(false);
+ return false;
+ }
}
static void build_solution_stage1(equix_idx* output, solver_heap* heap, s2_idx root) {
static void solve_stage0(hashx_ctx* hash_func, solver_heap* heap) {
CLEAR(heap->stage1_indices.counts);
for (u32 i = 0; i < INDEX_SPACE; ++i) {
- uint64_t value = hash_value(hash_func, i);
+ uint64_t value;
+ if (!hash_value(hash_func, i, &value))
+ break;
u32 bucket_idx = value % NUM_COARSE_BUCKETS;
u32 item_idx = STAGE1_SIZE(bucket_idx);
if (item_idx >= COARSE_BUCKET_ITEMS)