Lines Matching +full:clang +full:- +full:msan
3 # Report AppleClang separately from Clang. Their version numbers are different.
23 # This is a dummy target which all other targets depend on (manually - see other
29 # Android-NDK CMake files reconfigure the path and so Go and Perl won't be
45 pkg_check_modules(LIBUNWIND libunwind-generic)
47 add_definitions(-DBORINGSSL_HAVE_LIBUNWIND)
65 add_definitions(-DBORINGSSL_ALLOW_CXX_RUNTIME)
70 set(CMAKE_ASM_NASM_FLAGS "${CMAKE_ASM_NASM_FLAGS} -DNDEBUG")
76 string(REGEX REPLACE "(^| )[/-]DNDEBUG( |$)" " " "${VAR}_RELWITHASSERTS"
81 add_definitions(-DBORINGSSL_PREFIX=${BORINGSSL_PREFIX})
82 # CMake automatically connects include_directories to the NASM command-line,
84 set(CMAKE_ASM_NASM_FLAGS "${CMAKE_ASM_NASM_FLAGS} -DBORINGSSL_PREFIX=${BORINGSSL_PREFIX}")
92 COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR}/symbol_prefix_include
93 …COMMAND ${GO_EXECUTABLE} run ${CMAKE_CURRENT_SOURCE_DIR}/util/make_prefix_headers.go -out ${CMAKE_…
109 if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
110 set(CLANG 1) variable
113 if(CMAKE_COMPILER_IS_GNUCXX OR CLANG)
114 # Note clang-cl is odd and sets both CLANG and MSVC. We base our configuration
115 # primarily on our normal Clang one.
116 set(C_CXX_FLAGS "-Werror -Wformat=2 -Wsign-compare -Wmissing-field-initializers -Wwrite-strings")
118 # clang-cl sets different default warnings than clang. It also treats -Wall
119 # as -Weverything, to match MSVC. Instead -W3 is the alias for -Wall.
120 # See http://llvm.org/viewvc/llvm-project?view=revision&revision=319116
121 set(C_CXX_FLAGS "${C_CXX_FLAGS} -W3 -Wno-unused-parameter -fmsc-version=1900")
122 # googletest suppresses warning C4996 via a pragma, but clang-cl does not
124 set(C_CXX_FLAGS "${C_CXX_FLAGS} -Wno-deprecated-declarations")
126 set(C_CXX_FLAGS "${C_CXX_FLAGS} -Wall -ggdb -fvisibility=hidden -fno-common")
129 if(CLANG)
130 set(C_CXX_FLAGS "${C_CXX_FLAGS} -Wnewline-eof -fcolor-diagnostics")
134 set(C_CXX_FLAGS "${C_CXX_FLAGS} -Wno-free-nonheap-object")
137 if(CLANG OR NOT "7.0.0" VERSION_GREATER CMAKE_C_COMPILER_VERSION)
138 set(C_CXX_FLAGS "${C_CXX_FLAGS} -Wimplicit-fallthrough")
141 …et(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${C_CXX_FLAGS} -Wmissing-prototypes -Wold-style-definition -Wst…
142 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${C_CXX_FLAGS} -Wmissing-declarations")
145 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
147 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
150 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions -fno-rtti")
154 # In GCC, -Wmissing-declarations is the C++ spelling of -Wmissing-prototypes
155 # and using the wrong one is an error. In Clang, -Wmissing-prototypes is the
156 # spelling for both and -Wmissing-declarations is some other warning.
158 # https://gcc.gnu.org/onlinedocs/gcc-7.1.0/gcc/Warning-Options.html#Warning-Options
159 # https://clang.llvm.org/docs/DiagnosticsReference.html#wmissing-prototypes
160 # https://clang.llvm.org/docs/DiagnosticsReference.html#wmissing-declarations
161 if(CLANG)
162 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wmissing-prototypes")
166 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-array-bounds")
176 "C4200" # nonstandard extension used : zero-sized array in
178 "C4204" # nonstandard extension used: non-constant aggregate initializer
199 # side-effect" caused by FD_* macros.
200 "C4610" # struct 'argument' can never be instantiated - user defined
222 …nect.microsoft.com/VisualStudio/feedback/details/1217660/warning-c4265-when-using-functional-header
225 string(REPLACE "C" " -wd" MSVC_DISABLED_WARNINGS_STR
227 string(REPLACE "C" " -w4" MSVC_LEVEL4_WARNINGS_STR
229 set(CMAKE_C_FLAGS "-utf-8 -Wall -WX ${MSVC_DISABLED_WARNINGS_STR} ${MSVC_LEVEL4_WARNINGS_STR}")
230 set(CMAKE_CXX_FLAGS "-utf-8 -Wall -WX ${MSVC_DISABLED_WARNINGS_STR} ${MSVC_LEVEL4_WARNINGS_STR}")
234 add_definitions(-D_HAS_EXCEPTIONS=0)
235 add_definitions(-DWIN32_LEAN_AND_MEAN)
236 add_definitions(-DNOMINMAX)
238 add_definitions(-D_CRT_SECURE_NO_WARNINGS)
239 # VS 2017 and higher supports STL-only warning suppressions. Manually add to
243 add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-D_STL_EXTRA_DISABLED_WARNINGS=4774\ 4987>)
247 CLANG)
248 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wshadow")
249 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wshadow")
253 if((CMAKE_C_COMPILER_VERSION VERSION_GREATER "4.8.99") OR CLANG)
254 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11")
256 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99")
262 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_XOPEN_SOURCE=700")
266 if(NOT CLANG)
267 message(FATAL_ERROR "You need to build with Clang for fuzzing to work")
271 message(FATAL_ERROR "You need Clang ≥ 6.0.0")
274 add_definitions(-DBORINGSSL_UNSAFE_DETERMINISTIC_MODE)
275 set(RUNNER_ARGS "-deterministic")
278 add_definitions(-DBORINGSSL_UNSAFE_FUZZER_MODE)
279 set(RUNNER_ARGS ${RUNNER_ARGS} "-fuzzer" "-shim-config" "fuzzer_mode.json")
282 …set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address,fuzzer-no-link -fsanitize-coverage=edge,ind…
283 …set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address,fuzzer-no-link -fsanitize-coverage=edge…
286 add_definitions(-DBORINGSSL_IMPLEMENTATION)
289 add_definitions(-DBORINGSSL_SHARED_LIBRARY)
290 # Enable position-independent code globally. This is needed because
295 if(MSAN)
296 if(NOT CLANG)
297 message(FATAL_ERROR "Cannot enable MSAN unless using Clang")
301 message(FATAL_ERROR "ASAN and MSAN are mutually exclusive")
304 …set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=memory -fsanitize-memory-track-origins -fno-omit-fr…
305 …set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=memory -fsanitize-memory-track-origins -fno-omi…
306 …set(CMAKE_ASM_FLAGS "${CMAKE_ASM_FLAGS} -fsanitize=memory -fsanitize-memory-track-origins -fno-omi…
310 if(NOT CLANG)
311 message(FATAL_ERROR "Cannot enable ASAN unless using Clang")
314 …set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -fsanitize-address-use-after-scope -fno-omi…
315 …set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fsanitize-address-use-after-scope -fno…
319 if(NOT CLANG)
320 message(FATAL_ERROR "Cannot enable CFI unless using Clang")
323 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=cfi -fno-sanitize-trap=cfi -flto=thin")
324 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=cfi -fno-sanitize-trap=cfi -flto=thin")
325 # We use Chromium's copy of clang, which requires -fuse-ld=lld if building
326 # with -flto. That, in turn, can't handle -ggdb.
327 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fuse-ld=lld")
328 string(REPLACE "-ggdb" "-g" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
329 string(REPLACE "-ggdb" "-g" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
330 # -flto causes object files to contain LLVM bitcode. Mixing those with
336 if(NOT CLANG)
337 message(FATAL_ERROR "Cannot enable TSAN unless using Clang")
340 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=thread")
341 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=thread")
342 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=thread")
346 if(NOT CLANG)
347 message(FATAL_ERROR "Cannot enable UBSAN unless using Clang")
350 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=undefined")
351 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined")
352 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=undefined")
355 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-sanitize-recover=undefined")
356 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-sanitize-recover=undefined")
357 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fno-sanitize-recover=undefined")
362 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fprofile-arcs -ftest-coverage")
363 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage")
367 add_definitions(-DBORINGSSL_FIPS)
369 add_definitions("-DBORINGSSL_FIPS_BREAK_${FIPS_BREAK_TEST}=1")
371 # Delocate does not work for ASan and MSan builds.
372 if(NOT ASAN AND NOT MSAN)
378 add_definitions(-DOPENSSL_SMALL)
382 add_definitions(-DBORINGSSL_CONSTANT_TIME_VALIDATION)
384 add_definitions(-DNDEBUG)
394 execute_process(COMMAND ${GO_EXECUTABLE} run ${godeps} -format cmake
395 -pkg ${package}
401 -o ${CMAKE_CURRENT_BINARY_DIR}/${dest} ${package}
409 string(SUBSTRING "${CMAKE_CURRENT_BINARY_DIR}" ${root_dir_length} -1 target)
415 -o ${CMAKE_CURRENT_BINARY_DIR}/${dest} ${package}
416 COMMAND ${GO_EXECUTABLE} run ${godeps} -format depfile
417 -target ${target} -pkg ${package} -out ${depfile}
424 # CMake's iOS support uses Apple's multiple-architecture toolchain. It takes an
426 # alone, and expects all architecture-specific logic to be conditioned within
428 # files, so we fix CMAKE_SYSTEM_PROCESSOR and only support single-architecture
439 add_definitions(-DOPENSSL_NO_ASM)
446 # cmake reports AMD64 on Windows, but we might be building for 32-bit.
477 # The third-party Android-NDK CMake files somehow fail to set the -march flag
480 set(CMAKE_ASM_FLAGS "-march=${CMAKE_SYSTEM_PROCESSOR} ${CMAKE_ASM_FLAGS}")
485 # but clang defaults to 64-bit builds on OS X unless otherwise told.
486 # Set ARCH to x86_64 so clang and CMake agree. This is fixed in CMake 3.
491 if(NOT CLANG)
492 message(FATAL_ERROR "USE_CUSTOM_LIBCXX only supported with Clang")
497 # language-specific compile-only flags.
498 add_compile_options("-nostdinc++")
499 set(CMAKE_CXX_LINK_FLAGS "${CMAKE_CXX_LINK_FLAGS} -nostdlib++")
512 # This file is meant for exception-less builds.
525 -D_LIBCPP_ENABLE_CXX17_REMOVED_UNEXPECTED_FUNCTIONS
527 …set_target_properties(libcxxabi PROPERTIES COMPILE_FLAGS "-Wno-missing-prototypes -Wno-implicit-fa…
530 if(ASAN OR MSAN OR TSAN)
534 -D_LIBCPP_DISABLE_NEW_DELETE_DEFINITIONS
539 -D_LIBCPP_BUILDING_LIBRARY
540 -DLIBCXX_BUILDING_LIBCXXABI
545 # Add minimal googletest targets. The provided one has many side-effects, and
547 add_library(boringssl_gtest third_party/googletest/src/gtest-all.cc)
577 # without -fsanitize-coverage options or clang crashes.
578 …perties(Fuzzer PROPERTIES COMPILE_FLAGS "-Wno-shadow -Wno-format-nonliteral -Wno-missing-prototype…
590 set(HANDSHAKER_ARGS "-handshaker-path" $<TARGET_FILE:handshaker>)
595 COMMAND ${GO_EXECUTABLE} run util/all_tests.go -build-dir
598 ${GO_EXECUTABLE} test -shim-path $<TARGET_FILE:bssl_shim>