Page MenuHomePhabricator

[OpenMP] Remove unused variables from libomp code

Authored by protze.joachim on Jun 15 2021, 8:20 AM.



Several variables are left unused as a result of different patches removing their use.

Two variables have some use:
poll_count is used by KMP_BLOCKING under certain conditions. Adding (void) to tell the compiler to ignore the unused variable.

padding is a dummy stack allocation with no intent to be used. Also adding (void) to make the compiler ignore the unused variable.

Diff Detail

Event Timeline

protze.joachim created this revision.Jun 15 2021, 8:20 AM
protze.joachim requested review of this revision.Jun 15 2021, 8:20 AM
This revision is now accepted and ready to land.Jun 15 2021, 10:53 AM

Can you remove the lines from runtime/cmake/LibompHandleFlags.cmake:

libomp_append(flags_local -Wno-uninitialized LIBOMP_HAVE_WNO_UNINITIALIZED_FLAG)
libomp_append(flags_local -Wno-unused-but-set-variable LIBOMP_HAVE_WNO_UNUSED_BUT_SET_VARIABLE_FLAG)

inside the libomp_get_cxxflags function?

Were these seen from gcc warnings or a static analysis tool?

Sorry, I think it is only
libomp_append(flags_local -Wno-unused-but-set-variable LIBOMP_HAVE_WNO_UNUSED_BUT_SET_VARIABLE_FLAG)
that is relevant

protze.joachim added a comment.EditedJun 15 2021, 2:17 PM

Were these seen from gcc warnings or a static analysis tool?

I saw the warnings from current clang, when building OpenMP stand-alone.
And you are right: The warnings are all -Wunused-but-set-variable.

I have no idea, why the -Wno-unused-but-set-variable did not help to suppress the warnings.

This revision was automatically updated to reflect the committed changes.