From 77f77ebe7ff25007ca75437bbf2db86f58061246 Mon Sep 17 00:00:00 2001 From: Julian Nguyen <109386615+juliannguyen4@users.noreply.github.com> Date: Tue, 15 Jul 2025 14:58:30 -0700 Subject: [PATCH 1/2] Use Winline flag --- setup.py | 1 + 1 file changed, 1 insertion(+) diff --git a/setup.py b/setup.py index 4298d9e307..db561afc3b 100644 --- a/setup.py +++ b/setup.py @@ -68,6 +68,7 @@ ['/usr/local/opt/openssl/include'] + \ ['aerospike-client-c/modules/common/src/include'] extra_compile_args = [ + '-Winline', '-std=gnu99', '-g', '-Wall', '-fPIC', '-DDEBUG', '-O1', '-fno-common', '-fno-strict-aliasing', '-D_FILE_OFFSET_BITS=64', '-D_REENTRANT', From 1a8f8320c97da1341c8556f23bfc4287fb578003 Mon Sep 17 00:00:00 2001 From: Julian Nguyen <109386615+juliannguyen4@users.noreply.github.com> Date: Tue, 27 Jan 2026 20:55:28 -0800 Subject: [PATCH 2/2] Fix --- src/include/macros.h | 37 +++---------------------------------- src/main/exception.c | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 34 deletions(-) diff --git a/src/include/macros.h b/src/include/macros.h index e7be3f0610..b86baf3341 100644 --- a/src/include/macros.h +++ b/src/include/macros.h @@ -23,40 +23,9 @@ #include // Cannot use multi-line macro because it cannot return a value. -static inline as_status -as_error_set_or_prepend_helper(as_error *err, as_status code, const char *fmt, - const char *func, const char *file, - uint32_t line, ...) -{ - if (!fmt) { - err->code = code; - goto RETURN_EARLY; - } - - va_list ap; - va_start(ap, line); - - char err_msg_to_prepend[AS_ERROR_MESSAGE_MAX_SIZE]; - vsnprintf(err_msg_to_prepend, AS_ERROR_MESSAGE_MAX_SIZE, fmt, ap); - - // Prepend our new error message to the existing one. - char orig_err_msg[AS_ERROR_MESSAGE_MAX_SIZE]; - strncpy(orig_err_msg, err->message, AS_ERROR_MESSAGE_MAX_LEN); - // Handles edge case where max number of chars is copied (without null terminator) - orig_err_msg[AS_ERROR_MESSAGE_MAX_LEN] = '\0'; - - as_error_setall(err, code, err_msg_to_prepend, func, file, line); - - if (strlen(orig_err_msg)) { - as_error_append(err, " -> "); - as_error_append(err, orig_err_msg); - } - - va_end(ap); - -RETURN_EARLY: - return code; -} +as_status as_error_set_or_prepend_helper(as_error *err, as_status code, + const char *fmt, const char *func, + const char *file, uint32_t line, ...); #undef as_error_update diff --git a/src/main/exception.c b/src/main/exception.c index 866cc56330..c751e413d2 100644 --- a/src/main/exception.c +++ b/src/main/exception.c @@ -26,6 +26,40 @@ #include "exception_types.h" #include "macros.h" +as_status as_error_set_or_prepend_helper(as_error *err, as_status code, + const char *fmt, const char *func, + const char *file, uint32_t line, ...) +{ + if (!fmt) { + err->code = code; + goto RETURN_EARLY; + } + + va_list ap; + va_start(ap, line); + + char err_msg_to_prepend[AS_ERROR_MESSAGE_MAX_SIZE]; + vsnprintf(err_msg_to_prepend, AS_ERROR_MESSAGE_MAX_SIZE, fmt, ap); + + // Prepend our new error message to the existing one. + char orig_err_msg[AS_ERROR_MESSAGE_MAX_SIZE]; + strncpy(orig_err_msg, err->message, AS_ERROR_MESSAGE_MAX_LEN); + // Handles edge case where max number of chars is copied (without null terminator) + orig_err_msg[AS_ERROR_MESSAGE_MAX_LEN] = '\0'; + + as_error_setall(err, code, err_msg_to_prepend, func, file, line); + + if (strlen(orig_err_msg)) { + as_error_append(err, " -> "); + as_error_append(err, orig_err_msg); + } + + va_end(ap); + +RETURN_EARLY: + return code; +} + static PyObject *py_exc_module; #define SUBMODULE_NAME "exception"