On Tue, May 30, 2017 at 12:28:57PM -0300, claudioandre.br@xxxxxxxxx wrote: > From: Claudio André <claudioandre.br@xxxxxxxxx> > > Sanitizers are based on compile-time instrumentation. They are available in gcc and clang for a range of supported operation systems and platforms. More info at: https://github.com/google/sanitizers Please line wrap your commit messages at 80 chars or less. > diff --git a/m4/virt-compile-sanitizer.m4 b/m4/virt-compile-sanitizer.m4 > new file mode 100644 > index 0000000..a7cac31 > --- /dev/null > +++ b/m4/virt-compile-sanitizer.m4 > @@ -0,0 +1,51 @@ > +dnl > +dnl Check for support for Sanitizers > +dnl Check for -fsanitize=address and -fsanitize=undefined support > +dnl > +dnl This library is free software; you can redistribute it and/or > +dnl modify it under the terms of the GNU Lesser General Public > +dnl License as published by the Free Software Foundation; either > +dnl version 2.1 of the License, or (at your option) any later version. > +dnl > +dnl This library is distributed in the hope that it will be useful, > +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of > +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > +dnl Lesser General Public License for more details. > +dnl > +dnl You should have received a copy of the GNU Lesser General Public > +dnl License along with this library. If not, see > +dnl <http://www.gnu.org/licenses/>. > +dnl > + > +AC_DEFUN([LIBVIRT_COMPILE_SANITIZER],[ > + LIBVIRT_ARG_ENABLE([ASAN], [Build with address sanitizer support], [no]) > + LIBVIRT_ARG_ENABLE([UBSAN], [Build with undefined behavior sanitizer support], [no]) > + > + SAN_CFLAGS= > + SAN_LDFLAGS= > + > + AS_IF([test "x$enable_asan" = "xyes"], [ > + gl_COMPILER_OPTION_IF([-fsanitize=address -fno-omit-frame-pointer], [ > + SAN_CFLAGS="-fsanitize=address -fno-omit-frame-pointer" > + SAN_LDFLAGS="-fsanitize=address" > + ]) > + > + AC_SUBST([SAN_CFLAGS]) > + AC_SUBST([SAN_LDFLAGS]) > + ]) > + > + AS_IF([test "x$enable_ubsan" = "xyes"], [ > + gl_COMPILER_OPTION_IF([-fsanitize=undefined -fno-omit-frame-pointer], [ > + SAN_CFLAGS="$SAN_CFLAGS -fsanitize=undefined -fno-omit-frame-pointer" > + SAN_LDFLAGS="$SAN_LDFLAGS -fsanitize=undefined" > + ]) > + > + AC_SUBST([SAN_CFLAGS]) > + AC_SUBST([SAN_LDFLAGS]) > + ]) > +]) > + > +AC_DEFUN([LIBVIRT_RESULT_SANITIZER], [ > + AC_MSG_NOTICE([ ASan: $enable_asan]) > + AC_MSG_NOTICE([ UBSan: $enable_ubsan]) > +]) IMHO this could just be added to m4/virt-compile-warnings.m4, rather than needing to define new CFLAGS/LDFLAGFS variables. Regards, Daniel -- |: https://berrange.com -o- https://www.flickr.com/photos/dberrange :| |: https://libvirt.org -o- https://fstop138.berrange.com :| |: https://entangle-photo.org -o- https://www.instagram.com/dberrange :| -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list