Coder Social home page Coder Social logo

jgabaut / koliseo Goto Github PK

View Code? Open in Web Editor NEW
5.0 5.0 0.0 266 KB

An arena allocator library in C.

Home Page: https://jgabaut.github.io/koliseo-docs

License: GNU General Public License v3.0

Makefile 3.57% M4 1.88% C 90.06% Shell 4.49%
allocator amboso arena-allocator c c11

koliseo's Introduction

Hi there 👋

koliseo's People

Contributors

alishahabzadeh avatar jgabaut avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

koliseo's Issues

[BUG] Anvil build fails when using invil

As of 0.3.17, anvil build fails when using invil.

The issue seems to be that current version tries to build out-of-order: 0.3.17 is followed by 0.3.2, which sees unexpected files and a failed git switch. However, a separate issue coming from the split enable-curses config flag.

To Reproduce

  1. ./scripts/boostrap_anvil.sh repo_invil && ./anvil -i
  2. Build for 0.3.17 fails

Console log, with some ellipses:

/usr/bin/ld: static/demo.o: warning: relocation against `stdscr' in read-only section `.text.startup'
/usr/bin/ld: static/demo.o: in function `main':
MYDIR/repos/koliseo/static/demo.c:172:(.text.startup+0x5ca): undefined reference to `initscr'
/usr/bin/ld: MYDIR/repos/koliseo/static/demo.c:173:(.text.startup+0x5d1): undefined reference to `stdscr'
/usr/bin/ld: MYDIR/repos/koliseo/static/demo.c:173:(.text.startup+0x5d6): undefined reference to `wclear'
   [...]
/usr/bin/ld: src/koliseo.o: in function `kls_show_toWin':
MYDIR/repos/koliseo/src/koliseo.c:2009:(.text+0xb2a): undefined reference to `wclear'
/usr/bin/ld: MYDIR/repos/koliseo/src/koliseo.c:2010:(.text+0xb48): undefined reference to `wborder'
   [...]
/usr/bin/ld: src/koliseo.o: in function `kls_show_toWin':
MYDIR/repos/koliseo/src/koliseo.c:2049:(.text+0xd0d): undefined reference to `wrefresh'
/usr/bin/ld: MYDIR/repos/koliseo/src/koliseo.c:2054:(.text+0xd1c): undefined reference to `wgetch'
/usr/bin/ld: src/koliseo.o: in function `kls_temp_show_toWin':
MYDIR/repos/koliseo/src/koliseo.c:2094:(.text+0xde8): undefined reference to `wclear'
/usr/bin/ld: MYDIR/repos/koliseo/src/koliseo.c:2095:(.text+0xe06): undefined reference to `wborder'
/usr/bin/ld: MYDIR/repos/koliseo/src/koliseo.c:2096:(.text+0xe12): undefined reference to `wrefresh'
   [...]
