LukasBanana / LLGL

Low Level Graphics Library (LLGL) is a thin abstraction layer for the modern graphics APIs OpenGL, Direct3D, Vulkan, and Metal
BSD 3-Clause "New" or "Revised" License
2.03k stars 135 forks source link

RenderSystem.cpp needs __STDC_FORMAT_MACROS defined #85

Closed barracuda156 closed 1 year ago

barracuda156 commented 1 year ago
[ 33%] Building CXX object CMakeFiles/LLGL.dir/sources/Renderer/StaticModuleInterface.cpp.o
/opt/local/bin/g++-mp-12 -DGL_SILENCE_DEPRECATION -DLLGL_BUILD_RENDERER_NULL -DLLGL_BUILD_RENDERER_OPENGL -DLLGL_ENABLE_DEBUG_LAYER -DLLGL_EXPORTS -DLLGL_GL_ENABLE_DSA_EXT -DLLGL_GL_ENABLE_VENDOR_EXT -I/opt/local/var/macports/build/_opt_PPCRosettaPorts_devel_LLGL/LLGL/work/LLGL-b78cf2ac6257c7ff173a02ee267f04b84fdadcb1/include -I/opt/local/include/Gauss -F//System/Library/Frameworks -I/opt/local/var/macports/build/_opt_PPCRosettaPorts_devel_LLGL/LLGL/work/LLGL-b78cf2ac6257c7ff173a02ee267f04b84fdadcb1/external/OpenGL/include -pipe -Os -DNDEBUG -I/opt/local/include -D_GLIBCXX_USE_CXX11_ABI=0 -std=gnu++11 -arch ppc -mmacosx-version-min=10.6 -fPIC -MD -MT CMakeFiles/LLGL.dir/sources/Renderer/StaticModuleInterface.cpp.o -MF CMakeFiles/LLGL.dir/sources/Renderer/StaticModuleInterface.cpp.o.d -o CMakeFiles/LLGL.dir/sources/Renderer/StaticModuleInterface.cpp.o -c /opt/local/var/macports/build/_opt_PPCRosettaPorts_devel_LLGL/LLGL/work/LLGL-b78cf2ac6257c7ff173a02ee267f04b84fdadcb1/sources/Renderer/StaticModuleInterface.cpp
In file included from /opt/local/var/macports/build/_opt_PPCRosettaPorts_devel_LLGL/LLGL/work/LLGL-b78cf2ac6257c7ff173a02ee267f04b84fdadcb1/sources/Renderer/../Core/StringUtils.h:13,
                 from /opt/local/var/macports/build/_opt_PPCRosettaPorts_devel_LLGL/LLGL/work/LLGL-b78cf2ac6257c7ff173a02ee267f04b84fdadcb1/sources/Renderer/RenderSystem.cpp:10:
/opt/local/var/macports/build/_opt_PPCRosettaPorts_devel_LLGL/LLGL/work/LLGL-b78cf2ac6257c7ff173a02ee267f04b84fdadcb1/sources/Renderer/RenderSystem.cpp: In member function 'void LLGL::RenderSystem::AssertCreateBuffer(const LLGL::BufferDescriptor&, uint64_t)':
/opt/local/var/macports/build/_opt_PPCRosettaPorts_devel_LLGL/LLGL/work/LLGL-b78cf2ac6257c7ff173a02ee267f04b84fdadcb1/sources/Renderer/RenderSystem.cpp:349:49: error: expected ')' before 'PRIX64'
  349 |         "buffer descriptor with size of 0x%016" PRIX64 " exceeded limit of 0x%016" PRIX64, bufferDesc.size, maxSize
      |                                                 ^~~~~~
/opt/local/var/macports/build/_opt_PPCRosettaPorts_devel_LLGL/LLGL/work/LLGL-b78cf2ac6257c7ff173a02ee267f04b84fdadcb1/sources/Renderer/../Core/Exception.h:19:10: note: in definition of macro 'LLGL_VA_ARGS'
   19 |     , ## __VA_ARGS__
      |          ^~~~~~~~~~~
/opt/local/var/macports/build/_opt_PPCRosettaPorts_devel_LLGL/LLGL/work/LLGL-b78cf2ac6257c7ff173a02ee267f04b84fdadcb1/sources/Renderer/RenderSystem.cpp:347:5: note: in expansion of macro 'LLGL_ASSERT'
  347 |     LLGL_ASSERT(
      |     ^~~~~~~~~~~
In file included from /opt/local/var/macports/build/_opt_PPCRosettaPorts_devel_LLGL/LLGL/work/LLGL-b78cf2ac6257c7ff173a02ee267f04b84fdadcb1/sources/Renderer/RenderSystem.cpp:11:
/opt/local/var/macports/build/_opt_PPCRosettaPorts_devel_LLGL/LLGL/work/LLGL-b78cf2ac6257c7ff173a02ee267f04b84fdadcb1/sources/Renderer/../Core/Assertion.h:16:45: note: to match this '('
   16 |     if (!(EXPR)) { LLGL::TrapAssertionFailed(__FUNCTION__, #EXPR LLGL_VA_ARGS(__VA_ARGS__)); }
      |                                             ^
/opt/local/var/macports/build/_opt_PPCRosettaPorts_devel_LLGL/LLGL/work/LLGL-b78cf2ac6257c7ff173a02ee267f04b84fdadcb1/sources/Renderer/RenderSystem.cpp:347:5: note: in expansion of macro 'LLGL_ASSERT'
  347 |     LLGL_ASSERT(
      |     ^~~~~~~~~~~
/opt/local/var/macports/build/_opt_PPCRosettaPorts_devel_LLGL/LLGL/work/LLGL-b78cf2ac6257c7ff173a02ee267f04b84fdadcb1/sources/Renderer/RenderSystem.cpp:37:1: note: 'PRIX64' is defined in header '<cinttypes>'; did you forget to '#include <cinttypes>'?
   36 | #include "ModuleInterface.h"
  +++ |+#include <cinttypes>
   37 | 

GCC suggests including cinttypes, that will work for GCC, but will fail with some old Apple clangs. What works with both is defining __STDC_FORMAT_MACROS prior to including the header.

LukasBanana commented 1 year ago

Thanks for reporting. Can you please confirm this fixes the issue and do you know whether __STDC_FORMAT_MACROS should be guarded by a __GNUC__ or __clang__ macro condition?

barracuda156 commented 1 year ago

At least on Apple it applies to GCC and Clang both (and is in fact needed on some configurations with either). I think I never seen it being compiler-specific. Often it is used like this:

#ifndef __STDC_FORMAT_MACROS
#define __STDC_FORMAT_MACROS
#endif
LukasBanana commented 1 year ago

This should be fixed with 666c26d. Please let me know if that fixes the issue for you.

barracuda156 commented 1 year ago

@LukasBanana Thank you!