Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ Options
|------|-------|-------|
|AIS\_USE\_CLANG\_TIDY|OFF|Run the `clang-tidy` tool|
|AIS\_USE\_IWYU|OFF|Run the `include-what-you-use` tool|
|AIS\_WARN\_UNSAFE\_BUFFER\_OPS|ON|Scan code for unsafe buffer operations (clang only, OFF for others)|
|BUILD\_AIS\_DOCS|OFF|Build API documentation (requires Doxygen)|
|BUILD\_AISCP|ON|Build `aiscp` example program (OFF if no hipFile)|
|BUILD\_CODE\_COVERAGE|OFF|Generate code coverage information when tests are run|
Expand Down
10 changes: 9 additions & 1 deletion cmake/AISClangSafeBuffers.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,21 @@
#
# Fixing this cleanly requires C++20, so it's an option for now
#-----------------------------------------------------------------------------
option(AIS_WARN_UNSAFE_BUFFER_OPS "Warn about unsafe buffer operations (llvm C++ only)" OFF)
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(USE_UBO ON)
else()
set(USE_UBO OFF)
endif()
option(AIS_WARN_UNSAFE_BUFFER_OPS "Warn about unsafe buffer operations (llvm C++ only)" ${USE_UBO})

if(AIS_WARN_UNSAFE_BUFFER_OPS)
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(AIS_CLANG_WARNING_FLAGS
-Wunsafe-buffer-usage
-fsafe-buffer-usage-suggestions
${AIS_CLANG_WARNING_FLAGS}
)
else()
message(FATAL_ERROR "Unsafe buffer warnings are only useful for clang/llvm")
endif()
endif()
Loading