[libcxx] r177892 - Debug mode: learning to crawl. I need to set up some tests that actually test that the debug mode is working, but that won't cause problems when debug mode isn't on. This is my first prototype of such a test. It should call std::terminate() because it's comparing iterators from different containers. And std::terminate() is rigged up to exit normally. If debug mode fails, and doesn't call terminate, then the program asserts. The test is a no-op if _LIBCPP_DEBUG2 is not defined or is def...
Dmitri Gribenko
gribozavr at gmail.com
Mon Mar 25 17:42:21 PDT 2013
On Mon, Mar 25, 2013 at 9:29 PM, Howard Hinnant <hhinnant at apple.com> wrote:
> Author: hhinnant
> Date: Mon Mar 25 14:29:35 2013
> New Revision: 177892
>
> URL: http://llvm.org/viewvc/llvm-project?rev=177892&view=rev
> Log:
> Debug mode: learning to crawl. I need to set up some tests that actually test that the debug mode is working, but that won't cause problems when debug mode isn't on. This is my first prototype of such a test. It should call std::terminate() because it's comparing iterators from different containers. And std::terminate() is rigged up to exit normally. If debug mode fails, and doesn't call terminate, then the program asserts. The test is a no-op if _LIBCPP_DEBUG2 is not defined or is defined to be 0.
Hi Howard,
Maybe I'm missing something, but why go through std::terminate when
you can put std::exit(0) here:
> +#define _LIBCPP_ASSERT(x, m) ((x) ? (void)0 : std::terminate())
Dmitri
--
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/
More information about the cfe-commits
mailing list