Skip to content

Commit 127ef00

Browse files
authored
flambda-backend: Port "Cause a C warning when CAMLreturn is missing in C stubs" to the 5 runtime (#2102)
1 parent cbbe49f commit 127ef00

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

runtime/caml/memory.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -274,6 +274,7 @@ struct caml__roots_block {
274274
*/
275275

276276
#define CAMLparam0() \
277+
int caml__missing_CAMLreturn = 0; \
277278
struct caml__roots_block** caml_local_roots_ptr = \
278279
(DO_CHECK_CAML_STATE ? Caml_check_caml_state() : (void)0, \
279280
&CAML_LOCAL_ROOTS); \
@@ -408,6 +409,7 @@ struct caml__roots_block {
408409
}
409410

410411
#define CAMLdrop do{ \
412+
(void)caml__missing_CAMLreturn; \
411413
*caml_local_roots_ptr = caml__frame; \
412414
}while (0)
413415

@@ -424,7 +426,7 @@ struct caml__roots_block {
424426

425427
#define CAMLreturn(result) CAMLreturnT(value, result)
426428

427-
#define CAMLnoreturn ((void) caml__frame)
429+
#define CAMLnoreturn ((void) caml__missing_CAMLreturn, (void) caml__frame)
428430

429431

430432
/* convenience macro */

0 commit comments

Comments
 (0)