File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -23,6 +23,10 @@ if (USE_Z3)
2323 add_definitions (-DUSE_Z3 )
2424endif ()
2525
26+ if (Boost_FOUND)
27+ add_definitions (-DHAVE_BOOST )
28+ endif ()
29+
2630if (ENABLE_CHECK_INTERNAL)
2731 add_definitions (-DCHECK_INTERNAL )
2832endif ()
Original file line number Diff line number Diff line change @@ -60,3 +60,7 @@ endif()
6060if (USE_THREADS)
6161 find_package (Threads REQUIRED )
6262endif ()
63+
64+ if (USE_BOOST)
65+ find_package (Boost COMPONENTS container QUIET )
66+ endif ()
Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ option(USE_Z3 "Usage of z3 library"
4444option (USE_BUNDLED_TINYXML2 "Usage of bundled tinyxml2 library" ON )
4545option (CPPCHK_GLIBCXX_DEBUG "Usage of _GLIBCXX_DEBUG in Debug build" ON )
4646option (USE_THREADS "Usage of threads instead of fork() for -j" OFF )
47+ option (USE_BOOST "Usage of Boost" OFF )
4748
4849if (CMAKE_VERSION VERSION_EQUAL "3.16" OR CMAKE_VERSION VERSION_GREATER "3.16" )
4950 set (CMAKE_DISABLE_PRECOMPILE_HEADERS Off CACHE BOOL "Disable precompiled headers" )
Original file line number Diff line number Diff line change @@ -69,6 +69,13 @@ if (NOT USE_BUNDLED_TINYXML2)
6969 message (STATUS "tinyxml2_LIBRARY = ${tinyxml2_LIBRARY} " )
7070endif ()
7171message ( STATUS )
72+ message ( STATUS "USE_BOOST = ${USE_BOOST} " )
73+ if (USE_BOOST)
74+ message ( STATUS "Boost_FOUND = ${Boost_FOUND} " )
75+ message ( STATUS "Boost_VERSION_STRING = ${Boost_VERSION_STRING} " )
76+ message ( STATUS "Boost_INCLUDE_DIRS = ${Boost_INCLUDE_DIRS} " )
77+ endif ()
78+ message ( STATUS )
7279
7380if (${ANALYZE_ADDRESS} )
7481 message ("##########################################################" )
Original file line number Diff line number Diff line change @@ -45,6 +45,9 @@ endif()
4545if (USE_Z3)
4646 target_include_directories (lib_objs SYSTEM PRIVATE ${Z3_CXX_INCLUDE_DIRS} )
4747endif ()
48+ if (Boost_FOUND)
49+ target_include_directories (lib_objs SYSTEM PRIVATE ${Boost_INCLUDE_DIRS} )
50+ endif ()
4851
4952if (NOT CMAKE_DISABLE_PRECOMPILE_HEADERS)
5053 target_precompile_headers (lib_objs PRIVATE precompiled.h )
Original file line number Diff line number Diff line change 1+ /*
2+ * Cppcheck - A tool for static C/C++ code analysis
3+ * Copyright (C) 2007-2022 Cppcheck team.
4+ *
5+ * This program is free software: you can redistribute it and/or modify
6+ * it under the terms of the GNU General Public License as published by
7+ * the Free Software Foundation, either version 3 of the License, or
8+ * (at your option) any later version.
9+ *
10+ * This program is distributed in the hope that it will be useful,
11+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
12+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+ * GNU General Public License for more details.
14+ *
15+ * You should have received a copy of the GNU General Public License
16+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
17+ */
18+
19+ #ifndef smallvectorH
20+ #define smallvectorH
21+
22+ #include < cstddef>
23+
24+ static constexpr std::size_t DefaultSmallVectorSize = 0 ;
25+
26+ #ifdef HAVE_BOOST
27+ #include < boost/container/small_vector.hpp>
28+
29+ template <typename T, std::size_t N = DefaultSmallVectorSize>
30+ using SmallVector = boost::container::small_vector<T, N>;
31+ #else
32+ #include < vector>
33+
34+ template <typename T, std::size_t N = DefaultSmallVectorSize>
35+ using SmallVector = std::vector<T>;
36+ #endif
37+
38+ #endif
You can’t perform that action at this time.
0 commit comments