Skip to content

Commit

Permalink
fix gcc -Wmaybe-uninitialized warning
Browse files Browse the repository at this point in the history
  • Loading branch information
jameslamb committed Dec 5, 2023
1 parent 7f0de8f commit b62e46d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .ci/lint-cpp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ get_omp_pragmas_without_num_threads() {
--include='*.h' \
--include='*.hpp' \
'pragma omp parallel' \
| grep -v ' num_threads' \
| grep -v ' num_threads'
}
PROBLEMATIC_LINES=$(
get_omp_pragmas_without_num_threads
Expand Down
2 changes: 1 addition & 1 deletion R-package/tests/testthat/test_multithreading.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
test_that("getLGBMthreads() and setLGBMthreads() work as expected", {
# works with integer input
setLGBMthreads(2L)
ret <- setLGBMthreads(2L)
expect_null(ret)
expect_equal(getLGBMthreads(), 2L)

Expand Down
2 changes: 1 addition & 1 deletion include/LightGBM/utils/openmp_wrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ LIGHTGBM_EXTERN_C int LGBM_DEFAULT_NUM_THREADS;
- https://gcc.gnu.org/onlinedocs/libgomp/omp_005fget_005fmax_005fthreads.html
*/
inline int OMP_NUM_THREADS() {
int default_num_threads;
int default_num_threads = 1;

if (LGBM_DEFAULT_NUM_THREADS > 0) {
// if LightGBM-specific default has been set, ignore OpenMP-global config
Expand Down

0 comments on commit b62e46d

Please sign in to comment.