Commit 2ba059ae authored by Ronan's avatar Ronan Committed by Ronan

feat(compiler): add 3 macros => BCTBX_ASAN_ENABLED, BCTBX_DISABLE_ASAN and BCTBX_DISABLE_UBSAN

parent 3a1d9853
......@@ -21,18 +21,19 @@
############################################################################
set(HEADER_FILES
charconv.h
compiler.h
crypto.h
defs.h
exception.hh
list.h
logging.h
map.h
port.h
vfs.h
vconnect.h
parser.h
port.h
regex.h
charconv.h
exception.hh
vconnect.h
vfs.h
)
if(ENABLE_TESTS_COMPONENT)
list(APPEND HEADER_FILES tester.h)
......@@ -40,7 +41,7 @@ endif()
set(BCTOOLBOX_HEADER_FILES )
foreach(HEADER_FILE ${HEADER_FILES})
list(APPEND BCTOOLBOX_HEADER_FILES "${CMAKE_CURRENT_LIST_DIR}/bctoolbox/${HEADER_FILE}")
list(APPEND BCTOOLBOX_HEADER_FILES "${CMAKE_CURRENT_LIST_DIR}/bctoolbox/${HEADER_FILE}")
endforeach()
set(BCTOOLBOX_HEADER_FILES ${BCTOOLBOX_HEADER_FILES} PARENT_SCOPE)
......
/*
* compiler.h
* Copyright (C) 2010-2018 Belledonne Communications SARL
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#ifndef COMPILER_H
#define COMPILER_H
#ifdef __has_feature
#if __has_feature(address_sanitizer)
#define BCTBX_ASAN_ENABLED
#endif // if __has_feature(address_sanitizer)
#elif defined(__SANITIZE_ADDRESS__)
#define BCTBX_ASAN_ENABLED
#endif // ifdef __has_feature
#ifdef BCTBX_ASAN_ENABLED
#define BCTBX_DISABLE_ASAN __attribute__((no_sanitize_address))
#else
#define BCTBX_DISABLE_ASAN
#endif // ifdef BCTBX_ASAN_ENABLED
#ifdef __has_attribute
#if __has_attribute(no_sanitize)
#define BCTBX_DISABLE_UBSAN __attribute__((no_sanitize("undefined")))
#endif
#elif defined(__GNUC__) && !defined(__MINGW32__)
#define BCTBX_DISABLE_UBSAN __attribute__((no_sanitize("undefined")))
#else
#define BCTBX_DISABLE_UBSAN
#endif // ifdef __has_attribute
#endif // ifdef COMPILER_H
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment