Possible to enable libc++ debug checks?

这一生的挚爱 提交于 2019-12-21 23:51:13

问题


I've been wondering if it is possible to enable any debug checks for libc++. One of my favorite things about MSVC's STL is that it catches some otherwise hard to find bugs right from the get go (though I wish it were easier to disable for speed). After peeking in the headers I tried:

#define _LIBCPP_DEBUG_LEVEL 2

However, this leads to build errors ('__get_db undeclared'). Any insights on whether this is a work in progress, or if there is a different expected way to enable these checks?


回答1:


This is definitely a work in progress. There's a (very old) status page here that I need to update.

The idea is that users will interact with it by setting the preprocessor symbol _LIBCPP_DEBUG Just defining it will give basic tests, setting it to a number > 1 will give more extensive tests.

However, as you have found, it is currently non-functional.




回答2:


It appears some progress was made on this in the meantime. At least there is some documentation now that doesn't state that the debug mode is horribly broken.

As stated in the docs I link, the debug mode shall be controlled by defining _LIBCPP_DEBUG to either 0 or 1; the macro _LIBCPP_DEBUG_LEVEL appears to be some internal switch.

However, looking at question like this one, spurious compilation errors can and do still happen.



来源:https://stackoverflow.com/questions/23848666/possible-to-enable-libc-debug-checks

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!