/usr/bin/ld: warning: creating DT_TEXTREL in a PIE
collect2: error: ld returned 1 exit status
make: *** [Makefile:649: demo] Error 1
[WARN] do_init(): Build failed for tag {0.3.17}. Err: make failed
[INFO] Trying to build {"0.3.2"}
[WARN] git switch failed with status: 128
fatal: atteso branch, ricevuto commit '6116d3415e6609831a90c53d22866e9e1dca1ca7'
suggerimento: If you want to detach HEAD at the commit, try again with the --detach option.
[WARN] do_init(): Build failed for tag {0.3.2}. Err: git switch failed
[INFO] Trying to build {"0.3.3"}
[WARN] git switch failed with status: 128
fatal: atteso branch, ricevuto commit 'a7d4c6c0d858c463e878c68f804ed053ee773b38'
suggerimento: If you want to detach HEAD at the commit, try again with the --detach option.
[WARN] do_init(): Build failed for tag {0.3.3}. Err: git switch failed
[INFO] Trying to build {"0.3.4"}
[WARN] git switch failed with status: 128
fatal: atteso branch, ricevuto commit 'cc2f581fd89cf4d66df86c713d527a053c124b4b'
suggerimento: If you want to detach HEAD at the commit, try again with the --detach option.
[WARN] do_init(): Build failed for tag {0.3.4}. Err: git switch failed
[INFO] Trying to build {"0.3.5"}
[WARN] git switch failed with status: 128
fatal: atteso branch, ricevuto commit '91d097d7b0518cbde556d095b88c4a1c0955e649'
suggerimento: If you want to detach HEAD at the commit, try again with the --detach option.
[WARN] do_init(): Build failed for tag {0.3.5}. Err: git switch failed
[INFO] Trying to build {"0.3.6"}
[WARN] git switch failed with status: 128
fatal: atteso branch, ricevuto commit '5f033ce72d1bb7a3bd0f654a16b3ac0b515bedb7'
suggerimento: If you want to detach HEAD at the commit, try again with the --detach option.
[WARN] do_init(): Build failed for tag {0.3.6}. Err: git switch failed
[INFO] Trying to build {"0.3.7"}
[WARN] git switch failed with status: 128
fatal: atteso branch, ricevuto commit '2207768dcfefca4f8b725bef90f30afb83148146'
suggerimento: If you want to detach HEAD at the commit, try again with the --detach option.
[WARN] do_init(): Build failed for tag {0.3.7}. Err: git switch failed
[INFO] Trying to build {"0.3.8"}
[WARN] git switch failed with status: 128
fatal: atteso branch, ricevuto commit '495ad957e71fdffd9487d284d5fd9da89276b328'
suggerimento: If you want to detach HEAD at the commit, try again with the --detach option.
[WARN] do_init(): Build failed for tag {0.3.8}. Err: git switch failed
[INFO] Trying to build {"0.3.9"}
[WARN] git switch failed with status: 128
fatal: atteso branch, ricevuto commit '7bbe81c020904ef11f8e53745d2326117169e92b'
suggerimento: If you want to detach HEAD at the commit, try again with the --detach option.
[WARN] do_init(): Build failed for tag {0.3.9}. Err: git switch failed
[WARN] No tag provided for query op.
[WARN] do_query() failed in handle_amboso_env(). Err: No tag provided.
  • Version 0.3.17

[BUG] Crash when turning on debug logging

Describe the bug
It seems that the variadic format of kls_log() doesn't go well with some Linux versions.
On any attempt to call the function, and subsequently vfprintf(), which is the actual culprit, a crash happens because of missing support.
If the platform really is the cause, this would effectively lock some distros from debugging for versions >0.1.11, since before 0.1.12 kls_log() was not variadic.

Update

I removed mentions of 32bit Linux since I don't believe that's the culprit for this one.

Useful backtrace line was:

 with __strlen_avx2 () at ../sysdeps/x86_64/multiarch/strlen-avx2.S:74 74	
  ../sysdeps/x86_64/multiarch/strlen-avx2.S: No such file or directory.
#1  0x00007ffff7c76db1 in __vfprintf_internal (_..._)
    at ./stdio-common/vfprintf-internal.c:1517

This link mentions something similar but doesn't ultimately pin the problem to a platform.
This comment seems to suggest it's about printing stuff.

The issue may be related to printing sized stuff which will have a different size on some platforms.

To Reproduce

  1. Compile with debug on.
  2. Run the demo.
  3. Demo crashes as soon at the first kls_log() call.

Expected behavior
Log function prints to debug log file and returns peacefully.

  • OS: some Linux
  • Version: >=0.1.12

[BUG] KLS_DEBUG_CORE breaks compatibility with raylib

After 0.3.1, the KLS_DEBUG_CORE define in koliseo.h also includes windows.h. This makes the windows build of the library incompatible with raylib, since builds will fail with redefined symbols.

  • OS: mingw32
  • Version >=0.3.1

[FEATURE] Add separate default config for internal usage

Situation

At the moment the KLS_Conf default is not const and can be reassigned by depending code. This could break the KLS_Region_List backend when using another Koliseo.

Steps

  • Add const KLS_Conf kls_default_conf__
  • Update internal kls_new() calls made for KLS_BASIC backend, to use kls_new_conf(kls_default_conf__).

[BUG] Using KLS_PUSH_ARR_T_NAMED() leads to compilation error

