1*0a307195Smrg // Debugging mode support code -*- C++ -*- 2*0a307195Smrg 3*0a307195Smrg // Copyright (C) 2021-2023 Free Software Foundation, Inc. 4*0a307195Smrg // 5*0a307195Smrg // This file is part of the GNU ISO C++ Library. This library is free 6*0a307195Smrg // software; you can redistribute it and/or modify it under the 7*0a307195Smrg // terms of the GNU General Public License as published by the 8*0a307195Smrg // Free Software Foundation; either version 3, or (at your option) 9*0a307195Smrg // any later version. 10*0a307195Smrg 11*0a307195Smrg // This library is distributed in the hope that it will be useful, 12*0a307195Smrg // but WITHOUT ANY WARRANTY; without even the implied warranty of 13*0a307195Smrg // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14*0a307195Smrg // GNU General Public License for more details. 15*0a307195Smrg 16*0a307195Smrg // Under Section 7 of GPL version 3, you are granted additional 17*0a307195Smrg // permissions described in the GCC Runtime Library Exception, version 18*0a307195Smrg // 3.1, as published by the Free Software Foundation. 19*0a307195Smrg 20*0a307195Smrg // You should have received a copy of the GNU General Public License and 21*0a307195Smrg // a copy of the GCC Runtime Library Exception along with this program; 22*0a307195Smrg // see the files COPYING3 and COPYING.RUNTIME respectively. If not, see 23*0a307195Smrg // <http://www.gnu.org/licenses/>. 24*0a307195Smrg 25*0a307195Smrg #include <cstdio> // for std::fprintf, stderr 26*0a307195Smrg #include <cstdlib> // for std::abort 27*0a307195Smrg 28*0a307195Smrg #ifdef _GLIBCXX_VERBOSE_ASSERT 29*0a307195Smrg namespace std 30*0a307195Smrg { 31*0a307195Smrg [[__noreturn__]] 32*0a307195Smrg void __glibcxx_assert_fail(const char * file,int line,const char * function,const char * condition)33*0a307195Smrg __glibcxx_assert_fail(const char* file, int line, 34*0a307195Smrg const char* function, const char* condition) noexcept 35*0a307195Smrg { 36*0a307195Smrg if (file && function && condition) 37*0a307195Smrg fprintf(stderr, "%s:%d: %s: Assertion '%s' failed.\n", 38*0a307195Smrg file, line, function, condition); 39*0a307195Smrg else if (function) 40*0a307195Smrg fprintf(stderr, "%s: Undefined behavior detected.\n", function); 41*0a307195Smrg abort(); 42*0a307195Smrg } 43*0a307195Smrg } 44*0a307195Smrg #endif 45