2 * Copyright (C) 2016 Oracle.
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, see http://www.gnu.org/copyleft/gpl.txt
17 * Copyright 2019 Joyent, Inc.
21 * Heavily borrowed from check_wine.c: what we're doing here is teaching smatch
22 * that cmn_err(CE_PANIC, ...) is noreturn.
27 #include "smatch_extra.h"
31 void match_cmn_err(const char *fn
, struct expression
*expr
,
34 struct expression
*arg
;
37 arg
= get_argument_from_call_expr(expr
->args
, 0);
38 if (!get_implied_value(arg
, &sval
))
41 if (sval
.value
== CE_PANIC
)
46 void check_cmn_err(int id
)
48 if (option_project
!= PROJ_ILLUMOS_KERNEL
)
51 add_function_hook("cmn_err", &match_cmn_err
, NULL
);