Error when building functions branch since a specific commit

I’ve realised that commit ID d3c5e882b09f4d5f73d0a09ee9c14d2e2ad2fb81 in the functions branch leads to a build failure on Windows. Not tested that on Linux yet though. The error is:

error C2229: class "BLI::MonotonicAllocator<0>" enthält ein Array mit der unzulässigen Größe 0 (Quelldatei wird kompiliert C:\blender-git\blender\source\blender\functions\core\data_flow_graph_builder.cpp) [C:\blender-git\Functions\source\blender\functions\bf_functions.vcxproj]

So it complains about class "BLI::MonotonicAllocator<0>" trying to define/create an array of size 0, originating from data_flow_graph_builder.cpp.

Not sure if this is a known thing, thought I might bring it to attention here. I also saw that on GraphicAll there were no more builds of this branch since the 2nd of July. The commit mentioned here came a day later.

GA buildbot has the same issue, i generally don’t babysit the builds all that much, once a week i do a sweep to check if they are still are working and perhaps send a small patch to the branch owner to get it building again.

@jacqueslucke msvc allows zero length arrays, but they have to sit at the end of the struct/class

diff --git a/source/blender/blenlib/BLI_monotonic_allocator.hpp b/source/blender/blenlib/BLI_monotonic_allocator.hpp
index 5672402bdf2..6788f5965bc 100644
--- a/source/blender/blenlib/BLI_monotonic_allocator.hpp
+++ b/source/blender/blenlib/BLI_monotonic_allocator.hpp
@@ -15,12 +15,12 @@ namespace BLI {

 template<uint N = 0> class MonotonicAllocator {
  private:
-  char m_small_buffer[N];
   SmallVector<void *> m_pointers;

   void *m_current_buffer;
   uint m_remaining_capacity;
   uint m_next_min_alloc_size;
+  char m_small_buffer[N];

  public:
   MonotonicAllocator()

This seems to fix it (or atleast make it build)

I think a similar issue has been introduced again. In BKE_node_tree.hpp there is an array definition, which on a Windows build causes a build error (zero size array). Moving the line MonotonicAllocator<> m_allocator; to the end of the VirtualNodeTree class like in the example below fixes the build error (though I can’t say if it introduces new issues):

class VirtualNodeTree {
 private:
  bool m_frozen = false;
  Vector<VirtualNode *> m_nodes;
  Vector<VirtualLink *> m_links;
  Vector<VirtualSocket *> m_inputs_with_links;
  MultiMap<std::string, VirtualNode *> m_nodes_by_idname;
  MonotonicAllocator<> m_allocator;
1 Like

More build issues on MSVC:
…\simulations\bparticles\inserters.cpp(82):
error C2440: ‘initializing’: cannot convert from ‘void *’ to ‘char *’

BLI_STRINGREF_STACK_COMBINE(name, name_prefix, vsocket->name());

Committed a fix, should be all good again!

2 Likes

Thanks for the fixes.