IlyaGrebnov / libsais

libsais is a library for linear time suffix array, longest common prefix array and burrows wheeler transform construction based on induced sorting algorithm.
Apache License 2.0
180 stars 22 forks source link

Fix gcc14 error about implicit function 'max' #25

Closed SGSSGene closed 2 months ago

SGSSGene commented 2 months ago

Under gcc13 we get many warnings like:

libsais/src/libsais16.c:2185:84: warning: implicit declaration of function ‘max’ [-Wimplicit-function-declaration]
 2185 |     #pragma omp parallel num_threads(threads) if(threads > 1 && block_size >= 64 * max(k, 256) && omp_get_dynamic() == 0)

With gcc14 these turn by default to errors.

IlyaGrebnov commented 2 months ago

"I see no issues with the change, so I am merging it. However, I will replace it with a ternary operator and push a new release later today to avoid any future issues with macros.

SGSSGene commented 2 months ago

"I see no issues with the change, so I am merging it. However, I will replace it with a ternary operator and push a new release later today to avoid any future issues with macros.

Sounds great! I am also not a fan of the macros.