devkitPro / libctru

Homebrew development library for Nintendo 3DS/Horizon OS user mode (Arm11)
https://libctru.devkitpro.org/
770 stars 170 forks source link

Global macros clash with other things #530

Closed glebm closed 1 year ago

glebm commented 1 year ago

Here, libctru defines some macros that can clash with other things:

https://github.com/devkitPro/libctru/blob/a4634c02905a824d01feae338d1c472ab5dae1eb/libctru/include/3ds/types.h#L51-L52

For example, with the latest version of libfmt, this does not work:

#include <3ds.h>
#include <fmt/core.h>

This is because libfmt uses PACKED as a template parameter name in one of its functions:

https://github.com/fmtlib/fmt/blob/d4987546a4269cc21565ea633eed56db09039d1a/include/fmt/core.h#L1557-L1558

Including things in the opposite order works but really 3ds should not define such macros publicly:

#include <fmt/core.h>
#include <3ds.h>

This can be tricky to work around in a medium size codebase, e.g. https://github.com/diasurgical/devilutionX/pull/6585