Started by Vonjo, September 11, 2012, 06:55:08 PM
0 Members and 1 Guest are viewing this topic.
===> CXX freight_list_sorter.ccfreight_list_sorter.cc:114:2: error: variable length array of non-POD element type 'ware_t' ALLOCA(ware_t, wlist, warray.get_count()); ^./simtypes.h:21:45: note: expanded from:# define ALLOCA(type, name, count) type name[count] ^1 error generated.make: *** [build/clang/freight_list_sorter.o] Error 1
# define ALLOCA(type, name, count) type name
Quote from: Vonjo on September 11, 2012, 07:52:40 PMThe workaround is by changing the array length with fixed number. Some also say to change the array to something like vector, but I'm not sure.
Quote from: Dwachs on September 11, 2012, 08:00:16 PMYou could replace line number 21 by line number 17 in simtypes.h, which replaces this incompatible macro.
# include <alloca.h># define ALLOCA(type, name, count) type* name = static_cast<type*>(alloca(sizeof(type) * (count)))
Quote from: Vonjo on September 12, 2012, 05:57:40 AMMaybe we can add configuration for clang too, to create clang LLVM build.
Quote from: Dwachs on September 12, 2012, 06:54:08 AMIf you could provide a patch ... or at least report how you manage to compile with clang
diff -r simutrans-original/config.template simutrans-patched/config.template21a22> #OSTYPE = linux_clangdiff -r simutrans-original/Makefile simutrans-patched/Makefile7c7< OSTYPES = amiga beos cygwin freebsd haiku linux mingw mac---> OSTYPES = amiga beos cygwin freebsd haiku linux linux_clang mingw mac49a50,54> ifeq ($(OSTYPE),linux_clang)> CC = clang> CXX = clang> LIBS += -lz -lbz2 -lstdc++> endifdiff -r simutrans-original/simtypes.h simutrans-patched/simtypes.h19a20,22> #elif defined __clang__> # include <alloca.h>> # define ALLOCA(type, name, count) type* name = static_cast<type*>(alloca(sizeof(type) * (count)))