@@ -0,0 +1,20 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#ifndef NO_RETURN_ATTR
|
||||
#ifdef __GNUC__
|
||||
#define NO_RETURN_ATTR __attribute__ ((noreturn))
|
||||
#else // __GNUC__
|
||||
#define NO_RETURN_ATTR
|
||||
#endif // __GNUC__
|
||||
#endif // NO_RETURN_ATTR
|
||||
|
||||
|
||||
typedef struct Example {
|
||||
void (*f)(uintptr_t, uintptr_t) NO_RETURN_ATTR;
|
||||
} Example;
|
||||
|
||||
void loop_forever(void) NO_RETURN_ATTR;
|
||||
|
||||
uint8_t normal_return(struct Example arg, void (*other)(uint8_t) NO_RETURN_ATTR);
|
||||
@@ -0,0 +1,28 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#ifndef NO_RETURN_ATTR
|
||||
#ifdef __GNUC__
|
||||
#define NO_RETURN_ATTR __attribute__ ((noreturn))
|
||||
#else // __GNUC__
|
||||
#define NO_RETURN_ATTR
|
||||
#endif // __GNUC__
|
||||
#endif // NO_RETURN_ATTR
|
||||
|
||||
|
||||
typedef struct Example {
|
||||
void (*f)(uintptr_t, uintptr_t) NO_RETURN_ATTR;
|
||||
} Example;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif // __cplusplus
|
||||
|
||||
void loop_forever(void) NO_RETURN_ATTR;
|
||||
|
||||
uint8_t normal_return(struct Example arg, void (*other)(uint8_t) NO_RETURN_ATTR);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif // __cplusplus
|
||||
@@ -11,6 +11,10 @@
|
||||
#endif // NO_RETURN_ATTR
|
||||
|
||||
|
||||
typedef struct {
|
||||
void (*f)(uintptr_t, uintptr_t) NO_RETURN_ATTR;
|
||||
} Example;
|
||||
|
||||
void loop_forever(void) NO_RETURN_ATTR;
|
||||
|
||||
uint8_t normal_return(void);
|
||||
uint8_t normal_return(Example arg, void (*other)(uint8_t) NO_RETURN_ATTR);
|
||||
|
||||
@@ -11,13 +11,17 @@
|
||||
#endif // NO_RETURN_ATTR
|
||||
|
||||
|
||||
typedef struct {
|
||||
void (*f)(uintptr_t, uintptr_t) NO_RETURN_ATTR;
|
||||
} Example;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif // __cplusplus
|
||||
|
||||
void loop_forever(void) NO_RETURN_ATTR;
|
||||
|
||||
uint8_t normal_return(void);
|
||||
uint8_t normal_return(Example arg, void (*other)(uint8_t) NO_RETURN_ATTR);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
|
||||
@@ -12,10 +12,14 @@
|
||||
#endif // NO_RETURN_ATTR
|
||||
|
||||
|
||||
struct Example {
|
||||
void (*f)(uintptr_t, uintptr_t) NO_RETURN_ATTR;
|
||||
};
|
||||
|
||||
extern "C" {
|
||||
|
||||
void loop_forever() NO_RETURN_ATTR;
|
||||
|
||||
uint8_t normal_return();
|
||||
uint8_t normal_return(Example arg, void (*other)(uint8_t) NO_RETURN_ATTR);
|
||||
|
||||
} // extern "C"
|
||||
|
||||
@@ -14,6 +14,9 @@ cdef extern from *:
|
||||
|
||||
cdef extern from *:
|
||||
|
||||
ctypedef struct Example:
|
||||
void (*f)(uintptr_t, uintptr_t);
|
||||
|
||||
void loop_forever();
|
||||
|
||||
uint8_t normal_return();
|
||||
uint8_t normal_return(Example arg, void (*other)(uint8_t));
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#ifndef NO_RETURN_ATTR
|
||||
#ifdef __GNUC__
|
||||
#define NO_RETURN_ATTR __attribute__ ((noreturn))
|
||||
#else // __GNUC__
|
||||
#define NO_RETURN_ATTR
|
||||
#endif // __GNUC__
|
||||
#endif // NO_RETURN_ATTR
|
||||
|
||||
|
||||
struct Example {
|
||||
void (*f)(uintptr_t, uintptr_t) NO_RETURN_ATTR;
|
||||
};
|
||||
|
||||
void loop_forever(void) NO_RETURN_ATTR;
|
||||
|
||||
uint8_t normal_return(struct Example arg, void (*other)(uint8_t) NO_RETURN_ATTR);
|
||||
@@ -0,0 +1,28 @@
|
||||
#include <stdarg.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
#ifndef NO_RETURN_ATTR
|
||||
#ifdef __GNUC__
|
||||
#define NO_RETURN_ATTR __attribute__ ((noreturn))
|
||||
#else // __GNUC__
|
||||
#define NO_RETURN_ATTR
|
||||
#endif // __GNUC__
|
||||
#endif // NO_RETURN_ATTR
|
||||
|
||||
|
||||
struct Example {
|
||||
void (*f)(uintptr_t, uintptr_t) NO_RETURN_ATTR;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif // __cplusplus
|
||||
|
||||
void loop_forever(void) NO_RETURN_ATTR;
|
||||
|
||||
uint8_t normal_return(struct Example arg, void (*other)(uint8_t) NO_RETURN_ATTR);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif // __cplusplus
|
||||
@@ -0,0 +1,22 @@
|
||||
from libc.stdint cimport int8_t, int16_t, int32_t, int64_t, intptr_t
|
||||
from libc.stdint cimport uint8_t, uint16_t, uint32_t, uint64_t, uintptr_t
|
||||
cdef extern from *:
|
||||
ctypedef bint bool
|
||||
ctypedef struct va_list
|
||||
#ifndef NO_RETURN_ATTR
|
||||
#ifdef __GNUC__
|
||||
#define NO_RETURN_ATTR __attribute__ ((noreturn))
|
||||
#else // __GNUC__
|
||||
#define NO_RETURN_ATTR
|
||||
#endif // __GNUC__
|
||||
#endif // NO_RETURN_ATTR
|
||||
|
||||
|
||||
cdef extern from *:
|
||||
|
||||
cdef struct Example:
|
||||
void (*f)(uintptr_t, uintptr_t);
|
||||
|
||||
void loop_forever();
|
||||
|
||||
uint8_t normal_return(Example arg, void (*other)(uint8_t));
|
||||
@@ -1,9 +1,14 @@
|
||||
#[no_mangle]
|
||||
pub extern fn loop_forever() -> ! {
|
||||
pub extern "C" fn loop_forever() -> ! {
|
||||
loop {}
|
||||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern fn normal_return() -> u8 {
|
||||
pub extern "C" fn normal_return(arg: Example, other: extern "C" fn(u8) -> !) -> u8 {
|
||||
0
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
pub struct Example {
|
||||
pub f: extern "C" fn(usize, usize) -> !,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user