embeddedartistry / libc

libc targeted for embedded systems usage. Reduced set of functionality (due to embedded nature). Chosen for portability and quick bringup.
MIT License
510 stars 67 forks source link

fix redefinition of SIZE_MAX on aarch64 #113

Closed jkent closed 4 years ago

jkent commented 4 years ago

Description

Fixes re-declaration/warming for SIZE_MAX on aarch64 and other 64-bit targets. I thought about adding SIZE_MAX to the "__WORDSIZE is 32 bits" else section but I was concerned about support for < 32 bit targets.

In file included from /home/jkent/Projects/fe/neoboot/deps/libc/printf/printf.c:34:
/home/jkent/Projects/fe/neoboot/deps/libc/include/stdint.h:279: warning: "SIZE_MAX" redefined
 #define SIZE_MAX UINT32_MAX

/home/jkent/Projects/fe/neoboot/deps/libc/include/stdint.h:249: note: this is the location of the previous definition
 #define SIZE_MAX UINT64_MAX

Type of change

How Has This Been Tested?

Compilation.

phillipjohnston commented 4 years ago

I'll merge the change, but I'm curious: do you know how this is getting defined in your setup?

jkent commented 4 years ago

Hi @phillipjohnston .. Currently I'm pulling in libc via cmake like so:

https://github.com/ARMWorks/neoboot/blob/wip/deps/CMakeLists.txt

I don't have a working project yet (lots of upbringing on my target boards, no JTAG :( ) but the code base is really small at this point

phillipjohnston commented 4 years ago

Got it. I took a brief look, you might need to set -nostdinc and -nostdlib flags to get rid of the compiler's versions. (Maybe that's done in the toolchain file?)

jkent commented 4 years ago

Thank you for the tip! Yeah, thats handled in the toolchain file. I didn't have -nostdinc :+1: