Skip to content

Commit

Permalink
[build] Warning Suppression PR #1: Turned on -Wno-ignored-attributes …
Browse files Browse the repository at this point in the history
…& Removed unused functions (#4916)
  • Loading branch information
jim19930609 authored May 7, 2022
1 parent a951d05 commit cebee89
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 39 deletions.
18 changes: 18 additions & 0 deletions cmake/TaichiCXXFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,25 @@ else()
message("Invalid compiler ${CMAKE_CXX_COMPILER_ID} detected.")
message(FATAL_ERROR "clang and MSVC are the only supported compilers for Taichi compiler development. Consider using 'cmake -DCMAKE_CXX_COMPILER=clang' if you are on Linux.")
endif()

# [Global] CXX compilation option to enable all warnings.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall ")

# [Global] By default, CXX compiler will throw a warning if it decides to ignore an attribute, for example "[[ maybe unused ]]".
# However, this behaviour diverges across different compilers (GCC/CLANG), as well as different compiler versions.
# Therefore we disable such warnings for now.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-ignored-attributes ")

# [Global] Clang warns if a C++ pointer's nullability wasn't marked explicitly (__nonnull, nullable, ...).
# Nullability seems to be a clang-specific feature, thus we disable this warning.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-nullability-completeness ")

# [Global] Disable warning for unused-private-field for convenience in development.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-private-field ")

# [Global] By evaluating "constexpr", compiler throws a warning for functions known to be dead at compile time.
# However, some of these "constexpr" are debug flags and will be manually enabled upon debuging.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unneeded-internal-declaration ")
endif ()

message("Building for processor ${CMAKE_SYSTEM_PROCESSOR}")
Expand Down
1 change: 0 additions & 1 deletion taichi/backends/interop/vulkan_cpu_interop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ void memcpy_cpu_to_vulkan_via_staging(DevicePtr dst,
VulkanDevice *vk_dev = dynamic_cast<VulkanDevice *>(dst.device);
CpuDevice *cpu_dev = dynamic_cast<CpuDevice *>(src.device);

DeviceAllocation dst_alloc(dst);
DeviceAllocation src_alloc(src);

CpuDevice::AllocInfo src_alloc_info = cpu_dev->get_alloc_info(src_alloc);
Expand Down
4 changes: 2 additions & 2 deletions taichi/backends/vulkan/vulkan_program.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ FunctionType compile_to_executable(Kernel *kernel,
VkRuntime *runtime,
SNodeTreeManager *snode_tree_mgr) {
auto handle = runtime->register_taichi_kernel(
std::move(run_codegen(kernel, runtime->get_ti_device(),
snode_tree_mgr->get_compiled_structs())));
run_codegen(kernel, runtime->get_ti_device(),
snode_tree_mgr->get_compiled_structs()));
return [runtime, handle](RuntimeContext &ctx) {
runtime->launch_kernel(handle, &ctx);
};
Expand Down
36 changes: 0 additions & 36 deletions taichi/backends/vulkan/vulkan_utils.cpp

This file was deleted.

0 comments on commit cebee89

Please sign in to comment.