Skip to content

Commit 8b83999

Browse files
pguyotUncleGrumpy
authored andcommitted
DO NOT MERGE: Paul's fix for undefined PRIu64 on arm cortex-m platforms.
1 parent 74258a1 commit 8b83999

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

src/libAtomVM/CMakeLists.txt

+27
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,33 @@ if (HAVE_PRAGMA_STDC_FENV_ACCESS)
147147
target_compile_definitions(libAtomVM PUBLIC HAVE_PRAGMA_STDC_FENV_ACCESS)
148148
endif()
149149

150+
# workaround for gcc-arm-none-eabi package issue
151+
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1067692
152+
check_c_source_compiles("
153+
#include <inttypes.h>
154+
#include <stdio.h>
155+
int main() {
156+
printf(\"%\" PRIu64, (uint64_t) 42);
157+
return 0;
158+
}
159+
" PRIU64_WORKS)
160+
161+
if (NOT PRIU64_WORKS)
162+
check_c_source_compiles("
163+
#include <sys/_stdint.h>
164+
#include <inttypes.h>
165+
#include <stdio.h>
166+
int main() {
167+
printf(\"%\" PRIu64, (uint64_t) 42);
168+
return 0;
169+
}
170+
" PRIU64_REQUIRES_WORKAROUND)
171+
172+
if(PRIU64_REQUIRES_WORKAROUND)
173+
target_compile_definitions(libAtomVM PUBLIC REQUIRES_SYS_STDINT_FOR_PRIU64)
174+
endif()
175+
endif()
176+
150177
if(${CMAKE_C_FLAGS} MATCHES -DAVM_NO_SMP)
151178
message("SMP is disabled by CFLAGS environment")
152179
set(AVM_DISABLE_SMP ON)

src/libAtomVM/term.h

+5
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,11 @@
2828
#ifndef _TERM_H_
2929
#define _TERM_H_
3030

31+
#if REQUIRES_SYS_STDINT_FOR_PRIU64
32+
#include <sys/_stdint.h>
33+
#include <inttypes.h>
34+
#endif
35+
3136
#include <stdbool.h>
3237
#include <stdint.h>
3338
#include <stdio.h>

0 commit comments

Comments
 (0)