Skip to content

Commit

Permalink
[libffi] Check return value of execute_process()
Browse files Browse the repository at this point in the history
To avoid hiding errors, the return values of the execute_process()
commands should be checked and a fatal error should be issued.
  • Loading branch information
derselbst committed Apr 8, 2020
1 parent a3a6e70 commit a4a5c65
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions ports/libffi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -120,17 +120,27 @@ macro(add_assembly ASMFILE)
COMMAND ${CMAKE_C_COMPILER} /nologo /EP /I. /Iinclude /I${CMAKE_CURRENT_SOURCE_DIR}/include "${ASMFILE_FULL}"
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
OUTPUT_FILE ${ARCH_ASM_NAME}.asm
RESULT_VARIABLE retcode
)

if(NOT ${retcode} STREQUAL "0")
message(FATAL_ERROR "Unable to assemble, exit code: '${retcode}'.")
endif()

# Produced *.asm file could be just added to sources.
# It works in x64 mode, but for some strange reason MASM returns error code when in x86,
# (even though it didn't report any errors and correctly generated object file)
# which in turn causes MSBUILD to stop.
execute_process(
COMMAND ${ARCH_ASSEMBLER} ${ARCH_ASM_NAME}.asm
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
RESULT_VARIABLE retcode
)

if(NOT ${retcode} STREQUAL "0")
message(FATAL_ERROR "Unable to compile assembly, exit code: '${retcode}'.")
endif()

list(APPEND FFI_SOURCES ${CMAKE_BINARY_DIR}/${ARCH_ASM_NAME}.obj)
else()
list(APPEND FFI_SOURCES ${ASMFILE})
Expand Down
2 changes: 1 addition & 1 deletion ports/libffi/CONTROL
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Source: libffi
Version: 3.3-1
Version: 3.3-2
Homepage: https://github.com/libffi/libffi
Description: Portable, high level programming interface to various calling conventions

0 comments on commit a4a5c65

Please sign in to comment.