Remove debug-only private fields in release builds
We have a bunch of classes with private fields that are used only in debug builds, some of them are probably opportunities for complete removal. This is exposed by an upcoming commit that enforces the use of "=delete" and "=default" throughout the codebase. I've attempted to solve this by adding the GPOS_ASSERTS_ONLY attribute, but GCC doesn't like that, throwing errors like the following: In file included from ../src/backend/gporca/libgpos/include/gpos/common/clibwrapper.h:22, from ../src/backend/gporca/libgpos/include/gpos/error/CMessage.h:21, from ../src/backend/gporca/libgpos/include/gpos/error/CMessageTable.h:14, from ../src/backend/gporca/libgpos/include/gpos/error/CMessageRepository.h:14, from ../src/backend/gporca/libgpos/src/_api.cpp:15: ../src/backend/gporca/libgpos/include/gpos/attributes.h:15:43: error: ‘unused’ attribute ignored [-Werror=attributes] 15 | #define GPOS_UNUSED __attribute__((unused)) | ^ ../src/backend/gporca/libgpos/include/gpos/attributes.h:21:27: note: in expansion of macro ‘GPOS_UNUSED’ 21 | #define GPOS_ASSERTS_ONLY GPOS_UNUSED | ^~~~~~~~~~~ ../src/backend/gporca/libgpos/include/gpos/memory/CAutoMemoryPool.h:56:31: note: in expansion of macro ‘GPOS_ASSERTS_ONLY’ 56 | ELeakCheck m_leak_check_type GPOS_ASSERTS_ONLY; | ^~~~~~~~~~~~~~~~~ cc1plus: all warnings being treated as errors So we're back to the good ol' #ifdef GPOS_DEBUG. This is the first of a pair of manual changes. In the immediately following commit I'll remove the remaining (unconditionally) unused private fields.
Showing
想要评论请 注册 或 登录