Skip to content

Commit

Permalink
llvm/helpers: Assert if printf is not found
Browse files Browse the repository at this point in the history
Compiled printf is only available as debugging measure,
so warnings are not useful.

Signed-off-by: Jan Vesely <[email protected]>
  • Loading branch information
jvesely committed Aug 7, 2024
1 parent eae133f commit db02a8e
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions psyneulink/core/llvm/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,16 +408,12 @@ def printf(builder, fmt, *args, override_debug=False):
#FIXME: Fix builtin printf and use that instead of this
libc_name = "msvcrt" if sys.platform == "win32" else "c"
libc = util.find_library(libc_name)
if libc is None:
warnings.warn("Standard libc library not found, 'printf' not available!")
return
assert libc is not None, "Standard libc library not found"

llvm.load_library_permanently(libc)
# Address will be none if the symbol is not found
printf_address = llvm.address_of_symbol("printf")
if printf_address is None:
warnings.warn("'printf' symbol not found in libc, 'printf' not available!")
return
assert printf_address is not None, "'printf' symbol not found in {}".format(libc)

# Direct pointer constants don't work
printf_ty = ir.FunctionType(ir.IntType(32), [ir.IntType(8).as_pointer()], var_arg=True)
Expand Down

0 comments on commit db02a8e

Please sign in to comment.