Skip to content

Commit 959a9ea

Browse files
authored
[libffi] Check return value of execute_process() (#10469)
To avoid hiding errors, the return values of the execute_process() commands should be checked and a fatal error should be issued.
2 parents f68088b + a4a5c65 commit 959a9ea

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

ports/libffi/CMakeLists.txt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,17 +120,27 @@ macro(add_assembly ASMFILE)
120120
COMMAND ${CMAKE_C_COMPILER} /nologo /EP /I. /Iinclude /I${CMAKE_CURRENT_SOURCE_DIR}/include "${ASMFILE_FULL}"
121121
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
122122
OUTPUT_FILE ${ARCH_ASM_NAME}.asm
123+
RESULT_VARIABLE retcode
123124
)
124125

126+
if(NOT ${retcode} STREQUAL "0")
127+
message(FATAL_ERROR "Unable to assemble, exit code: '${retcode}'.")
128+
endif()
129+
125130
# Produced *.asm file could be just added to sources.
126131
# It works in x64 mode, but for some strange reason MASM returns error code when in x86,
127132
# (even though it didn't report any errors and correctly generated object file)
128133
# which in turn causes MSBUILD to stop.
129134
execute_process(
130135
COMMAND ${ARCH_ASSEMBLER} ${ARCH_ASM_NAME}.asm
131136
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
137+
RESULT_VARIABLE retcode
132138
)
133139

140+
if(NOT ${retcode} STREQUAL "0")
141+
message(FATAL_ERROR "Unable to compile assembly, exit code: '${retcode}'.")
142+
endif()
143+
134144
list(APPEND FFI_SOURCES ${CMAKE_BINARY_DIR}/${ARCH_ASM_NAME}.obj)
135145
else()
136146
list(APPEND FFI_SOURCES ${ASMFILE})

ports/libffi/CONTROL

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
Source: libffi
2-
Version: 3.3-1
2+
Version: 3.3-2
33
Homepage: https://github.com/libffi/libffi
44
Description: Portable, high level programming interface to various calling conventions

0 commit comments

Comments
 (0)