diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4f985e9..68f2398 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,10 +3,10 @@ name: CI on: push: branches: - - boilerplate + - master - dev + - boilerplate - idiomatic - - master - rc1 - rc2 - rc3 diff --git a/.vimrc b/.vimrc new file mode 100644 index 0000000..1bf33a0 --- /dev/null +++ b/.vimrc @@ -0,0 +1,70 @@ +" Synesis C/C++ project .vimrc — aligned with .sis/.vscode/c_cxx/settings.json + +set nocompatible +filetype indent plugin on +syntax enable +set autoindent +set backspace=indent,eol,start +set hlsearch +set incsearch +set number + +" files.insertFinalNewline +set eol +set fixeol + +" editor.renderWhitespace: all +set list +set listchars=tab:->,trail:-,extends:>,precedes:<,nbsp:+ + +" editor.detectIndentation: false — global defaults (editor.tabSize: 4, insertSpaces: true) +set colorcolumn=76 +set expandtab +set shiftwidth=4 +set softtabstop=4 +set tabstop=4 + +" colorcolumn draws a full-column tint in Vim (not a VS Code-style 1px line). +" Keep it subtle via the ColorColumn highlight group; reapply after colorscheme changes. +if has('termguicolors') + " set termguicolors +endif + +function! s:ConfigureColorColumn() abort + highlight ColorColumn ctermbg=236 guibg=#2a2a2a cterm=NONE gui=NONE +endfunction + +call s:ConfigureColorColumn() +autocmd ColorScheme * call s:ConfigureColorColumn() + +" files.trimTrailingWhitespace +autocmd BufWritePre * %s/\s\+$//e + +augroup sis_c_cxx + autocmd! + + " [c] / [cpp] + autocmd FileType c,cpp setlocal expandtab tabstop=4 shiftwidth=4 softtabstop=4 colorcolumn=60,64,68,72,76 + + " [rust] + autocmd FileType rs setlocal expandtab tabstop=4 shiftwidth=4 softtabstop=4 colorcolumn=76 + + " [cmake] + autocmd FileType cmake setlocal noexpandtab tabstop=4 shiftwidth=4 softtabstop=4 + + " [shellscript] + autocmd FileType sh,bash,zsh setlocal expandtab tabstop=2 shiftwidth=2 softtabstop=2 colorcolumn=60,76 + + " [bat] + autocmd FileType bat,dosbatch setlocal expandtab tabstop=4 shiftwidth=4 softtabstop=4 colorcolumn=60,76 + + " [json] / [markdown] / [yaml] / [ruby] + autocmd FileType json,markdown,yaml,ruby setlocal expandtab tabstop=2 shiftwidth=2 softtabstop=2 + + " [python] + autocmd FileType python setlocal expandtab tabstop=4 shiftwidth=4 softtabstop=4 colorcolumn=60,76 + + " [toml] + autocmd FileType toml setlocal noexpandtab tabstop=2 shiftwidth=2 softtabstop=2 +augroup END + diff --git a/CHANGES.md b/CHANGES.md index 0bc7be0..1849ef6 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,15 @@ # Pantheios.Extras.AtExit - Changes +## 0.1.2-alpha1 - 21st August 2026 + +* Modernised library version macros to computed `PANTHEIOS_EXTRAS_ATEXIT_VER` (`VER_MAJOR` / `VER_MINOR` / `VER_PATCH` / `VER_ALPHABETA`, with `VER_REVISION` alias) targeting **0.1.2-alpha1**; +* Added **ctest_cmake.sh** and **run_all_unit_tests.cmd**; +* Ensured C/C++ sources end with a blank line after the end-of-file marker, and used `char* argv[]` in the unit-test `main`; +* Renamed the scratch program implementation to **main.c**; +* Recorded functionality-review items in **TODO.md**; deferred applying them, and deferred the helper **MSYSTEM**/MinGW rewrite until the **HELPER-SCRIPTS-C-CXX.md** contract is frozen; + + ## 0.1.1 - 16th August 2026 * Recovered **Pantheios.Extras.AtExit** from Hautacam (`pantheios/extras/AtExit/0.1`, Created 30th December 2011) as a nested compiled C library; diff --git a/NEWS.md b/NEWS.md index fad4113..6ded513 100644 --- a/NEWS.md +++ b/NEWS.md @@ -10,6 +10,7 @@ | Date | News Item | | ---------------- | -------------------------------------------------------------------------------- | +| 21st August 2026 | Pantheios.Extras.AtExit 0.1.2-alpha1 | | 16th August 2026 | Pantheios.Extras.AtExit 0.1.1 recovered and released | diff --git a/TODO.md b/TODO.md index 4d4c98b..763afa2 100644 --- a/TODO.md +++ b/TODO.md @@ -3,6 +3,30 @@ ## Functional improvements + +### High + +* [ ] Document (and optionally enforce) **`add` after `uninit`**: the libc `atexit` hook stays registered, so later **`add`** callbacks still run at process exit; docs currently imply the hook is a permanent no-op after drain; +* [ ] Document (or change) drain-while-locked: callbacks run under the spinlock, so a callback that calls **`add`** / **`uninit`** deadlocks; either forbid re-entrancy or copy the list, unlock, then invoke; + + +### Medium + +* [ ] Serialise **`init`**: `s_initialised` is a plain `int` and `init` is not under the lock, so two threads can register two `atexit` hooks; +* [ ] Align **`reserved0`** / **`reserved1`**: header says they must be `NULL` / `0`, but the implementation ignores them — `assert` or drop the requirement; +* [ ] Stop treating **`atexit()`** failure as an `errno` / **`strerror()`** code; `EBUSY` / `ENOMEM` are errno values, `atexit` failure often is not; + + +### Low + +* [ ] Document **`add` without `init`**: the list grows, but process exit will not drain it unless **`uninit`** is called; +* [ ] Initialise C11 `atomic_int s_mx` with **`ATOMIC_VAR_INIT(0)`** if compilers warn on `= 0`; +* [ ] Tests: **`add`** without **`init`** then **`uninit`**; **`add`** after **`uninit`**; version-macro unit test; keep process-exit coverage as scratch (or one automated case); +* [ ] Example: check **`add`** return values; + + +### Enhancements + * [ ] C++ RAII / `scope` wrapper; * [ ] Unix-only pthread synchronisation scratch (with a Windows equivalent if revived); @@ -14,7 +38,8 @@ ## Packaging improvements -* \ +* [ ] Defer rewriting helper `MSYSTEM` → `mingw32-make` / MinGW-generator detection until the **HELPER-SCRIPTS-C-CXX.md** contract is frozen (same defect class as other Synesis C/C++ helpers); +* [ ] Split the unit-test implementation from its entry TU (then name the entry **entry.c**); until then keep the single-file **test.unit.atexit.api.c**; diff --git a/ctest_cmake.sh b/ctest_cmake.sh new file mode 100755 index 0000000..24c2172 --- /dev/null +++ b/ctest_cmake.sh @@ -0,0 +1,108 @@ +#! /bin/bash + +ScriptPath=$0 +Dir=$(cd $(dirname "$ScriptPath"); pwd) +Basename=$(basename "$ScriptPath") +CMakeDir=${SIS_CMAKE_BUILD_DIR:-$Dir/_build} +[[ -n "$MSYSTEM" ]] && DefaultMakeCmd=mingw32-make.exe || DefaultMakeCmd=make +MakeCmd=${SIS_CMAKE_MAKE_COMMAND:-${SIS_CMAKE_COMMAND:-$DefaultMakeCmd}} +ProjectNameFile="$Dir/.sis/project_name.txt" +ProjectName=$(tr -d '[:space:]' < "$ProjectNameFile") + +CMakeVerbose= +RunMake=1 + + +# ########################################################## +# command-line handling + +while [[ $# -gt 0 ]]; do + + case $1 in + --no-make|-M) + + RunMake=0 + ;; + --verbose|-V) + + CMakeVerbose=--verbose + ;; + --help) + + [ -f "$Dir/.sis/script_info_lines.txt" ] && cat "$Dir/.sis/script_info_lines.txt" + cat << EOF +Runs CMake's CTest test program(s) + +$ScriptPath [ ... flags/options ... ] + +Flags/options: + + behaviour: + + -M + --no-make + does not execute CMake and make before running tests + + -V + --verbose + verbose test output + + + standard flags: + + --help + displays this help and terminates + +EOF + + exit 0 + ;; + *) + + >&2 echo "$ScriptPath: unrecognised argument '$1'; use --help for usage" + + exit 1 + ;; + esac + + shift +done + + +# ########################################################## +# main() + +status=0 + +if [ $RunMake -ne 0 ]; then + + echo "Executing build for ${ProjectName} (via command \`$MakeCmd\`) and then running all component and unit test programs" + + mkdir -p $CMakeDir || exit 1 + + cd $CMakeDir + + $MakeCmd + status=$? + + cd ->/dev/null +else + + if [ ! -d "$CMakeDir" ] || [ ! -f "$CMakeDir/CMakeCache.txt" ] || [ ! -d "$CMakeDir/CMakeFiles" ]; then + + >&2 echo "$ScriptPath: cannot run in '--no-make' mode without a previous successful build step" + fi +fi + +if [ $status -eq 0 ]; then + + echo "Running CMake tests" + + ctest --test-dir $CMakeDir $CMakeVerbose + status=$? +fi + +exit $status + + +# ############################## end of file ############################# # diff --git a/examples/c/example.c.1/example.c.1.c b/examples/c/example.c.1/example.c.1.c index 56b4978..3b43bd0 100644 --- a/examples/c/example.c.1/example.c.1.c +++ b/examples/c/example.c.1/example.c.1.c @@ -37,10 +37,18 @@ main(void) if (0 != r) { +#ifdef _MSC_VER + char error_message[256]; + + strerror_s(error_message, sizeof(error_message), r); +#else + char const* error_message = strerror(r); +#endif + fprintf( stderr , "failed to initialise Pantheios.Extras.AtExit : %s (%d)\n" - , strerror(r) + , error_message , r ); @@ -60,3 +68,4 @@ main(void) /* ///////////////////////////// end of file //////////////////////////// */ + diff --git a/include/pantheios/extras/atexit.h b/include/pantheios/extras/atexit.h index e708ff5..4f75829 100644 --- a/include/pantheios/extras/atexit.h +++ b/include/pantheios/extras/atexit.h @@ -4,7 +4,7 @@ * Purpose: Main C header for the Pantheios.Extras.AtExit library. * * Created: 30th December 2011 - * Updated: 16th August 2026 + * Updated: 21st August 2026 * * Home: http://www.pantheios.org/ * @@ -55,8 +55,8 @@ #ifndef PANTHEIOS_DOCUMENTATION_SKIP_SECTION # define PANTHEIOS_EXTRAS_ATEXIT_VER_PANTHEIOS_EXTRAS_H_ATEXIT_MAJOR 1 # define PANTHEIOS_EXTRAS_ATEXIT_VER_PANTHEIOS_EXTRAS_H_ATEXIT_MINOR 0 -# define PANTHEIOS_EXTRAS_ATEXIT_VER_PANTHEIOS_EXTRAS_H_ATEXIT_REVISION 3 -# define PANTHEIOS_EXTRAS_ATEXIT_VER_PANTHEIOS_EXTRAS_H_ATEXIT_EDIT 4 +# define PANTHEIOS_EXTRAS_ATEXIT_VER_PANTHEIOS_EXTRAS_H_ATEXIT_REVISION 4 +# define PANTHEIOS_EXTRAS_ATEXIT_VER_PANTHEIOS_EXTRAS_H_ATEXIT_EDIT 5 #endif /* !PANTHEIOS_DOCUMENTATION_SKIP_SECTION */ /* ///////////////////////////////////////////////////////////////////////// @@ -76,3 +76,4 @@ #endif /* !PANTHEIOS_EXTRAS_ATEXIT_INCL_PANTHEIOS_EXTRAS_H_ATEXIT */ /* ///////////////////////////// end of file //////////////////////////// */ + diff --git a/include/pantheios/extras/atexit/atexit.h b/include/pantheios/extras/atexit/atexit.h index a478ae7..d6dd9e4 100644 --- a/include/pantheios/extras/atexit/atexit.h +++ b/include/pantheios/extras/atexit/atexit.h @@ -4,7 +4,7 @@ * Purpose: Header file for Pantheios.Extras.AtExit. * * Created: 30th December 2011 - * Updated: 16th August 2026 + * Updated: 21st August 2026 * * Home: http://www.pantheios.org/ * @@ -54,9 +54,9 @@ #ifndef PANTHEIOS_DOCUMENTATION_SKIP_SECTION # define PANTHEIOS_EXTRAS_ATEXIT_VER_PANTHEIOS_EXTRAS_ATEXIT_H_ATEXIT_MAJOR 1 -# define PANTHEIOS_EXTRAS_ATEXIT_VER_PANTHEIOS_EXTRAS_ATEXIT_H_ATEXIT_MINOR 1 -# define PANTHEIOS_EXTRAS_ATEXIT_VER_PANTHEIOS_EXTRAS_ATEXIT_H_ATEXIT_REVISION 1 -# define PANTHEIOS_EXTRAS_ATEXIT_VER_PANTHEIOS_EXTRAS_ATEXIT_H_ATEXIT_EDIT 5 +# define PANTHEIOS_EXTRAS_ATEXIT_VER_PANTHEIOS_EXTRAS_ATEXIT_H_ATEXIT_MINOR 2 +# define PANTHEIOS_EXTRAS_ATEXIT_VER_PANTHEIOS_EXTRAS_ATEXIT_H_ATEXIT_REVISION 0 +# define PANTHEIOS_EXTRAS_ATEXIT_VER_PANTHEIOS_EXTRAS_ATEXIT_H_ATEXIT_EDIT 6 #endif /* !PANTHEIOS_DOCUMENTATION_SKIP_SECTION */ /** \def PANTHEIOS_EXTRAS_ATEXIT_VER_MAJOR @@ -67,23 +67,43 @@ * The minor version number of Pantheios.Extras.AtExit */ -/** \def PANTHEIOS_EXTRAS_ATEXIT_VER_REVISION - * The revision version number of Pantheios.Extras.AtExit +/** \def PANTHEIOS_EXTRAS_ATEXIT_VER_PATCH + * The patch version number of Pantheios.Extras.AtExit + */ + +/** \def PANTHEIOS_EXTRAS_ATEXIT_VER_ALPHABETA + * The alpha/beta designator of Pantheios.Extras.AtExit, or 0xFF for a + * non-prerelease */ /** \def PANTHEIOS_EXTRAS_ATEXIT_VER * The current composite version number of Pantheios.Extras.AtExit */ +/** \def PANTHEIOS_EXTRAS_ATEXIT_VER_REVISION + * Alias of PANTHEIOS_EXTRAS_ATEXIT_VER_PATCH (for CMake scrapers / older + * consumers) + */ + #ifndef PANTHEIOS_DOCUMENTATION_SKIP_SECTION # define PANTHEIOS_EXTRAS_ATEXIT_VER_0_1_1 0x000101ff +# define PANTHEIOS_EXTRAS_ATEXIT_VER_0_1_2_ALPHA_1 0x00010241 #endif /* !PANTHEIOS_DOCUMENTATION_SKIP_SECTION */ #define PANTHEIOS_EXTRAS_ATEXIT_VER_MAJOR 0 #define PANTHEIOS_EXTRAS_ATEXIT_VER_MINOR 1 -#define PANTHEIOS_EXTRAS_ATEXIT_VER_REVISION 1 +#define PANTHEIOS_EXTRAS_ATEXIT_VER_PATCH 2 +#define PANTHEIOS_EXTRAS_ATEXIT_VER_ALPHABETA 0x41 -#define PANTHEIOS_EXTRAS_ATEXIT_VER PANTHEIOS_EXTRAS_ATEXIT_VER_0_1_1 +#define PANTHEIOS_EXTRAS_ATEXIT_VER \ + (0\ + | ( PANTHEIOS_EXTRAS_ATEXIT_VER_MAJOR << 24 ) \ + | ( PANTHEIOS_EXTRAS_ATEXIT_VER_MINOR << 16 ) \ + | ( PANTHEIOS_EXTRAS_ATEXIT_VER_PATCH << 8 ) \ + | ( PANTHEIOS_EXTRAS_ATEXIT_VER_ALPHABETA << 0 ) \ + ) + +#define PANTHEIOS_EXTRAS_ATEXIT_VER_REVISION PANTHEIOS_EXTRAS_ATEXIT_VER_PATCH #ifdef __cplusplus extern "C" { @@ -165,3 +185,4 @@ pantheios_extras_atexit_add( #endif /* !PANTHEIOS_EXTRAS_ATEXIT_INCL_PANTHEIOS_EXTRAS_ATEXIT_H_ATEXIT */ /* ///////////////////////////// end of file //////////////////////////// */ + diff --git a/run_all_unit_tests.cmd b/run_all_unit_tests.cmd new file mode 100644 index 0000000..b68c97e --- /dev/null +++ b/run_all_unit_tests.cmd @@ -0,0 +1,188 @@ +@echo off + +SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION + +SET SCRIPT_DIRECTORY=%~dp0 +SET SCRIPT_PATH_DOC=%~n0[%~x0] +IF DEFINED SIS_CMAKE_BUILD_DIR ( + + SET "CMAKE_DIR=%SIS_CMAKE_BUILD_DIR%" +) ELSE ( + + SET "CMAKE_DIR=%SCRIPT_DIRECTORY%_build" +) + +SET ListOnly=0 +SET Verbose=0 +SET UnitOnly=0 +SET ComponentOnly=0 +SET status=0 + +FOR %%a IN (%*) DO ( + IF /I {--help}=={%%a} ( + IF EXIST "%SCRIPT_DIRECTORY%.sis\script_info_lines.txt" ( + + type "%SCRIPT_DIRECTORY%.sis\script_info_lines.txt" + ) + ECHO ^ + +Runs all ^(matching^) unit-test and/or component-test programs ^ + +^ + +%SCRIPT_PATH_DOC% [ ... flags/options ... ] ^ + +^ + +Flags/options: ^ + + behaviour: ^ + +^ + + -l ^ + + --list-only ^ + + lists the target programs but does not execute them ^ + +^ + + -M ^ + + --no-make ^ + + accepted for parity with the .sh script ^(build is not invoked^) ^ + +^ + + --unit-only ^ + + runs only unit-test programs ^(test.unit.* / test_unit*^) ^ + +^ + + --component-only ^ + + runs only component-test programs ^(test.component.* / test_component*^) ^ + +^ + + -v ^ + + --verbose ^ + + lists each test program before executing it ^ + +^ + + standard flags: ^ + +^ + + --help ^ + + displays this help and terminates ^ + + + EXIT /B 0 + ) ELSE IF /I {-l}=={%%a} ( + SET ListOnly=1 + ) ELSE IF /I {--list-only}=={%%a} ( + SET ListOnly=1 + ) ELSE IF /I {-M}=={%%a} ( + REM no-op: this .cmd never invokes the build + ) ELSE IF /I {--no-make}=={%%a} ( + REM no-op: this .cmd never invokes the build + ) ELSE IF /I {--unit-only}=={%%a} ( + SET UnitOnly=1 + ) ELSE IF /I {--component-only}=={%%a} ( + SET ComponentOnly=1 + ) ELSE IF /I {-v}=={%%a} ( + SET Verbose=1 + ) ELSE IF /I {--verbose}=={%%a} ( + SET Verbose=1 + ) ELSE ( + ECHO %SCRIPT_PATH_DOC%: unrecognised argument '%%a'; use --help for usage 1>&2 + + EXIT /B 1 + ) +) + +IF !UnitOnly! EQU 1 IF !ComponentOnly! EQU 1 ( + + ECHO %SCRIPT_PATH_DOC%: --unit-only and --component-only are mutually exclusive 1>&2 + + EXIT /B 1 +) + +IF NOT EXIST "%CMAKE_DIR%" ( + + ECHO %SCRIPT_PATH_DOC%: CMake build directory '%CMAKE_DIR%' does not exist 1>&2 + + EXIT /B 1 +) + +SET "ProjectName=" +FOR /F "usebackq delims=" %%p IN ("%SCRIPT_DIRECTORY%.sis\project_name.txt") DO SET "ProjectName=%%p" + +IF NOT DEFINED ProjectName ( + + ECHO %SCRIPT_PATH_DOC%: could not read project name from .sis\project_name.txt 1>&2 + + EXIT /B 1 +) + +IF !UnitOnly! EQU 1 ( + + SET "TestKindDescription=unit test" +) ELSE IF !ComponentOnly! EQU 1 ( + + SET "TestKindDescription=component test" +) ELSE ( + + SET "TestKindDescription=component and unit test" +) + +IF !ListOnly! EQU 1 ( + + ECHO Listing all !ProjectName! !TestKindDescription! programs +) ELSE ( + + ECHO Running all !ProjectName! !TestKindDescription! programs +) + +IF !UnitOnly! EQU 1 ( + + SET "FindPattern=test\.unit\..*\.exe$" +) ELSE IF !ComponentOnly! EQU 1 ( + + SET "FindPattern=test\.component\..*\.exe$" +) ELSE ( + + SET "FindPattern=test\.unit\..*\.exe$ test\.component\..*\.exe$" +) + +FOR /F "usebackq delims=" %%f IN (`DIR /A:-D /B /S "%CMAKE_DIR%\*.exe" 2^>NUL ^| FINDSTR /I /R "!FindPattern!"`) DO ( + IF !ListOnly! EQU 1 ( + + ECHO would execute %%f: + ) ELSE ( + + IF !Verbose! EQU 1 ( + + ECHO executing %%f: + ) + + "%%f" + IF ERRORLEVEL 1 ( + + SET status=1 + + GOTO :done + ) + ) +) + +:done +EXIT /B !status! diff --git a/src/atexit.api.c b/src/atexit.api.c index 65d9b2d..6c72c30 100644 --- a/src/atexit.api.c +++ b/src/atexit.api.c @@ -4,7 +4,7 @@ * Purpose: Implementation file for Pantheios.Extras.AtExit * * Created: 30th December 2011 - * Updated: 16th August 2026 + * Updated: 31st August 2026 * * Home: http://www.pantheios.org/ * @@ -72,7 +72,7 @@ typedef int pantheios_extras_atexit_atomic_int_t; # include typedef atomic_int pantheios_extras_atexit_atomic_int_t; # define PANTHEIOS_EXTRAS_ATEXIT_ATOMIC_INC_(p) (atomic_fetch_add((p), 1) + 1) -# define PANTHEIOS_EXTRAS_ATEXIT_ATOMIC_DEC_(p) (atomic_fetch_sub((p), 1) - 1) +# define PANTHEIOS_EXTRAS_ATEXIT_ATOMIC_DEC_(p) ((void)atomic_fetch_sub((p), 1)) #elif defined(__GNUC__) || defined(__clang__) typedef int pantheios_extras_atexit_atomic_int_t; # define PANTHEIOS_EXTRAS_ATEXIT_ATOMIC_INC_(p) __sync_add_and_fetch((p), 1) @@ -248,3 +248,4 @@ pantheios_extras_atexit_log_string_( } /* ///////////////////////////// end of file //////////////////////////// */ + diff --git a/test/scratch/test.scratch.atexit/CMakeLists.txt b/test/scratch/test.scratch.atexit/CMakeLists.txt index 91d1d67..67169b4 100644 --- a/test/scratch/test.scratch.atexit/CMakeLists.txt +++ b/test/scratch/test.scratch.atexit/CMakeLists.txt @@ -1 +1 @@ -define_example_program(test.scratch.atexit test.scratch.atexit.c) +define_example_program(test.scratch.atexit main.c) diff --git a/test/scratch/test.scratch.atexit/test.scratch.atexit.c b/test/scratch/test.scratch.atexit/main.c similarity index 78% rename from test/scratch/test.scratch.atexit/test.scratch.atexit.c rename to test/scratch/test.scratch.atexit/main.c index 92db08f..e81da3b 100644 --- a/test/scratch/test.scratch.atexit/test.scratch.atexit.c +++ b/test/scratch/test.scratch.atexit/main.c @@ -1,10 +1,10 @@ /* ///////////////////////////////////////////////////////////////////////// - * File: test.scratch.atexit.c + * File: main.c * * Purpose: Scratch test for Pantheios.Extras.AtExit. * * Created: 30th December 2011 - * Updated: 16th August 2026 + * Updated: 21st August 2026 * * ////////////////////////////////////////////////////////////////////// */ @@ -30,10 +30,18 @@ main(void) if (0 != r) { +#ifdef _MSC_VER + char error_message[256]; + + strerror_s(error_message, sizeof(error_message), r); +#else + char const* error_message = strerror(r); +#endif + fprintf( stderr , "failed to initialise Pantheios.Extras.AtExit : %s (%d)\n" - , strerror(r) + , error_message , r ); diff --git a/test/unit/test.unit.atexit.api/test.unit.atexit.api.c b/test/unit/test.unit.atexit.api/test.unit.atexit.api.c index 2c8b6f6..e844c5a 100644 --- a/test/unit/test.unit.atexit.api/test.unit.atexit.api.c +++ b/test/unit/test.unit.atexit.api/test.unit.atexit.api.c @@ -100,7 +100,7 @@ test_init_after_uninit_fails(void) int -main(int argc, char** argv) +main(int argc, char* argv[]) { int retCode = EXIT_SUCCESS; int verbosity = 2; @@ -128,3 +128,4 @@ main(int argc, char** argv) /* ///////////////////////////// end of file //////////////////////////// */ +