This is a followup to #8105, implements task 3 from it.
LOCK macro declares its variable criticalblock. When LOCK is used in nested block, again, the variable named criticalblock is used. When compiling with -Wshadow, this emits warning.
This change renames the variable criticalblock to criticalblockn, where n is ordinal number of the variable in the compiled file. Macro __COUNTER__ is used for this. It is supported by gcc (https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html), clang (http://clang.llvm.org/docs/LanguageExtensions.html) and Visual Studio (https://msdn.microsoft.com/en-us/library/b0084kay.aspx).