Using KLS_PUSH_ARR_T_NAMED() anywhere causes compilation to fail.

To Reproduce

  • Checkout 0.4.1
  • Run make anviltest
  • A test build fails with this error:
Building many_temp_regions_named.k testIn file included from tests/error/many_temp_regions_named.c:1:
tests/error/many_temp_regions_named.c: In function ‘main’:
tests/error/../../src/koliseo.h:552:53: error: expected expression before ‘)’ token
  552 | #define KLS_PUSH_ARR_T(kls_temp, type, count) (type*)kls_temp_push_zero_AR((kls_temp), sizeof(type), _Alignof(type), (count))
      |                                                     ^
tests/error/../../src/koliseo.h:566:65: note: in expansion of macro ‘KLS_PUSH_ARR_T’
  566 | #define KLS_PUSH_ARR_T_NAMED(kls_temp, type, count, name, desc) KLS_PUSH_ARR_T((kls_temp),(type),(count))
      |                                                                 ^~~~~~~~~~~~~~
tests/error/../../src/koliseo.h:596:54: note: in expansion of macro ‘KLS_PUSH_ARR_T_NAMED’
  596 | #define KLS_PUSH_T_NAMED(kls_temp, type, name, desc) KLS_PUSH_ARR_T_NAMED((kls_temp), type, 1, (name), (desc))
      |                                                      ^~~~~~~~~~~~~~~~~~~~
tests/error/many_temp_regions_named.c:10:22: note: in expansion of macro ‘KLS_PUSH_T_NAMED’
   10 |         int* dummy = KLS_PUSH_T_NAMED(t_kls,int, "An int", "An int");

Expected behavior
Build should not fail. The definition of the macro should pass the type argument without wrapping it:

  566 | #define KLS_PUSH_ARR_T_NAMED(kls_temp, type, count, name, desc) KLS_PUSH_ARR_T((kls_temp),type,(count))
  • Version: >=0.4.1

File pointer for debug log is not closed on some exit calls

From version 0.3.0, (see PR), a FIXME has been put in place at the beginning of koliseo.c.

Right now, calls to exit() from runtime error checks never try to fclose(KOLISEO_DEBUG_FP). As a result, if it is initialised, it can leak when an error (say, Out-of-memory) happens.

This should be corrected because even if the lib doesn't initialise the pointer, it could still be made ready from calling code.

[FEATURE] The example usage for macro should take size by pointer

The basic_example provided is calling the KLS_PUSH() macro passing the Example type itself.

This is not recommended to do, since the call won't be correctly updated if you change the types and the typedef ends up having an incorrect size.

Using an expression pointer size is preferreable (eg. *example instead).

  • basic_example should be fixed
  • README should be updated
  • KLS_BASIC backend calls should be fixed.

[BUG] basic_example is still using old macro format

With 0.4.0, core macros were updated not to expect a count argument (defaulting to 1).

Old syntax was refactored to KLS_PUSH_ARR() and similarly named macros.

basic_example.c is still showing the old syntax for the push call, which would not compile now.

  • Version: >= 0.4.0

[BUG] Direct build still needs -DWINDOWS_BUILD when compiler is X86_64-w64-mingw32

At the moment, the macro WINDOWS_BUILD is controlling some preprocessor directives that, in reality, should be guarded by _WIN32.

Even when using the proper gcc from mingw (x86_64-w64-mingw-gcc) and adding the proper include/lib directories (set by from configure.ac in KOLISEO_CFLAGS and KOLISEO_LDFLAGS), the build still fails because of the mentioned WINDOWS_BUILD guard issue.

This is only relevant when trying to build without using the provided Makefile.am (could happen in a user repo).

To reproduce:

  • Build using x86_64-w64-mingw32-gcc:

    • -I /usr/x86_64-w64-mingw32/include
    • -L /usr/x86_64-w64-mingw32/lib
    • If needed: -static -fstack-protector
  • Build fails because of incorrect format specifiers (those that are guarded by WINDOWS_BUILD rather than _WIN32 are not getting enabled, resulting in Linux code being used

  • Version <=0.4.1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.