Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ User code includes `stackman.h`. The library implementation includes
`stackman_impl.h` once. `platforms/platform.h` selects
`switch_<abi>_<compiler>`.

`STACKMAN_HAVE_CALL` and `STACKMAN_STACK_ALIGN` must be visible from a
normal `#include "stackman.h"`. If they sit under
`#ifdef STACKMAN_SWITCH_IMPL`, `tests/test.c` compiles `stackman_call`
out and CI looks green.
`STACKMAN_STACK_ALIGN` must be visible from a normal
`#include "stackman.h"`. If it sits under `#ifdef STACKMAN_SWITCH_IMPL`,
`stackman.h` leaves it at 4. `stackman_call` is part of every supported
ABI, and `test_04` and `test_05` always build.

Align a stack with `STACKMAN_SP_ALIGN`. It follows `STACKMAN_STACK_ALIGN`
and the stack direction.
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

Scheduled for 1.4.0. This does not belong in a 1.3.x patch.

### Removed
- `STACKMAN_HAVE_CALL`. Every supported ABI provides `stackman_call`, so `test_04` and `test_05` always build. Callers that branched on the macro can call `stackman_call` directly. `STACKMAN_STACK_ALIGN` is unchanged.

## [1.3.0] - 2026-10-15

### Added
Expand Down
3 changes: 1 addition & 2 deletions stackman/platforms/switch_aarch64_gcc.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@
#endif
#endif

#ifndef STACKMAN_HAVE_CALL
#define STACKMAN_HAVE_CALL 1
#ifndef STACKMAN_STACK_ALIGN
#define STACKMAN_STACK_ALIGN 16
#endif

Expand Down
1 change: 0 additions & 1 deletion stackman/platforms/switch_arm64_msvc.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@
*/
#ifndef STACKMAN_ASSEMBLY_SRC
#define STACKMAN_ASSEMBLY_SRC switch_arm64_msvc.asm
#define STACKMAN_HAVE_CALL 1
#define STACKMAN_STACK_ALIGN 16
#endif
3 changes: 1 addition & 2 deletions stackman/platforms/switch_arm_gcc.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
#endif
#endif

#ifndef STACKMAN_HAVE_CALL
#define STACKMAN_HAVE_CALL 1
#ifndef STACKMAN_STACK_ALIGN
#define STACKMAN_STACK_ALIGN 8
#endif

Expand Down
3 changes: 1 addition & 2 deletions stackman/platforms/switch_armhf_gcc.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@
#endif
#endif

#ifndef STACKMAN_HAVE_CALL
#define STACKMAN_HAVE_CALL 1
#ifndef STACKMAN_STACK_ALIGN
#define STACKMAN_STACK_ALIGN 8
#endif

Expand Down
9 changes: 3 additions & 6 deletions stackman/platforms/switch_riscv64_gcc.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,9 @@
#define STACKMAN_ASSEMBLY_SRC "platforms/switch_riscv64_gcc.S"
#endif

/* Visible to tests and other callers of stackman.h, not only to the
* translation unit that defines STACKMAN_SWITCH_IMPL. stackman.h
* otherwise leaves STACKMAN_STACK_ALIGN at 4 and tests/test.c compiles
* out test_04 and test_05. */
#ifndef STACKMAN_HAVE_CALL
#define STACKMAN_HAVE_CALL 1
/* Visible from a normal #include "stackman.h". stackman.h otherwise
* leaves STACKMAN_STACK_ALIGN at 4. */
#ifndef STACKMAN_STACK_ALIGN
#define STACKMAN_STACK_ALIGN 16
#endif

Expand Down
1 change: 0 additions & 1 deletion stackman/platforms/switch_x64_msvc.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,5 @@
*/
#ifndef STACKMAN_ASSEMBLY_SRC
#define STACKMAN_ASSEMBLY_SRC switch_x64_msvc.asm
#define STACKMAN_HAVE_CALL 1
#define STACKMAN_STACK_ALIGN 16
#endif
3 changes: 1 addition & 2 deletions stackman/platforms/switch_x86_64_gcc.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
#endif
#endif

#ifndef STACKMAN_HAVE_CALL
#define STACKMAN_HAVE_CALL 1
#ifndef STACKMAN_STACK_ALIGN
#define STACKMAN_STACK_ALIGN 16
#endif

Expand Down
3 changes: 1 addition & 2 deletions stackman/platforms/switch_x86_gcc.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
#endif
#endif

#ifndef STACKMAN_HAVE_CALL
#define STACKMAN_HAVE_CALL 1
#ifndef STACKMAN_STACK_ALIGN
#define STACKMAN_STACK_ALIGN 16
#endif

Expand Down
1 change: 0 additions & 1 deletion stackman/platforms/switch_x86_msvc.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
#if !defined(STACKMAN_ASSEMBLY_SRC)
#define STACKMAN_ASSEMBLY_SRC switch_x86_msvc.asm
#define STACKMAN_SWITCH_C 1 /* contains a C implementation */
#define STACKMAN_HAVE_CALL 1
#define STACKMAN_STACK_ALIGN 4
#endif

Expand Down
8 changes: 0 additions & 8 deletions tests/test.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,10 +241,6 @@ void test_03(void *stack_marker)
}


#if defined(STACKMAN_HAVE_CALL)
#define TEST_04
#endif
#ifdef TEST_04
/* Sentinel returned by stackman_call. The epilogue must leave it intact. */
static void *const stackman_call_result = (void *)(intptr_t)0x1234;

Expand Down Expand Up @@ -347,8 +343,6 @@ void test_05(void)
assert(STACKMAN_SP_LE(ctxt.sp[1], &ctxt));
}

#endif

/* Test our various macros */
void test_06()
{
Expand Down Expand Up @@ -624,14 +618,12 @@ int main(int argc, char*argv[])
test_enter("test_03");
test_03((void*)&stack_marker);
printf("test_03 ok\n");
#ifdef TEST_04
test_enter("test_04");
test_04();
printf("test_04 ok\n");
test_enter("test_05");
test_05();
printf("test_05 ok\n");
#endif
test_enter("test_06");
test_06();
printf("test_06 ok\n");
Expand Down
Loading