Home My projects My Journeys Blogs Gallery My favourites

: Does C23 header exists?

Currently Flup unconditionally uses bundled headers which recently added by C23. The unconditionally uses bundled headers is exist when I was initially added the use of stdbit.h and stdckint.h because it was appealing to me when I saw the draft of things C23 added. stdbit.h is an easy standard header for dealing with bits so Foxie don't have to implement the C23 things and use standard provided not my paw written one which may be as well buggy in some edge case which this cute fox couldn't thought at the time of writing.

My plan is to have KConfig hidden options HAS_STDCKINT and HAS_STDBIT options. And then set that based on my feature of shell exec as Foxie named it :3 so the KConfig in c23_support/ has this now.

          
menu "C23 support"
config HAS_STDBIT
  bool
  default $[[$PROJECT_DIR/scripts/check_header.sh stdbit.h]]
config HAS_STDCKINT
  bool
  default $[[$PROJECT_DIR/scripts/check_header.sh stdckint.h]]
          
        
Where $[[...]] is just like shell's $(...) but instead (...) Foxie used Lua's multiline syntax. It basicly runs the shell and captures its output and replace it with the output so if check_header.sh outputs "y". It will be replaced with "y" so kconfig command only sees default y and does not care about the syntax.

After the HAS_{HAS_STDBIT,HAS_STDCKINT} computed next is the user selectable config whether to use bundled one or not and it nicely defaults to "n" if the system already has the header or "y" if the system doesn't.

Next is of course the Makefile part which conditionally adds proper -isystem flag to corresponding subdir in c23_support/ to match the enabled bundle.

And here this what Foxie has to say about the auto detect. Which is nice isn't it UwU