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

conflicting types for 'imaxdiv_t' #114

Closed Dirbaio closed 4 years ago

Dirbaio commented 4 years ago

Context

imaxdiv_t is defined in both stdlib.h and inttypes.h.

https://github.com/embeddedartistry/libc/blob/b5a593913fe016cc19a2553c0c78f382d02f7f21/include/stdlib.h#L36-L40 https://github.com/embeddedartistry/libc/blob/b5a593913fe016cc19a2553c0c78f382d02f7f21/include/inttypes.h#L11-L15

Expected Behavior

I can include both stdlib.h and inttypes.h without getting an error.

Current Behavior

Including both stdlib.h and inttypes.h causes this error:

In file included from ../src/XXXXX:
../third_party/libc/include/inttypes.h:15:3: error: conflicting types for 'imaxdiv_t'
   15 | } imaxdiv_t;
      |   ^~~~~~~~~
In file included from ../src/XXXXX:
../third_party/libc/include/stdlib.h:40:3: note: previous declaration of 'imaxdiv_t' was here
   40 | } imaxdiv_t;
      |   ^~~~~~~~~

GCC version:

[dirbaio@mars libc]$ arm-none-eabi-gcc --version
arm-none-eabi-gcc (Arch Repository) 9.2.0
phillipjohnston commented 4 years ago

Thank you @Dirbaio.