Skip to content

Commit

Permalink
DO NOT MERGE: Paul's fix for undefined PRIu64 on arm cortex-m platforms.
Browse files Browse the repository at this point in the history
  • Loading branch information
pguyot authored and UncleGrumpy committed Jan 3, 2025
1 parent 74258a1 commit 8b83999
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
27 changes: 27 additions & 0 deletions src/libAtomVM/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,33 @@ if (HAVE_PRAGMA_STDC_FENV_ACCESS)
target_compile_definitions(libAtomVM PUBLIC HAVE_PRAGMA_STDC_FENV_ACCESS)
endif()

# workaround for gcc-arm-none-eabi package issue
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1067692
check_c_source_compiles("
#include <inttypes.h>
#include <stdio.h>
int main() {
printf(\"%\" PRIu64, (uint64_t) 42);
return 0;
}
" PRIU64_WORKS)

if (NOT PRIU64_WORKS)
check_c_source_compiles("
#include <sys/_stdint.h>
#include <inttypes.h>
#include <stdio.h>
int main() {
printf(\"%\" PRIu64, (uint64_t) 42);
return 0;
}
" PRIU64_REQUIRES_WORKAROUND)

if(PRIU64_REQUIRES_WORKAROUND)
target_compile_definitions(libAtomVM PUBLIC REQUIRES_SYS_STDINT_FOR_PRIU64)
endif()
endif()

if(${CMAKE_C_FLAGS} MATCHES -DAVM_NO_SMP)
message("SMP is disabled by CFLAGS environment")
set(AVM_DISABLE_SMP ON)
Expand Down
5 changes: 5 additions & 0 deletions src/libAtomVM/term.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@
#ifndef _TERM_H_
#define _TERM_H_

#if REQUIRES_SYS_STDINT_FOR_PRIU64
#include <sys/_stdint.h>
#include <inttypes.h>
#endif

#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
Expand Down

0 comments on commit 8b83999

Please sign in to comment.