There were still struct fields and defines conditionally enabled.
Change return from ggml_last_error_msg to be const. Cast returning error msg buffer to avoid a compiler warning.
This commit is contained in:
parent
7523107877
commit
30b2b3d655
2 changed files with 4 additions and 6 deletions
6
ggml.c
6
ggml.c
|
@ -4245,10 +4245,8 @@ struct ggml_context {
|
||||||
|
|
||||||
struct ggml_scratch scratch;
|
struct ggml_scratch scratch;
|
||||||
struct ggml_scratch scratch_save;
|
struct ggml_scratch scratch_save;
|
||||||
#ifdef GGML_RECOVERABLE_ERRORS
|
|
||||||
enum ggml_errcode last_error_code;
|
enum ggml_errcode last_error_code;
|
||||||
char last_error_msg[GGML_ERROR_BUFFER_LEN];
|
char last_error_msg[GGML_ERROR_BUFFER_LEN];
|
||||||
#endif
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ggml_context_container {
|
struct ggml_context_container {
|
||||||
|
@ -4638,8 +4636,8 @@ enum ggml_errcode ggml_last_error_code(struct ggml_context * ctx) {
|
||||||
return ctx->last_error_code;
|
return ctx->last_error_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
char * ggml_last_error_msg(struct ggml_context * ctx) {
|
const char * ggml_last_error_msg(struct ggml_context * ctx) {
|
||||||
return ctx->last_error_code == GGML_ERRCODE_SUCCESS ? "Success" : &ctx->last_error_msg;
|
return ctx->last_error_code == GGML_ERRCODE_SUCCESS ? "Success" : (const char *)&ctx->last_error_msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
4
ggml.h
4
ggml.h
|
@ -206,6 +206,7 @@
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#define GGML_RECOVERABLE_ERRORS
|
#define GGML_RECOVERABLE_ERRORS
|
||||||
|
#define GGML_ERROR_BUFFER_LEN 256
|
||||||
#ifndef GGML_RECOVERABLE_ERRORS
|
#ifndef GGML_RECOVERABLE_ERRORS
|
||||||
#define GGML_RECOVERABLE_ASSERT(_ctx, _code, x, ...) \
|
#define GGML_RECOVERABLE_ASSERT(_ctx, _code, x, ...) \
|
||||||
do { \
|
do { \
|
||||||
|
@ -217,7 +218,6 @@
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
#else
|
#else
|
||||||
#define GGML_ERROR_BUFFER_LEN 256
|
|
||||||
#define GGML_RECOVERABLE_ASSERT(ctx, errcode, x, ...) \
|
#define GGML_RECOVERABLE_ASSERT(ctx, errcode, x, ...) \
|
||||||
do { \
|
do { \
|
||||||
if ((ctx)->last_error_code != GGML_ERRCODE_SUCCESS) { \
|
if ((ctx)->last_error_code != GGML_ERRCODE_SUCCESS) { \
|
||||||
|
@ -468,7 +468,7 @@ extern "C" {
|
||||||
// struct ggml_context * ctx);
|
// struct ggml_context * ctx);
|
||||||
GGML_API enum ggml_errcode ggml_last_error_code(
|
GGML_API enum ggml_errcode ggml_last_error_code(
|
||||||
struct ggml_context * ctx);
|
struct ggml_context * ctx);
|
||||||
GGML_API char * ggml_last_error_msg(
|
GGML_API const char * ggml_last_error_msg(
|
||||||
struct ggml_context * ctx);
|
struct ggml_context * ctx);
|
||||||
|
|
||||||
GGML_API struct ggml_tensor * ggml_new_tensor(
|
GGML_API struct ggml_tensor * ggml_new_tensor(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue