On Sun, Jan 06, 2013 at 05:03:28PM +0100, grischka wrote:
[...]
> Compilation on Windows with MSC fails in tccgen.c:vswap():
> ../tccgen.c(476) : error C2143: syntax error : missing ';' before 'type'
> [more ...]
>
> After moving declarations before statements, it fails like this:
> ../tccgen.c(490) : warning C4308: negative integral constant converted to
> unsigned type
> ../tccgen.c(490) : warning C4307: '*' : integral constant overflow
> ../tccgen.c(490) : warning C4307: '+' : integral constant overflow
> ../tccgen.c:481: error: incompatible types for redefinition of
> '__static_assert_t'
> [more ...]
grischka! Could you please Cc relevant people when talking about
reverting their patches? I was unaware of this issue until recently.
Some of us read lists in batches through gmane...
> I'd suggest to move that optimization into its own function
> void memswap(void *p1, void *p2, size_t n);
For it to work effectively that memswap should be static inline and
contains test for n to be builtin constant and be more "ugly" in your
speak, and also that __builtin_constant() tests might not work out of
the box in tcc...
> or otherwise to revert it.
Maybe let's just do it step by step and fix _STATIC_ASSERT for win32?
Especially there is already one in
win32/include/malloc.h:#define _STATIC_ASSERT(expr) extern void
__static_assert_t(int [(expr)?1:-1])
#ifndef _MSVC
# define _STATIC_ASSERT // from ccan
#else
# define _STATIC_ASSERT // for msvc
#endif
?
Optimizing vswap() was an easy win and given tinycc goal is to be fast
compiler I suggest not to revert it.
On the other hand I have no microsoft compilers installation nor any
windows on my machines, and thus can't test how the code works/breaks there.
That _STATIC_ASSERT was taken from CCAN[1] which is valuable and quality
library for C.
No offences, but ruling out speedups on msvc non-standartness is not
wise imho.
I'm open to fixing it, just please cc me, and please provide advices
with msvc.
Thanks,
Kirill
[1] http://ccodearchive.net/
_______________________________________________
Tinycc-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel