1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556(****************************************************************************)(* *)(* This file is part of MOPSA, a Modular Open Platform for Static Analysis. *)(* *)(* Copyright (C) 2017-2021 The MOPSA Project. *)(* *)(* This program is free software: you can redistribute it and/or modify *)(* it under the terms of the GNU Lesser General Public License as published *)(* by the Free Software Foundation, either version 3 of the License, or *)(* (at your option) any later version. *)(* *)(* This program is distributed in the hope that it will be useful, *)(* but WITHOUT ANY WARRANTY; without even the implied warranty of *)(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *)(* GNU Lesser General Public License for more details. *)(* *)(* You should have received a copy of the GNU Lesser General Public License *)(* along with this program. If not, see <http://www.gnu.org/licenses/>. *)(* *)(****************************************************************************)(** Alarms *)openMopsatypecheck+=CHK_CPYTHON_CLASS_READYtypealarm_kind+=A_cpython_class_not_readyofexprlet()=register_check(funnextfmt->function|CHK_CPYTHON_CLASS_READY->Format.fprintffmt"CPython class not readied"|a->nextfmta)let()=register_alarm{check=(funnext->function|A_cpython_class_not_ready_->CHK_CPYTHON_CLASS_READY|a->nexta);compare=(funnexta1a2->matcha1,a2with|A_cpython_class_not_readye1,A_cpython_class_not_readye2->compare_expre1e2|_->nexta1a2);print=(funnextfmt->function|A_cpython_class_not_readye->Format.fprintffmt"PyTypeObject %a has not been readied using PyType_Ready"pp_expre|m->nextfmtm);join=(funnext->next);}letraise_cpython_class_not_ready?(bottom=true)erangemanflow=letcs=Flow.get_callstackflowinletalarm=mk_alarm(A_cpython_class_not_readye)csrangeinFlow.raise_alarmalarm~bottomman.latticeflow