remove some un-needed third party code
This commit is contained in:
parent
6122154f74
commit
049d1eec63
1
.gitignore
vendored
1
.gitignore
vendored
@ -6,3 +6,4 @@ site/
|
|||||||
ws/.certs/
|
ws/.certs/
|
||||||
ws/.srl
|
ws/.srl
|
||||||
ixhttpd
|
ixhttpd
|
||||||
|
makefile
|
||||||
|
316
third_party/jsoncpp/json/json-forwards.h
vendored
316
third_party/jsoncpp/json/json-forwards.h
vendored
@ -1,316 +0,0 @@
|
|||||||
/// Json-cpp amalgamated forward header (http://jsoncpp.sourceforge.net/).
|
|
||||||
/// It is intended to be used with #include "json/json-forwards.h"
|
|
||||||
/// This header provides forward declaration for all JsonCpp types.
|
|
||||||
|
|
||||||
// //////////////////////////////////////////////////////////////////////
|
|
||||||
// Beginning of content of file: LICENSE
|
|
||||||
// //////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
/*
|
|
||||||
The JsonCpp library's source code, including accompanying documentation,
|
|
||||||
tests and demonstration applications, are licensed under the following
|
|
||||||
conditions...
|
|
||||||
|
|
||||||
Baptiste Lepilleur and The JsonCpp Authors explicitly disclaim copyright in all
|
|
||||||
jurisdictions which recognize such a disclaimer. In such jurisdictions,
|
|
||||||
this software is released into the Public Domain.
|
|
||||||
|
|
||||||
In jurisdictions which do not recognize Public Domain property (e.g. Germany as of
|
|
||||||
2010), this software is Copyright (c) 2007-2010 by Baptiste Lepilleur and
|
|
||||||
The JsonCpp Authors, and is released under the terms of the MIT License (see below).
|
|
||||||
|
|
||||||
In jurisdictions which recognize Public Domain property, the user of this
|
|
||||||
software may choose to accept it either as 1) Public Domain, 2) under the
|
|
||||||
conditions of the MIT License (see below), or 3) under the terms of dual
|
|
||||||
Public Domain/MIT License conditions described here, as they choose.
|
|
||||||
|
|
||||||
The MIT License is about as close to Public Domain as a license can get, and is
|
|
||||||
described in clear, concise terms at:
|
|
||||||
|
|
||||||
http://en.wikipedia.org/wiki/MIT_License
|
|
||||||
|
|
||||||
The full text of the MIT License follows:
|
|
||||||
|
|
||||||
========================================================================
|
|
||||||
Copyright (c) 2007-2010 Baptiste Lepilleur and The JsonCpp Authors
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person
|
|
||||||
obtaining a copy of this software and associated documentation
|
|
||||||
files (the "Software"), to deal in the Software without
|
|
||||||
restriction, including without limitation the rights to use, copy,
|
|
||||||
modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
||||||
of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be
|
|
||||||
included in all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
||||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
||||||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
||||||
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
|
|
||||||
BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
|
|
||||||
ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
||||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
||||||
========================================================================
|
|
||||||
(END LICENSE TEXT)
|
|
||||||
|
|
||||||
The MIT license is compatible with both the GPL and commercial
|
|
||||||
software, affording one all of the rights of Public Domain with the
|
|
||||||
minor nuisance of being required to keep the above copyright notice
|
|
||||||
and license text in the source code. Note also that by accepting the
|
|
||||||
Public Domain "license" you can re-license your copy using whatever
|
|
||||||
license you like.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
// //////////////////////////////////////////////////////////////////////
|
|
||||||
// End of content of file: LICENSE
|
|
||||||
// //////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef JSON_FORWARD_AMALGAMATED_H_INCLUDED
|
|
||||||
# define JSON_FORWARD_AMALGAMATED_H_INCLUDED
|
|
||||||
/// If defined, indicates that the source file is amalgamated
|
|
||||||
/// to prevent private header inclusion.
|
|
||||||
#define JSON_IS_AMALGAMATION
|
|
||||||
|
|
||||||
// //////////////////////////////////////////////////////////////////////
|
|
||||||
// Beginning of content of file: include/json/config.h
|
|
||||||
// //////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
// Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors
|
|
||||||
// Distributed under MIT license, or public domain if desired and
|
|
||||||
// recognized in your jurisdiction.
|
|
||||||
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
|
||||||
|
|
||||||
#ifndef JSON_CONFIG_H_INCLUDED
|
|
||||||
#define JSON_CONFIG_H_INCLUDED
|
|
||||||
#include <cstddef>
|
|
||||||
#include <cstdint>
|
|
||||||
#include <istream>
|
|
||||||
#include <memory>
|
|
||||||
#include <ostream>
|
|
||||||
#include <sstream>
|
|
||||||
#include <string>
|
|
||||||
#include <type_traits>
|
|
||||||
|
|
||||||
// If non-zero, the library uses exceptions to report bad input instead of C
|
|
||||||
// assertion macros. The default is to use exceptions.
|
|
||||||
#ifndef JSON_USE_EXCEPTION
|
|
||||||
#define JSON_USE_EXCEPTION 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Temporary, tracked for removal with issue #982.
|
|
||||||
#ifndef JSON_USE_NULLREF
|
|
||||||
#define JSON_USE_NULLREF 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/// If defined, indicates that the source file is amalgamated
|
|
||||||
/// to prevent private header inclusion.
|
|
||||||
/// Remarks: it is automatically defined in the generated amalgamated header.
|
|
||||||
// #define JSON_IS_AMALGAMATION
|
|
||||||
|
|
||||||
// Export macros for DLL visibility
|
|
||||||
#if defined(JSON_DLL_BUILD)
|
|
||||||
#if defined(_MSC_VER) || defined(__MINGW32__)
|
|
||||||
#define JSON_API __declspec(dllexport)
|
|
||||||
#define JSONCPP_DISABLE_DLL_INTERFACE_WARNING
|
|
||||||
#elif defined(__GNUC__) || defined(__clang__)
|
|
||||||
#define JSON_API __attribute__((visibility("default")))
|
|
||||||
#endif // if defined(_MSC_VER)
|
|
||||||
|
|
||||||
#elif defined(JSON_DLL)
|
|
||||||
#if defined(_MSC_VER) || defined(__MINGW32__)
|
|
||||||
#define JSON_API __declspec(dllimport)
|
|
||||||
#define JSONCPP_DISABLE_DLL_INTERFACE_WARNING
|
|
||||||
#endif // if defined(_MSC_VER)
|
|
||||||
#endif // ifdef JSON_DLL_BUILD
|
|
||||||
|
|
||||||
#if !defined(JSON_API)
|
|
||||||
#define JSON_API
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(_MSC_VER) && _MSC_VER < 1800
|
|
||||||
#error \
|
|
||||||
"ERROR: Visual Studio 12 (2013) with _MSC_VER=1800 is the oldest supported compiler with sufficient C++11 capabilities"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if defined(_MSC_VER) && _MSC_VER < 1900
|
|
||||||
// As recommended at
|
|
||||||
// https://stackoverflow.com/questions/2915672/snprintf-and-visual-studio-2010
|
|
||||||
extern JSON_API int msvc_pre1900_c99_snprintf(char* outBuf, size_t size,
|
|
||||||
const char* format, ...);
|
|
||||||
#define jsoncpp_snprintf msvc_pre1900_c99_snprintf
|
|
||||||
#else
|
|
||||||
#define jsoncpp_snprintf std::snprintf
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// If JSON_NO_INT64 is defined, then Json only support C++ "int" type for
|
|
||||||
// integer
|
|
||||||
// Storages, and 64 bits integer support is disabled.
|
|
||||||
// #define JSON_NO_INT64 1
|
|
||||||
|
|
||||||
// JSONCPP_OVERRIDE is maintained for backwards compatibility of external tools.
|
|
||||||
// C++11 should be used directly in JSONCPP.
|
|
||||||
#define JSONCPP_OVERRIDE override
|
|
||||||
|
|
||||||
#if __cplusplus >= 201103L
|
|
||||||
#define JSONCPP_NOEXCEPT noexcept
|
|
||||||
#define JSONCPP_OP_EXPLICIT explicit
|
|
||||||
#elif defined(_MSC_VER) && _MSC_VER < 1900
|
|
||||||
#define JSONCPP_NOEXCEPT throw()
|
|
||||||
#define JSONCPP_OP_EXPLICIT explicit
|
|
||||||
#elif defined(_MSC_VER) && _MSC_VER >= 1900
|
|
||||||
#define JSONCPP_NOEXCEPT noexcept
|
|
||||||
#define JSONCPP_OP_EXPLICIT explicit
|
|
||||||
#else
|
|
||||||
#define JSONCPP_NOEXCEPT throw()
|
|
||||||
#define JSONCPP_OP_EXPLICIT
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef __clang__
|
|
||||||
#if __has_extension(attribute_deprecated_with_message)
|
|
||||||
#define JSONCPP_DEPRECATED(message) __attribute__((deprecated(message)))
|
|
||||||
#endif
|
|
||||||
#elif defined(__GNUC__) // not clang (gcc comes later since clang emulates gcc)
|
|
||||||
#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5))
|
|
||||||
#define JSONCPP_DEPRECATED(message) __attribute__((deprecated(message)))
|
|
||||||
#elif (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
|
|
||||||
#define JSONCPP_DEPRECATED(message) __attribute__((__deprecated__))
|
|
||||||
#endif // GNUC version
|
|
||||||
#elif defined(_MSC_VER) // MSVC (after clang because clang on Windows emulates
|
|
||||||
// MSVC)
|
|
||||||
#define JSONCPP_DEPRECATED(message) __declspec(deprecated(message))
|
|
||||||
#endif // __clang__ || __GNUC__ || _MSC_VER
|
|
||||||
|
|
||||||
#if !defined(JSONCPP_DEPRECATED)
|
|
||||||
#define JSONCPP_DEPRECATED(message)
|
|
||||||
#endif // if !defined(JSONCPP_DEPRECATED)
|
|
||||||
|
|
||||||
#if defined(__clang__) || (defined(__GNUC__) && (__GNUC__ >= 6))
|
|
||||||
#define JSON_USE_INT64_DOUBLE_CONVERSION 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !defined(JSON_IS_AMALGAMATION)
|
|
||||||
|
|
||||||
#include "allocator.h"
|
|
||||||
#include "version.h"
|
|
||||||
|
|
||||||
#endif // if !defined(JSON_IS_AMALGAMATION)
|
|
||||||
|
|
||||||
namespace Json {
|
|
||||||
using Int = int;
|
|
||||||
using UInt = unsigned int;
|
|
||||||
#if defined(JSON_NO_INT64)
|
|
||||||
using LargestInt = int;
|
|
||||||
using LargestUInt = unsigned int;
|
|
||||||
#undef JSON_HAS_INT64
|
|
||||||
#else // if defined(JSON_NO_INT64)
|
|
||||||
// For Microsoft Visual use specific types as long long is not supported
|
|
||||||
#if defined(_MSC_VER) // Microsoft Visual Studio
|
|
||||||
using Int64 = __int64;
|
|
||||||
using UInt64 = unsigned __int64;
|
|
||||||
#else // if defined(_MSC_VER) // Other platforms, use long long
|
|
||||||
using Int64 = int64_t;
|
|
||||||
using UInt64 = uint64_t;
|
|
||||||
#endif // if defined(_MSC_VER)
|
|
||||||
using LargestInt = Int64;
|
|
||||||
using LargestUInt = UInt64;
|
|
||||||
#define JSON_HAS_INT64
|
|
||||||
#endif // if defined(JSON_NO_INT64)
|
|
||||||
|
|
||||||
template <typename T>
|
|
||||||
using Allocator =
|
|
||||||
typename std::conditional<JSONCPP_USING_SECURE_MEMORY, SecureAllocator<T>,
|
|
||||||
std::allocator<T>>::type;
|
|
||||||
using String = std::basic_string<char, std::char_traits<char>, Allocator<char>>;
|
|
||||||
using IStringStream =
|
|
||||||
std::basic_istringstream<String::value_type, String::traits_type,
|
|
||||||
String::allocator_type>;
|
|
||||||
using OStringStream =
|
|
||||||
std::basic_ostringstream<String::value_type, String::traits_type,
|
|
||||||
String::allocator_type>;
|
|
||||||
using IStream = std::istream;
|
|
||||||
using OStream = std::ostream;
|
|
||||||
} // namespace Json
|
|
||||||
|
|
||||||
// Legacy names (formerly macros).
|
|
||||||
using JSONCPP_STRING = Json::String;
|
|
||||||
using JSONCPP_ISTRINGSTREAM = Json::IStringStream;
|
|
||||||
using JSONCPP_OSTRINGSTREAM = Json::OStringStream;
|
|
||||||
using JSONCPP_ISTREAM = Json::IStream;
|
|
||||||
using JSONCPP_OSTREAM = Json::OStream;
|
|
||||||
|
|
||||||
#endif // JSON_CONFIG_H_INCLUDED
|
|
||||||
|
|
||||||
// //////////////////////////////////////////////////////////////////////
|
|
||||||
// End of content of file: include/json/config.h
|
|
||||||
// //////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// //////////////////////////////////////////////////////////////////////
|
|
||||||
// Beginning of content of file: include/json/forwards.h
|
|
||||||
// //////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
// Copyright 2007-2010 Baptiste Lepilleur and The JsonCpp Authors
|
|
||||||
// Distributed under MIT license, or public domain if desired and
|
|
||||||
// recognized in your jurisdiction.
|
|
||||||
// See file LICENSE for detail or copy at http://jsoncpp.sourceforge.net/LICENSE
|
|
||||||
|
|
||||||
#ifndef JSON_FORWARDS_H_INCLUDED
|
|
||||||
#define JSON_FORWARDS_H_INCLUDED
|
|
||||||
|
|
||||||
#if !defined(JSON_IS_AMALGAMATION)
|
|
||||||
#include "config.h"
|
|
||||||
#endif // if !defined(JSON_IS_AMALGAMATION)
|
|
||||||
|
|
||||||
namespace Json {
|
|
||||||
|
|
||||||
// writer.h
|
|
||||||
class StreamWriter;
|
|
||||||
class StreamWriterBuilder;
|
|
||||||
class Writer;
|
|
||||||
class FastWriter;
|
|
||||||
class StyledWriter;
|
|
||||||
class StyledStreamWriter;
|
|
||||||
|
|
||||||
// reader.h
|
|
||||||
class Reader;
|
|
||||||
class CharReader;
|
|
||||||
class CharReaderBuilder;
|
|
||||||
|
|
||||||
// json_features.h
|
|
||||||
class Features;
|
|
||||||
|
|
||||||
// value.h
|
|
||||||
using ArrayIndex = unsigned int;
|
|
||||||
class StaticString;
|
|
||||||
class Path;
|
|
||||||
class PathArgument;
|
|
||||||
class Value;
|
|
||||||
class ValueIteratorBase;
|
|
||||||
class ValueIterator;
|
|
||||||
class ValueConstIterator;
|
|
||||||
|
|
||||||
} // namespace Json
|
|
||||||
|
|
||||||
#endif // JSON_FORWARDS_H_INCLUDED
|
|
||||||
|
|
||||||
// //////////////////////////////////////////////////////////////////////
|
|
||||||
// End of content of file: include/json/forwards.h
|
|
||||||
// //////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#endif //ifndef JSON_FORWARD_AMALGAMATED_H_INCLUDED
|
|
2354
third_party/jsoncpp/json/json.h
vendored
2354
third_party/jsoncpp/json/json.h
vendored
File diff suppressed because it is too large
Load Diff
5304
third_party/jsoncpp/jsoncpp.cpp
vendored
5304
third_party/jsoncpp/jsoncpp.cpp
vendored
File diff suppressed because it is too large
Load Diff
25447
third_party/nlohmann/json.hpp
vendored
25447
third_party/nlohmann/json.hpp
vendored
File diff suppressed because it is too large
Load Diff
3
third_party/sanitizers-cmake/.gitignore
vendored
3
third_party/sanitizers-cmake/.gitignore
vendored
@ -1,3 +0,0 @@
|
|||||||
# out-of-source build top-level folders.
|
|
||||||
build/
|
|
||||||
_build/
|
|
51
third_party/sanitizers-cmake/CMakeLists.txt
vendored
51
third_party/sanitizers-cmake/CMakeLists.txt
vendored
@ -1,51 +0,0 @@
|
|||||||
# This file is part of CMake-sanitizers.
|
|
||||||
#
|
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
# of this software and associated documentation files (the "Software"), to deal
|
|
||||||
# in the Software without restriction, including without limitation the rights
|
|
||||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
# copies of the Software, and to permit persons to whom the Software is
|
|
||||||
# furnished to do so, subject to the following conditions:
|
|
||||||
#
|
|
||||||
# The above copyright notice and this permission notice shall be included in all
|
|
||||||
# copies or substantial portions of the Software.
|
|
||||||
#
|
|
||||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
# SOFTWARE.
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# Copyright (c)
|
|
||||||
# 2013-2015 Matt Arsenault
|
|
||||||
# 2015 RWTH Aachen University, Federal Republic of Germany
|
|
||||||
#
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# project information
|
|
||||||
#
|
|
||||||
|
|
||||||
# minimum required cmake version
|
|
||||||
cmake_minimum_required(VERSION 2.8)
|
|
||||||
|
|
||||||
# project name
|
|
||||||
project("CMake-sanitizers")
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# cmake configuration
|
|
||||||
#
|
|
||||||
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# add tests
|
|
||||||
#
|
|
||||||
enable_testing()
|
|
||||||
add_subdirectory(tests)
|
|
22
third_party/sanitizers-cmake/LICENSE
vendored
22
third_party/sanitizers-cmake/LICENSE
vendored
@ -1,22 +0,0 @@
|
|||||||
The MIT License (MIT)
|
|
||||||
|
|
||||||
Copyright (c)
|
|
||||||
2013 Matthew Arsenault
|
|
||||||
2015-2016 RWTH Aachen University, Federal Republic of Germany
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
||||||
this software and associated documentation files (the "Software"), to deal in
|
|
||||||
the Software without restriction, including without limitation the rights to
|
|
||||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
||||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
||||||
subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
||||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
||||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
||||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
||||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
73
third_party/sanitizers-cmake/README.md
vendored
73
third_party/sanitizers-cmake/README.md
vendored
@ -1,73 +0,0 @@
|
|||||||
# sanitizers-cmake
|
|
||||||
|
|
||||||
[](https://github.com/arsenm/sanitizers-cmake/issues)
|
|
||||||
[](LICENSE)
|
|
||||||
|
|
||||||
CMake module to enable sanitizers for binary targets.
|
|
||||||
|
|
||||||
|
|
||||||
## Include into your project
|
|
||||||
|
|
||||||
To use [FindSanitizers.cmake](cmake/FindSanitizers.cmake), simply add this repository as git submodule into your own repository
|
|
||||||
```Shell
|
|
||||||
mkdir externals
|
|
||||||
git submodule add git://github.com/arsenm/sanitizers-cmake.git externals/sanitizers-cmake
|
|
||||||
```
|
|
||||||
and adding ```externals/sanitizers-cmake/cmake``` to your ```CMAKE_MODULE_PATH```
|
|
||||||
```CMake
|
|
||||||
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/externals/sanitizers-cmake/cmake" ${CMAKE_MODULE_PATH})
|
|
||||||
```
|
|
||||||
|
|
||||||
If you don't use git or dislike submodules you can copy the files in [cmake directory](cmake) into your repository. *Be careful and keep updates in mind!*
|
|
||||||
|
|
||||||
Now you can simply run ```find_package``` in your CMake files:
|
|
||||||
```CMake
|
|
||||||
find_package(Sanitizers)
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
You can enable the sanitizers with ``SANITIZE_ADDRESS``, ``SANITIZE_MEMORY``, ``SANITIZE_THREAD`` or ``SANITIZE_UNDEFINED`` options in your CMake configuration. You can do this by passing e.g. ``-DSANITIZE_ADDRESS=On`` on your command line or with your graphical interface.
|
|
||||||
|
|
||||||
If sanitizers are supported by your compiler, the specified targets will be build with sanitizer support. If your compiler has no sanitizing capabilities (I asume intel compiler doesn't) you'll get a warning but CMake will continue processing and sanitizing will simply just be ignored.
|
|
||||||
|
|
||||||
#### Compiler issues
|
|
||||||
|
|
||||||
Different compilers may be using different implementations for sanitizers. If you'll try to sanitize targets with C and Fortran code but don't use gcc & gfortran but clang & gfortran, this will cause linking problems. To avoid this, such problems will be detected and sanitizing will be disabled for these targets.
|
|
||||||
|
|
||||||
Even C only targets may cause problems in certain situations. Some problems have been seen with AddressSanitizer for preloading or dynamic linking. In such cases you may try the ``SANITIZE_LINK_STATIC`` to link sanitizers for gcc static.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
## Build targets with sanitizer support
|
|
||||||
|
|
||||||
To enable sanitizer support you simply have to add ``add_sanitizers(<TARGET>)`` after defining your target. To provide a sanitizer blacklist file you can use the ``sanitizer_add_blacklist_file(<FILE>)`` function:
|
|
||||||
```CMake
|
|
||||||
find_package(Sanitizers)
|
|
||||||
|
|
||||||
sanitizer_add_blacklist_file("blacklist.txt")
|
|
||||||
|
|
||||||
add_executable(some_exe foo.c bar.c)
|
|
||||||
add_sanitizers(some_exe)
|
|
||||||
|
|
||||||
add_library(some_lib foo.c bar.c)
|
|
||||||
add_sanitizers(some_lib)
|
|
||||||
```
|
|
||||||
|
|
||||||
## Run your application
|
|
||||||
|
|
||||||
The sanitizers check your program, while it's running. In some situations (e.g. LD_PRELOAD your target) it might be required to preload the used AddressSanitizer library first. In this case you may use the ``asan-wrapper`` script defined in ``ASan_WRAPPER`` variable to execute your application with ``${ASan_WRAPPER} myexe arg1 ...``.
|
|
||||||
|
|
||||||
|
|
||||||
## Contribute
|
|
||||||
|
|
||||||
Anyone is welcome to contribute. Simply fork this repository, make your changes **in an own branch** and create a pull-request for your change. Please do only one change per pull-request.
|
|
||||||
|
|
||||||
You found a bug? Please fill out an [issue](https://github.com/arsenm/sanitizers-cmake/issues) and include any data to reproduce the bug.
|
|
||||||
|
|
||||||
|
|
||||||
#### Contributors
|
|
||||||
|
|
||||||
* [Matt Arsenault](https://github.com/arsenm)
|
|
||||||
* [Alexander Haase](https://github.com/alehaa)
|
|
@ -1,59 +0,0 @@
|
|||||||
# The MIT License (MIT)
|
|
||||||
#
|
|
||||||
# Copyright (c)
|
|
||||||
# 2013 Matthew Arsenault
|
|
||||||
# 2015-2016 RWTH Aachen University, Federal Republic of Germany
|
|
||||||
#
|
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
# of this software and associated documentation files (the "Software"), to deal
|
|
||||||
# in the Software without restriction, including without limitation the rights
|
|
||||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
# copies of the Software, and to permit persons to whom the Software is
|
|
||||||
# furnished to do so, subject to the following conditions:
|
|
||||||
#
|
|
||||||
# The above copyright notice and this permission notice shall be included in all
|
|
||||||
# copies or substantial portions of the Software.
|
|
||||||
#
|
|
||||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
# SOFTWARE.
|
|
||||||
|
|
||||||
option(SANITIZE_ADDRESS "Enable AddressSanitizer for sanitized targets." Off)
|
|
||||||
|
|
||||||
set(FLAG_CANDIDATES
|
|
||||||
# Clang 3.2+ use this version. The no-omit-frame-pointer option is optional.
|
|
||||||
"-g -fsanitize=address -fno-omit-frame-pointer"
|
|
||||||
"-g -fsanitize=address"
|
|
||||||
|
|
||||||
# Older deprecated flag for ASan
|
|
||||||
"-g -faddress-sanitizer"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
if (SANITIZE_ADDRESS AND (SANITIZE_THREAD OR SANITIZE_MEMORY))
|
|
||||||
message(FATAL_ERROR "AddressSanitizer is not compatible with "
|
|
||||||
"ThreadSanitizer or MemorySanitizer.")
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
|
|
||||||
include(sanitize-helpers)
|
|
||||||
|
|
||||||
if (SANITIZE_ADDRESS)
|
|
||||||
sanitizer_check_compiler_flags("${FLAG_CANDIDATES}" "AddressSanitizer"
|
|
||||||
"ASan")
|
|
||||||
|
|
||||||
find_program(ASan_WRAPPER "asan-wrapper" PATHS ${CMAKE_MODULE_PATH})
|
|
||||||
mark_as_advanced(ASan_WRAPPER)
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
function (add_sanitize_address TARGET)
|
|
||||||
if (NOT SANITIZE_ADDRESS)
|
|
||||||
return()
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
sanitizer_add_flags(${TARGET} "AddressSanitizer" "ASan")
|
|
||||||
endfunction ()
|
|
@ -1,57 +0,0 @@
|
|||||||
# The MIT License (MIT)
|
|
||||||
#
|
|
||||||
# Copyright (c)
|
|
||||||
# 2013 Matthew Arsenault
|
|
||||||
# 2015-2016 RWTH Aachen University, Federal Republic of Germany
|
|
||||||
#
|
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
# of this software and associated documentation files (the "Software"), to deal
|
|
||||||
# in the Software without restriction, including without limitation the rights
|
|
||||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
# copies of the Software, and to permit persons to whom the Software is
|
|
||||||
# furnished to do so, subject to the following conditions:
|
|
||||||
#
|
|
||||||
# The above copyright notice and this permission notice shall be included in all
|
|
||||||
# copies or substantial portions of the Software.
|
|
||||||
#
|
|
||||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
# SOFTWARE.
|
|
||||||
|
|
||||||
option(SANITIZE_MEMORY "Enable MemorySanitizer for sanitized targets." Off)
|
|
||||||
|
|
||||||
set(FLAG_CANDIDATES
|
|
||||||
"-g -fsanitize=memory"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
include(sanitize-helpers)
|
|
||||||
|
|
||||||
if (SANITIZE_MEMORY)
|
|
||||||
if (NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
|
||||||
message(WARNING "MemorySanitizer disabled for target ${TARGET} because "
|
|
||||||
"MemorySanitizer is supported for Linux systems only.")
|
|
||||||
set(SANITIZE_MEMORY Off CACHE BOOL
|
|
||||||
"Enable MemorySanitizer for sanitized targets." FORCE)
|
|
||||||
elseif (NOT ${CMAKE_SIZEOF_VOID_P} EQUAL 8)
|
|
||||||
message(WARNING "MemorySanitizer disabled for target ${TARGET} because "
|
|
||||||
"MemorySanitizer is supported for 64bit systems only.")
|
|
||||||
set(SANITIZE_MEMORY Off CACHE BOOL
|
|
||||||
"Enable MemorySanitizer for sanitized targets." FORCE)
|
|
||||||
else ()
|
|
||||||
sanitizer_check_compiler_flags("${FLAG_CANDIDATES}" "MemorySanitizer"
|
|
||||||
"MSan")
|
|
||||||
endif ()
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
function (add_sanitize_memory TARGET)
|
|
||||||
if (NOT SANITIZE_MEMORY)
|
|
||||||
return()
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
sanitizer_add_flags(${TARGET} "MemorySanitizer" "MSan")
|
|
||||||
endfunction ()
|
|
@ -1,87 +0,0 @@
|
|||||||
# The MIT License (MIT)
|
|
||||||
#
|
|
||||||
# Copyright (c)
|
|
||||||
# 2013 Matthew Arsenault
|
|
||||||
# 2015-2016 RWTH Aachen University, Federal Republic of Germany
|
|
||||||
#
|
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
# of this software and associated documentation files (the "Software"), to deal
|
|
||||||
# in the Software without restriction, including without limitation the rights
|
|
||||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
# copies of the Software, and to permit persons to whom the Software is
|
|
||||||
# furnished to do so, subject to the following conditions:
|
|
||||||
#
|
|
||||||
# The above copyright notice and this permission notice shall be included in all
|
|
||||||
# copies or substantial portions of the Software.
|
|
||||||
#
|
|
||||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
# SOFTWARE.
|
|
||||||
|
|
||||||
# If any of the used compiler is a GNU compiler, add a second option to static
|
|
||||||
# link against the sanitizers.
|
|
||||||
option(SANITIZE_LINK_STATIC "Try to link static against sanitizers." Off)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
set(FIND_QUIETLY_FLAG "")
|
|
||||||
if (DEFINED Sanitizers_FIND_QUIETLY)
|
|
||||||
set(FIND_QUIETLY_FLAG "QUIET")
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
find_package(ASan ${FIND_QUIETLY_FLAG})
|
|
||||||
find_package(TSan ${FIND_QUIETLY_FLAG})
|
|
||||||
find_package(MSan ${FIND_QUIETLY_FLAG})
|
|
||||||
find_package(UBSan ${FIND_QUIETLY_FLAG})
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function(sanitizer_add_blacklist_file FILE)
|
|
||||||
if(NOT IS_ABSOLUTE ${FILE})
|
|
||||||
set(FILE "${CMAKE_CURRENT_SOURCE_DIR}/${FILE}")
|
|
||||||
endif()
|
|
||||||
get_filename_component(FILE "${FILE}" REALPATH)
|
|
||||||
|
|
||||||
sanitizer_check_compiler_flags("-fsanitize-blacklist=${FILE}"
|
|
||||||
"SanitizerBlacklist" "SanBlist")
|
|
||||||
endfunction()
|
|
||||||
|
|
||||||
function(add_sanitizers ...)
|
|
||||||
# If no sanitizer is enabled, return immediately.
|
|
||||||
if (NOT (SANITIZE_ADDRESS OR SANITIZE_MEMORY OR SANITIZE_THREAD OR
|
|
||||||
SANITIZE_UNDEFINED))
|
|
||||||
return()
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
foreach (TARGET ${ARGV})
|
|
||||||
# Check if this target will be compiled by exactly one compiler. Other-
|
|
||||||
# wise sanitizers can't be used and a warning should be printed once.
|
|
||||||
sanitizer_target_compilers(${TARGET} TARGET_COMPILER)
|
|
||||||
list(LENGTH TARGET_COMPILER NUM_COMPILERS)
|
|
||||||
if (NUM_COMPILERS GREATER 1)
|
|
||||||
message(WARNING "Can't use any sanitizers for target ${TARGET}, "
|
|
||||||
"because it will be compiled by incompatible compilers. "
|
|
||||||
"Target will be compiled without sanitizers.")
|
|
||||||
return()
|
|
||||||
|
|
||||||
# If the target is compiled by no known compiler, ignore it.
|
|
||||||
elseif (NUM_COMPILERS EQUAL 0)
|
|
||||||
message(WARNING "Can't use any sanitizers for target ${TARGET}, "
|
|
||||||
"because it uses an unknown compiler. Target will be "
|
|
||||||
"compiled without sanitizers.")
|
|
||||||
return()
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
# Add sanitizers for target.
|
|
||||||
add_sanitize_address(${TARGET})
|
|
||||||
add_sanitize_thread(${TARGET})
|
|
||||||
add_sanitize_memory(${TARGET})
|
|
||||||
add_sanitize_undefined(${TARGET})
|
|
||||||
endforeach ()
|
|
||||||
endfunction(add_sanitizers)
|
|
@ -1,65 +0,0 @@
|
|||||||
# The MIT License (MIT)
|
|
||||||
#
|
|
||||||
# Copyright (c)
|
|
||||||
# 2013 Matthew Arsenault
|
|
||||||
# 2015-2016 RWTH Aachen University, Federal Republic of Germany
|
|
||||||
#
|
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
# of this software and associated documentation files (the "Software"), to deal
|
|
||||||
# in the Software without restriction, including without limitation the rights
|
|
||||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
# copies of the Software, and to permit persons to whom the Software is
|
|
||||||
# furnished to do so, subject to the following conditions:
|
|
||||||
#
|
|
||||||
# The above copyright notice and this permission notice shall be included in all
|
|
||||||
# copies or substantial portions of the Software.
|
|
||||||
#
|
|
||||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
# SOFTWARE.
|
|
||||||
|
|
||||||
option(SANITIZE_THREAD "Enable ThreadSanitizer for sanitized targets." Off)
|
|
||||||
|
|
||||||
set(FLAG_CANDIDATES
|
|
||||||
"-g -fsanitize=thread"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
# ThreadSanitizer is not compatible with MemorySanitizer.
|
|
||||||
if (SANITIZE_THREAD AND SANITIZE_MEMORY)
|
|
||||||
message(FATAL_ERROR "ThreadSanitizer is not compatible with "
|
|
||||||
"MemorySanitizer.")
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
|
|
||||||
include(sanitize-helpers)
|
|
||||||
|
|
||||||
if (SANITIZE_THREAD)
|
|
||||||
if (NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND
|
|
||||||
NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
|
|
||||||
message(WARNING "ThreadSanitizer disabled for target ${TARGET} because "
|
|
||||||
"ThreadSanitizer is supported for Linux systems and macOS only.")
|
|
||||||
set(SANITIZE_THREAD Off CACHE BOOL
|
|
||||||
"Enable ThreadSanitizer for sanitized targets." FORCE)
|
|
||||||
elseif (NOT ${CMAKE_SIZEOF_VOID_P} EQUAL 8)
|
|
||||||
message(WARNING "ThreadSanitizer disabled for target ${TARGET} because "
|
|
||||||
"ThreadSanitizer is supported for 64bit systems only.")
|
|
||||||
set(SANITIZE_THREAD Off CACHE BOOL
|
|
||||||
"Enable ThreadSanitizer for sanitized targets." FORCE)
|
|
||||||
else ()
|
|
||||||
sanitizer_check_compiler_flags("${FLAG_CANDIDATES}" "ThreadSanitizer"
|
|
||||||
"TSan")
|
|
||||||
endif ()
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
function (add_sanitize_thread TARGET)
|
|
||||||
if (NOT SANITIZE_THREAD)
|
|
||||||
return()
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
sanitizer_add_flags(${TARGET} "ThreadSanitizer" "TSan")
|
|
||||||
endfunction ()
|
|
@ -1,46 +0,0 @@
|
|||||||
# The MIT License (MIT)
|
|
||||||
#
|
|
||||||
# Copyright (c)
|
|
||||||
# 2013 Matthew Arsenault
|
|
||||||
# 2015-2016 RWTH Aachen University, Federal Republic of Germany
|
|
||||||
#
|
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
# of this software and associated documentation files (the "Software"), to deal
|
|
||||||
# in the Software without restriction, including without limitation the rights
|
|
||||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
# copies of the Software, and to permit persons to whom the Software is
|
|
||||||
# furnished to do so, subject to the following conditions:
|
|
||||||
#
|
|
||||||
# The above copyright notice and this permission notice shall be included in all
|
|
||||||
# copies or substantial portions of the Software.
|
|
||||||
#
|
|
||||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
# SOFTWARE.
|
|
||||||
|
|
||||||
option(SANITIZE_UNDEFINED
|
|
||||||
"Enable UndefinedBehaviorSanitizer for sanitized targets." Off)
|
|
||||||
|
|
||||||
set(FLAG_CANDIDATES
|
|
||||||
"-g -fsanitize=undefined"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
include(sanitize-helpers)
|
|
||||||
|
|
||||||
if (SANITIZE_UNDEFINED)
|
|
||||||
sanitizer_check_compiler_flags("${FLAG_CANDIDATES}"
|
|
||||||
"UndefinedBehaviorSanitizer" "UBSan")
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
function (add_sanitize_undefined TARGET)
|
|
||||||
if (NOT SANITIZE_UNDEFINED)
|
|
||||||
return()
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
sanitizer_add_flags(${TARGET} "UndefinedBehaviorSanitizer" "UBSan")
|
|
||||||
endfunction ()
|
|
55
third_party/sanitizers-cmake/cmake/asan-wrapper
vendored
55
third_party/sanitizers-cmake/cmake/asan-wrapper
vendored
@ -1,55 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# The MIT License (MIT)
|
|
||||||
#
|
|
||||||
# Copyright (c)
|
|
||||||
# 2013 Matthew Arsenault
|
|
||||||
# 2015-2016 RWTH Aachen University, Federal Republic of Germany
|
|
||||||
#
|
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
# of this software and associated documentation files (the "Software"), to deal
|
|
||||||
# in the Software without restriction, including without limitation the rights
|
|
||||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
# copies of the Software, and to permit persons to whom the Software is
|
|
||||||
# furnished to do so, subject to the following conditions:
|
|
||||||
#
|
|
||||||
# The above copyright notice and this permission notice shall be included in all
|
|
||||||
# copies or substantial portions of the Software.
|
|
||||||
#
|
|
||||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
# SOFTWARE.
|
|
||||||
|
|
||||||
# This script is a wrapper for AddressSanitizer. In some special cases you need
|
|
||||||
# to preload AddressSanitizer to avoid error messages - e.g. if you're
|
|
||||||
# preloading another library to your application. At the moment this script will
|
|
||||||
# only do something, if we're running on a Linux platform. OSX might not be
|
|
||||||
# affected.
|
|
||||||
|
|
||||||
|
|
||||||
# Exit immediately, if platform is not Linux.
|
|
||||||
if [ "$(uname)" != "Linux" ]
|
|
||||||
then
|
|
||||||
exec $@
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
# Get the used libasan of the application ($1). If a libasan was found, it will
|
|
||||||
# be prepended to LD_PRELOAD.
|
|
||||||
libasan=$(ldd $1 | grep libasan | sed "s/^[[:space:]]//" | cut -d' ' -f1)
|
|
||||||
if [ -n "$libasan" ]
|
|
||||||
then
|
|
||||||
if [ -n "$LD_PRELOAD" ]
|
|
||||||
then
|
|
||||||
export LD_PRELOAD="$libasan:$LD_PRELOAD"
|
|
||||||
else
|
|
||||||
export LD_PRELOAD="$libasan"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Execute the application.
|
|
||||||
exec $@
|
|
@ -1,170 +0,0 @@
|
|||||||
# The MIT License (MIT)
|
|
||||||
#
|
|
||||||
# Copyright (c)
|
|
||||||
# 2013 Matthew Arsenault
|
|
||||||
# 2015-2016 RWTH Aachen University, Federal Republic of Germany
|
|
||||||
#
|
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
# of this software and associated documentation files (the "Software"), to deal
|
|
||||||
# in the Software without restriction, including without limitation the rights
|
|
||||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
# copies of the Software, and to permit persons to whom the Software is
|
|
||||||
# furnished to do so, subject to the following conditions:
|
|
||||||
#
|
|
||||||
# The above copyright notice and this permission notice shall be included in all
|
|
||||||
# copies or substantial portions of the Software.
|
|
||||||
#
|
|
||||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
# SOFTWARE.
|
|
||||||
|
|
||||||
# Helper function to get the language of a source file.
|
|
||||||
function (sanitizer_lang_of_source FILE RETURN_VAR)
|
|
||||||
get_filename_component(FILE_EXT "${FILE}" EXT)
|
|
||||||
string(TOLOWER "${FILE_EXT}" FILE_EXT)
|
|
||||||
string(SUBSTRING "${FILE_EXT}" 1 -1 FILE_EXT)
|
|
||||||
|
|
||||||
get_property(ENABLED_LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES)
|
|
||||||
foreach (LANG ${ENABLED_LANGUAGES})
|
|
||||||
list(FIND CMAKE_${LANG}_SOURCE_FILE_EXTENSIONS "${FILE_EXT}" TEMP)
|
|
||||||
if (NOT ${TEMP} EQUAL -1)
|
|
||||||
set(${RETURN_VAR} "${LANG}" PARENT_SCOPE)
|
|
||||||
return()
|
|
||||||
endif ()
|
|
||||||
endforeach()
|
|
||||||
|
|
||||||
set(${RETURN_VAR} "" PARENT_SCOPE)
|
|
||||||
endfunction ()
|
|
||||||
|
|
||||||
|
|
||||||
# Helper function to get compilers used by a target.
|
|
||||||
function (sanitizer_target_compilers TARGET RETURN_VAR)
|
|
||||||
# Check if all sources for target use the same compiler. If a target uses
|
|
||||||
# e.g. C and Fortran mixed and uses different compilers (e.g. clang and
|
|
||||||
# gfortran) this can trigger huge problems, because different compilers may
|
|
||||||
# use different implementations for sanitizers.
|
|
||||||
set(BUFFER "")
|
|
||||||
get_target_property(TSOURCES ${TARGET} SOURCES)
|
|
||||||
foreach (FILE ${TSOURCES})
|
|
||||||
# If expression was found, FILE is a generator-expression for an object
|
|
||||||
# library. Object libraries will be ignored.
|
|
||||||
string(REGEX MATCH "TARGET_OBJECTS:([^ >]+)" _file ${FILE})
|
|
||||||
if ("${_file}" STREQUAL "")
|
|
||||||
sanitizer_lang_of_source(${FILE} LANG)
|
|
||||||
if (LANG)
|
|
||||||
list(APPEND BUFFER ${CMAKE_${LANG}_COMPILER_ID})
|
|
||||||
endif ()
|
|
||||||
endif ()
|
|
||||||
endforeach ()
|
|
||||||
|
|
||||||
list(REMOVE_DUPLICATES BUFFER)
|
|
||||||
set(${RETURN_VAR} "${BUFFER}" PARENT_SCOPE)
|
|
||||||
endfunction ()
|
|
||||||
|
|
||||||
|
|
||||||
# Helper function to check compiler flags for language compiler.
|
|
||||||
function (sanitizer_check_compiler_flag FLAG LANG VARIABLE)
|
|
||||||
if (${LANG} STREQUAL "C")
|
|
||||||
include(CheckCCompilerFlag)
|
|
||||||
check_c_compiler_flag("${FLAG}" ${VARIABLE})
|
|
||||||
|
|
||||||
elseif (${LANG} STREQUAL "CXX")
|
|
||||||
include(CheckCXXCompilerFlag)
|
|
||||||
check_cxx_compiler_flag("${FLAG}" ${VARIABLE})
|
|
||||||
|
|
||||||
elseif (${LANG} STREQUAL "Fortran")
|
|
||||||
# CheckFortranCompilerFlag was introduced in CMake 3.x. To be compatible
|
|
||||||
# with older Cmake versions, we will check if this module is present
|
|
||||||
# before we use it. Otherwise we will define Fortran coverage support as
|
|
||||||
# not available.
|
|
||||||
include(CheckFortranCompilerFlag OPTIONAL RESULT_VARIABLE INCLUDED)
|
|
||||||
if (INCLUDED)
|
|
||||||
check_fortran_compiler_flag("${FLAG}" ${VARIABLE})
|
|
||||||
elseif (NOT CMAKE_REQUIRED_QUIET)
|
|
||||||
message(STATUS "Performing Test ${VARIABLE}")
|
|
||||||
message(STATUS "Performing Test ${VARIABLE}"
|
|
||||||
" - Failed (Check not supported)")
|
|
||||||
endif ()
|
|
||||||
endif()
|
|
||||||
endfunction ()
|
|
||||||
|
|
||||||
|
|
||||||
# Helper function to test compiler flags.
|
|
||||||
function (sanitizer_check_compiler_flags FLAG_CANDIDATES NAME PREFIX)
|
|
||||||
set(CMAKE_REQUIRED_QUIET ${${PREFIX}_FIND_QUIETLY})
|
|
||||||
|
|
||||||
get_property(ENABLED_LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES)
|
|
||||||
foreach (LANG ${ENABLED_LANGUAGES})
|
|
||||||
# Sanitizer flags are not dependend on language, but the used compiler.
|
|
||||||
# So instead of searching flags foreach language, search flags foreach
|
|
||||||
# compiler used.
|
|
||||||
set(COMPILER ${CMAKE_${LANG}_COMPILER_ID})
|
|
||||||
if (NOT DEFINED ${PREFIX}_${COMPILER}_FLAGS)
|
|
||||||
foreach (FLAG ${FLAG_CANDIDATES})
|
|
||||||
if(NOT CMAKE_REQUIRED_QUIET)
|
|
||||||
message(STATUS "Try ${COMPILER} ${NAME} flag = [${FLAG}]")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(CMAKE_REQUIRED_FLAGS "${FLAG}")
|
|
||||||
unset(${PREFIX}_FLAG_DETECTED CACHE)
|
|
||||||
sanitizer_check_compiler_flag("${FLAG}" ${LANG}
|
|
||||||
${PREFIX}_FLAG_DETECTED)
|
|
||||||
|
|
||||||
if (${PREFIX}_FLAG_DETECTED)
|
|
||||||
# If compiler is a GNU compiler, search for static flag, if
|
|
||||||
# SANITIZE_LINK_STATIC is enabled.
|
|
||||||
if (SANITIZE_LINK_STATIC AND (${COMPILER} STREQUAL "GNU"))
|
|
||||||
string(TOLOWER ${PREFIX} PREFIX_lower)
|
|
||||||
sanitizer_check_compiler_flag(
|
|
||||||
"-static-lib${PREFIX_lower}" ${LANG}
|
|
||||||
${PREFIX}_STATIC_FLAG_DETECTED)
|
|
||||||
|
|
||||||
if (${PREFIX}_STATIC_FLAG_DETECTED)
|
|
||||||
set(FLAG "-static-lib${PREFIX_lower} ${FLAG}")
|
|
||||||
endif ()
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
set(${PREFIX}_${COMPILER}_FLAGS "${FLAG}" CACHE STRING
|
|
||||||
"${NAME} flags for ${COMPILER} compiler.")
|
|
||||||
mark_as_advanced(${PREFIX}_${COMPILER}_FLAGS)
|
|
||||||
break()
|
|
||||||
endif ()
|
|
||||||
endforeach ()
|
|
||||||
|
|
||||||
if (NOT ${PREFIX}_FLAG_DETECTED)
|
|
||||||
set(${PREFIX}_${COMPILER}_FLAGS "" CACHE STRING
|
|
||||||
"${NAME} flags for ${COMPILER} compiler.")
|
|
||||||
mark_as_advanced(${PREFIX}_${COMPILER}_FLAGS)
|
|
||||||
|
|
||||||
message(WARNING "${NAME} is not available for ${COMPILER} "
|
|
||||||
"compiler. Targets using this compiler will be "
|
|
||||||
"compiled without ${NAME}.")
|
|
||||||
endif ()
|
|
||||||
endif ()
|
|
||||||
endforeach ()
|
|
||||||
endfunction ()
|
|
||||||
|
|
||||||
|
|
||||||
# Helper to assign sanitizer flags for TARGET.
|
|
||||||
function (sanitizer_add_flags TARGET NAME PREFIX)
|
|
||||||
# Get list of compilers used by target and check, if sanitizer is available
|
|
||||||
# for this target. Other compiler checks like check for conflicting
|
|
||||||
# compilers will be done in add_sanitizers function.
|
|
||||||
sanitizer_target_compilers(${TARGET} TARGET_COMPILER)
|
|
||||||
list(LENGTH TARGET_COMPILER NUM_COMPILERS)
|
|
||||||
if ("${${PREFIX}_${TARGET_COMPILER}_FLAGS}" STREQUAL "")
|
|
||||||
return()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Set compile- and link-flags for target.
|
|
||||||
set_property(TARGET ${TARGET} APPEND_STRING
|
|
||||||
PROPERTY COMPILE_FLAGS " ${${PREFIX}_${TARGET_COMPILER}_FLAGS}")
|
|
||||||
set_property(TARGET ${TARGET} APPEND_STRING
|
|
||||||
PROPERTY COMPILE_FLAGS " ${SanBlist_${TARGET_COMPILER}_FLAGS}")
|
|
||||||
set_property(TARGET ${TARGET} APPEND_STRING
|
|
||||||
PROPERTY LINK_FLAGS " ${${PREFIX}_${TARGET_COMPILER}_FLAGS}")
|
|
||||||
endfunction ()
|
|
@ -1,52 +0,0 @@
|
|||||||
# This file is part of CMake-sanitizers.
|
|
||||||
#
|
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
# of this software and associated documentation files (the "Software"), to deal
|
|
||||||
# in the Software without restriction, including without limitation the rights
|
|
||||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
# copies of the Software, and to permit persons to whom the Software is
|
|
||||||
# furnished to do so, subject to the following conditions:
|
|
||||||
#
|
|
||||||
# The above copyright notice and this permission notice shall be included in all
|
|
||||||
# copies or substantial portions of the Software.
|
|
||||||
#
|
|
||||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
# SOFTWARE.
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# Copyright (c)
|
|
||||||
# 2013-2015 Matt Arsenault
|
|
||||||
# 2015 RWTH Aachen University, Federal Republic of Germany
|
|
||||||
#
|
|
||||||
|
|
||||||
# Function to add testcases.
|
|
||||||
function(add_testcase TESTNAME SOURCEFILES)
|
|
||||||
# remove ${TESTNAME} from ${ARGV} to use ${ARGV} as ${SOURCEFILES}
|
|
||||||
list(REMOVE_AT ARGV 0)
|
|
||||||
|
|
||||||
# add a new executable
|
|
||||||
add_executable(${TESTNAME} ${ARGV})
|
|
||||||
add_sanitizers(${TESTNAME})
|
|
||||||
|
|
||||||
# add a testcase for executable
|
|
||||||
add_test(${TESTNAME} ${TESTNAME})
|
|
||||||
endfunction(add_testcase)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# search for sanitizers
|
|
||||||
#
|
|
||||||
find_package(Sanitizers)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#
|
|
||||||
# add testcases
|
|
||||||
#
|
|
||||||
add_testcase("asan_test_cpp" asan_test.cpp)
|
|
39
third_party/sanitizers-cmake/tests/asan_test.cpp
vendored
39
third_party/sanitizers-cmake/tests/asan_test.cpp
vendored
@ -1,39 +0,0 @@
|
|||||||
/* This file is part of CMake-sanitizers.
|
|
||||||
*
|
|
||||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
* of this software and associated documentation files (the "Software"), to deal
|
|
||||||
* in the Software without restriction, including without limitation the rights
|
|
||||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
* copies of the Software, and to permit persons to whom the Software is
|
|
||||||
* furnished to do so, subject to the following conditions:
|
|
||||||
*
|
|
||||||
* The above copyright notice and this permission notice shall be included in
|
|
||||||
* all copies or substantial portions of the Software.
|
|
||||||
*
|
|
||||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
* SOFTWARE.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* Copyright (c)
|
|
||||||
* 2013-2015 Matt Arsenault
|
|
||||||
* 2015 RWTH Aachen University, Federal Republic of Germany
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
int
|
|
||||||
main(int argc, char **argv)
|
|
||||||
{
|
|
||||||
// Allocate a new array and delete it.
|
|
||||||
int *array = new int[argc];
|
|
||||||
delete[] array;
|
|
||||||
|
|
||||||
/* Access element of the deleted array. This will cause an memory error with
|
|
||||||
* address sanitizer.
|
|
||||||
*/
|
|
||||||
return array[argc];
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user