Skip to content

Commit 99cf8da

Browse files
[Build] Resolved Most IPO Warnings
VTR is built with IPO by default. IPO tends to reveal false warnings in the compiler. This was causing many warnings when VTR was built by default. Most of these warnings were coming from libarchfpga due to how it allocates arrays. Suppressed these warnings when IPO is turned on. There are still link-time warnings coming from CapNProto; however, since this library is external, it is a harder to supress these warnings. We could suppress the warnings by globally setting the link option to ignore the warning, but that may be overkill.
1 parent 0c5c8ad commit 99cf8da

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

libs/libarchfpga/CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,18 @@ endif()
5353

5454
target_compile_definitions(libarchfpga PUBLIC ${INTERCHANGE_SCHEMA_HEADERS})
5555

56+
# Supress IPO link warnings if IPO is enabled
57+
get_target_property(LIBARCHFPGA_USES_IPO libarchfpga INTERPROCEDURAL_OPTIMIZATION)
58+
if(LIBARCHFPGA_USES_IPO)
59+
# LibArchFPGA uses ints in many of its data structures instead of size_t for
60+
# the size of arrays which are used to allocate arrays. At link-time, this
61+
# causes many false allocation warnings when IPO is enabled.
62+
# In order to suppress these warnings, we must make this PUBLIC so that not
63+
# only we suppress the warning for libarchfpga, but also anything else that
64+
# links with it.
65+
target_link_options(libarchfpga PUBLIC -Wno-alloc-size-larger-than)
66+
endif()
67+
5668
#Create the test executable
5769
add_executable(read_arch ${READ_ARCH_EXEC_SRC})
5870
target_link_libraries(read_arch libarchfpga)

0 commit comments

Comments
 (0)