Ensure GDB warnings are styled.
[deliverable/binutils-gdb.git] / gdb / sanitize.m4
CommitLineData
f35d5ade 1dnl Sanitization-related configure macro for GDB
b811d2c2 2dnl Copyright (C) 2018-2020 Free Software Foundation, Inc.
f35d5ade
TT
3dnl
4dnl This file is part of GDB.
5dnl
6dnl This program is free software; you can redistribute it and/or modify
7dnl it under the terms of the GNU General Public License as published by
8dnl the Free Software Foundation; either version 3 of the License, or
9dnl (at your option) any later version.
10dnl
11dnl This program is distributed in the hope that it will be useful,
12dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
13dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14dnl GNU General Public License for more details.
15dnl
16dnl You should have received a copy of the GNU General Public License
17dnl along with this program. If not, see <http://www.gnu.org/licenses/>.
18
19AC_DEFUN([AM_GDB_UBSAN],[
20AC_ARG_ENABLE(ubsan,
21 AS_HELP_STRING([--enable-ubsan],
22 [enable undefined behavior sanitizer (auto/yes/no)]),
eff98030 23 [],enable_ubsan=no)
f35d5ade
TT
24if test "x$enable_ubsan" = xauto; then
25 if $development; then
26 enable_ubsan=yes
27 fi
28fi
29AC_LANG_PUSH([C++])
30if test "x$enable_ubsan" = xyes; then
31 AC_MSG_CHECKING(whether -fsanitize=undefined is accepted)
32 saved_CXXFLAGS="$CXXFLAGS"
33 CXXFLAGS="$CXXFLAGS -fsanitize=undefined -fno-sanitize-recover=undefined"
34 dnl A link check is required because it is possible to install gcc
35 dnl without libubsan, leading to link failures when compiling with
36 dnl -fsanitize=undefined.
37 AC_TRY_LINK([],[],enable_ubsan=yes,enable_ubsan=no)
38 CXXFLAGS="$saved_CXXFLAGS"
39 AC_MSG_RESULT($enable_ubsan)
40 if test "x$enable_ubsan" = xyes; then
41 WARN_CFLAGS="$WARN_CFLAGS -fsanitize=undefined -fno-sanitize-recover=undefined"
42 CONFIG_LDFLAGS="$CONFIG_LDFLAGS -fsanitize=undefined"
43 fi
44fi
45AC_LANG_POP([C++])
46])
This page took 0.18287 seconds and 4 git commands to generate.