WheretIB / nullc

Fast C-like programming language with advanced features
MIT License
163 stars 13 forks source link

Sync to internal development branch of October 2022 #34

Closed WheretIB closed 2 years ago

WheretIB commented 2 years ago

Language improvements and changes:

Library improvements:

Code generation improvements:

Runtime improvements:

API changes:

Other changes:

mingodad commented 2 years ago

I'm just building this branch to test it and I can see that there is still several warnings like:

NULLC/DenseMap.h:380:9: warning: ‘void* memset(void*, int, size_t)’ clearing an object of non-trivial type ‘struct DirectChainedMap<FunctionData*>::Node’; use assignment or value-initialization instead [-Wclass-memaccess]
  380 |   memset(data, 0, sizeof(Node) * bucketCount);
      |   ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
NULLC/DenseMap.h:331:9: note: ‘struct DirectChainedMap<FunctionData*>::Node’ declared here
  331 |  struct Node
      |         ^~~~

That on my fork I tried to fix then by wrapping memset see here https://github.com/mingodad/nullc/blob/a2db7962723040bdca581aabf9a92f1da652eacc/NULLC/stdafx.h#L38 :

#ifdef NO_MEMSET_WRAPPER
#define NULLC_no_warning_memset(dest, ch, sz) memset(dest, ch, sz)
#define NULLC_no_warning_memcpy(dest, src, sz) memcpy(dest, src, sz)
#else
inline void NULLC_no_warning_memset(void *dest, int ch, size_t sz) {memset(dest, ch, sz);}
inline void NULLC_no_warning_memcpy(void *dest, void *src, size_t sz) {memcpy(dest, src, sz);}
#endif

This way we have less compiler warnings to distract our attention.

mingodad commented 2 years ago

Also this easy to fix problem https://github.com/WheretIB/nullc/issues/28 has not been fixed.

WheretIB commented 2 years ago

Also this easy to fix problem #28 has not been fixed.

Maybe it's not that easy. I added the link argument here https://github.com/WheretIB/nullc/pull/34/files#diff-bf6c304578d0e149c4a16a0412871c436f997dbdd0ee53038d2c9cc0c60a74e4R221-R223 I'll test translation build on Unix again later.

WheretIB commented 2 years ago

I'm just building this branch to test it and I can see that there is still several warnings like:

I'll check your PR with a fix for this.

mingodad commented 2 years ago

Looking through it and seeing NULLC::SafeSprintf(pos, 1024 - unsigned(pos - cmdLine), " -lstdc++ -lm"); I forgot to mention that somehow I managed to build this project without depending/linkding(dynamically) to libstc++ adding this functions here https://github.com/mingodad/nullc/blob/a2db7962723040bdca581aabf9a92f1da652eacc/NULLC/stdafx.cpp#L82 :

nullc-dad/bin$ ldd nullc_exec 
    linux-vdso.so.1 (0x00007ffd4cdca000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f2733e81000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f2733ae3000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f27336f2000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f273449b000)

nullc-dad/bin$ ldd nullcl 
    linux-vdso.so.1 (0x00007fff1d9fc000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fe995f7f000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fe995b8e000)
    /lib64/ld-linux-x86-64.so.2 (0x00007fe996688000)

Original nullc:

nullc/bin$ ldd nullc_exec 
    linux-vdso.so.1 (0x00007ffc6c7a0000)
    libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007f5f46183000)
    libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007f5f45d76000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007f5f459d8000)
    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007f5f457c0000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f5f453cf000)
    /lib64/ld-linux-x86-64.so.2 (0x00007f5f4679e000)

nullc/bin$ ldd nullcl 
    linux-vdso.so.1 (0x00007ffd441d6000)
    libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fd9a4373000)
    libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fd9a3fd5000)
    libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fd9a3dbd000)
    libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fd9a39cc000)
    /lib64/ld-linux-x86-64.so.2 (0x00007fd9a4aed000)