소스 검색

Adedd workaround for GCC erroneous/zealous warning (#5343)

cfillion 2 년 전
부모
커밋
085fa42b7d
1개의 변경된 파일3개의 추가작업 그리고 0개의 파일을 삭제
  1. 3 0
      imgui_draw.cpp

+ 3 - 0
imgui_draw.cpp

@@ -2623,6 +2623,9 @@ void ImFontAtlasBuildPackCustomRects(ImFontAtlas* atlas, void* stbrp_context_opa
 
 
     ImVector<ImFontAtlasCustomRect>& user_rects = atlas->CustomRects;
     ImVector<ImFontAtlasCustomRect>& user_rects = atlas->CustomRects;
     IM_ASSERT(user_rects.Size >= 1); // We expect at least the default custom rects to be registered, else something went wrong.
     IM_ASSERT(user_rects.Size >= 1); // We expect at least the default custom rects to be registered, else something went wrong.
+#ifdef __GNUC__
+    if (user_rects.Size < 1) { __builtin_unreachable(); } // Workaround for GCC bug if IM_ASSERT() is defined to conditionally throw (see #5343)
+#endif
 
 
     ImVector<stbrp_rect> pack_rects;
     ImVector<stbrp_rect> pack_rects;
     pack_rects.resize(user_rects.Size);
     pack_rects.resize(user_rects.Size);