From 788ed9f8da88395cb27f8612cbfe1f95e8a0b6e0 Mon Sep 17 00:00:00 2001 From: Brian Dickens Date: Sun, 3 Mar 2024 00:24:52 -0500 Subject: [PATCH] Tweak `inline static` => INLINE or `static inline` It doesn't really make a difference, but "best practices" favor you writing `static inline` over `inline static`. It also turns out that just inline is only visible from within a translation unit unless it's explicitly marked extern, so the INLINE macro (which in C++ resolves to inline) is as good as static inline. So using the macro is fine. This makes the change where it makes sense. Also fixes an accidental change to use the INLINE macro in libuv files. --- extensions/crypt/mod-crypt.c | 2 +- extensions/filesystem/file-req.h | 2 +- .../filesystem/libuv/src/win/fs-fd-hash-inl.h | 8 ++--- extensions/filesystem/libuv/src/win/fs.c | 24 ++++++------- .../filesystem/libuv/src/win/handle-inl.h | 6 ++-- extensions/filesystem/libuv/src/win/req-inl.h | 6 ++-- .../filesystem/libuv/src/win/stream-inl.h | 4 +-- extensions/filesystem/mod-filesystem.c | 2 +- extensions/filesystem/p-file.c | 2 +- extensions/javascript/mod-javascript.c | 16 ++++----- extensions/network/reb-net.h | 2 +- extensions/process/call-posix.c | 8 ++--- extensions/process/reb-process.h | 6 ++-- extensions/stdio/readline-posix.c | 6 ++-- extensions/stdio/readline-windows.c | 4 +-- src/core/a-lib.c | 6 ++-- src/core/c-value.c | 4 +-- src/core/evaluator/c-eval.c | 2 +- src/core/f-deci.c | 36 +++++++++---------- src/core/l-scan.c | 6 ++-- src/core/m-gc.c | 10 +++--- src/core/n-math.c | 2 +- src/core/t-logic.c | 4 +-- src/core/t-map.c | 2 +- src/core/t-varargs.c | 4 +-- src/core/t-word.c | 2 +- src/core/u-parse.c | 10 +++--- src/include/assert-fix.h | 4 +-- src/include/structs/struct-node.h | 16 ++++----- tools/make-librebol.r | 6 ++-- 30 files changed, 106 insertions(+), 106 deletions(-) diff --git a/extensions/crypt/mod-crypt.c b/extensions/crypt/mod-crypt.c index e455ee378c..1aeabc75e1 100644 --- a/extensions/crypt/mod-crypt.c +++ b/extensions/crypt/mod-crypt.c @@ -71,7 +71,7 @@ typedef RebolValue Value; // specific errors. But a debug build might want to. For now, one error // (good place to set a breakpoint). // -inline static Value* rebMbedtlsError(int mbedtls_ret) { +INLINE Value* rebMbedtlsError(int mbedtls_ret) { Value* result = rebValue("make error! {mbedTLS error}"); // break here UNUSED(mbedtls_ret); // corrupts mbedtls_ret in release build return result; diff --git a/extensions/filesystem/file-req.h b/extensions/filesystem/file-req.h index e1302dd74a..462bcdbaba 100644 --- a/extensions/filesystem/file-req.h +++ b/extensions/filesystem/file-req.h @@ -109,7 +109,7 @@ struct Reb_File_Port_State { typedef struct Reb_File_Port_State FILEREQ; -inline static FILEREQ *File_Of_Port(const Value* port) +INLINE FILEREQ *File_Of_Port(const Value* port) { Value* state = CTX_VAR(VAL_CONTEXT(port), STD_PORT_STATE); return cast(FILEREQ*, Cell_Binary_At_Ensure_Mutable(state)); diff --git a/extensions/filesystem/libuv/src/win/fs-fd-hash-inl.h b/extensions/filesystem/libuv/src/win/fs-fd-hash-inl.h index 0b532af12d..b84cc862cc 100644 --- a/extensions/filesystem/libuv/src/win/fs-fd-hash-inl.h +++ b/extensions/filesystem/libuv/src/win/fs-fd-hash-inl.h @@ -73,7 +73,7 @@ static struct uv__fd_hash_entry_group_s static struct uv__fd_hash_bucket_s uv__fd_hash[UV__FD_HASH_SIZE]; -INLINE static void uv__fd_hash_init(void) { +inline static void uv__fd_hash_init(void) { size_t i; int err; @@ -119,7 +119,7 @@ INLINE static void uv__fd_hash_init(void) { FIND_IN_GROUP_PTR(UV__FD_HASH_GROUP_SIZE); \ } while (0) -INLINE static int uv__fd_hash_get(int fd, struct uv__fd_info_s* info) { +inline static int uv__fd_hash_get(int fd, struct uv__fd_info_s* info) { FIND_COMMON_VARIABLES uv_mutex_lock(&uv__fd_hash_mutex); @@ -134,7 +134,7 @@ INLINE static int uv__fd_hash_get(int fd, struct uv__fd_info_s* info) { return entry_ptr != NULL; } -INLINE static void uv__fd_hash_add(int fd, struct uv__fd_info_s* info) { +inline static void uv__fd_hash_add(int fd, struct uv__fd_info_s* info) { FIND_COMMON_VARIABLES uv_mutex_lock(&uv__fd_hash_mutex); @@ -164,7 +164,7 @@ INLINE static void uv__fd_hash_add(int fd, struct uv__fd_info_s* info) { uv_mutex_unlock(&uv__fd_hash_mutex); } -INLINE static int uv__fd_hash_remove(int fd, struct uv__fd_info_s* info) { +inline static int uv__fd_hash_remove(int fd, struct uv__fd_info_s* info) { FIND_COMMON_VARIABLES uv_mutex_lock(&uv__fd_hash_mutex); diff --git a/extensions/filesystem/libuv/src/win/fs.c b/extensions/filesystem/libuv/src/win/fs.c index 792307995f..11bc2febc1 100644 --- a/extensions/filesystem/libuv/src/win/fs.c +++ b/extensions/filesystem/libuv/src/win/fs.c @@ -142,7 +142,7 @@ void uv__fs_init(void) { } -INLINE static int fs__capture_path(uv_fs_t* req, const char* path, +inline static int fs__capture_path(uv_fs_t* req, const char* path, const char* new_path, const int copy_path) { char* buf; char* pos; @@ -241,7 +241,7 @@ INLINE static int fs__capture_path(uv_fs_t* req, const char* path, -INLINE static void uv__fs_req_init(uv_loop_t* loop, uv_fs_t* req, +inline static void uv__fs_req_init(uv_loop_t* loop, uv_fs_t* req, uv_fs_type fs_type, const uv_fs_cb cb) { uv__once_init(); UV_REQ_INIT(req, UV_FS); @@ -306,7 +306,7 @@ static int fs__wide_to_utf8(WCHAR* w_source_ptr, } -INLINE static int fs__readlink_handle(HANDLE handle, char** target_ptr, +inline static int fs__readlink_handle(HANDLE handle, char** target_ptr, uint64_t* target_len_ptr) { char buffer[MAXIMUM_REPARSE_DATA_BUFFER_SIZE]; REPARSE_DATA_BUFFER* reparse_data = (REPARSE_DATA_BUFFER*) buffer; @@ -1248,7 +1248,7 @@ void fs__mktemp(uv_fs_t* req, uv__fs_mktemp_func func) { size_t len; uint64_t v; char* path; - + path = (char*)req->path; len = wcslen(req->file.pathw); ep = req->file.pathw + len; @@ -1704,7 +1704,7 @@ void fs__closedir(uv_fs_t* req) { SET_REQ_RESULT(req, 0); } -INLINE static int fs__stat_handle(HANDLE handle, uv_stat_t* statbuf, +inline static int fs__stat_handle(HANDLE handle, uv_stat_t* statbuf, int do_lstat) { FILE_ALL_INFORMATION file_info; FILE_FS_VOLUME_INFORMATION volume_info; @@ -1849,7 +1849,7 @@ INLINE static int fs__stat_handle(HANDLE handle, uv_stat_t* statbuf, } -INLINE static void fs__stat_prepare_path(WCHAR* pathw) { +inline static void fs__stat_prepare_path(WCHAR* pathw) { size_t len = wcslen(pathw); /* TODO: ignore namespaced paths. */ @@ -1860,7 +1860,7 @@ INLINE static void fs__stat_prepare_path(WCHAR* pathw) { } -INLINE static DWORD fs__stat_impl_from_path(WCHAR* path, +inline static DWORD fs__stat_impl_from_path(WCHAR* path, int do_lstat, uv_stat_t* statbuf) { HANDLE handle; @@ -1892,7 +1892,7 @@ INLINE static DWORD fs__stat_impl_from_path(WCHAR* path, } -INLINE static void fs__stat_impl(uv_fs_t* req, int do_lstat) { +inline static void fs__stat_impl(uv_fs_t* req, int do_lstat) { DWORD error; error = fs__stat_impl_from_path(req->file.pathw, do_lstat, &req->statbuf); @@ -1960,7 +1960,7 @@ static void fs__rename(uv_fs_t* req) { } -INLINE static void fs__sync_impl(uv_fs_t* req) { +inline static void fs__sync_impl(uv_fs_t* req) { int fd = req->file.fd; int result; @@ -2266,7 +2266,7 @@ static void fs__fchmod(uv_fs_t* req) { } -INLINE static int fs__utime_handle(HANDLE handle, double atime, double mtime) { +inline static int fs__utime_handle(HANDLE handle, double atime, double mtime) { FILETIME filetime_a, filetime_m; TIME_T_TO_FILETIME(atime, &filetime_a); @@ -2279,7 +2279,7 @@ INLINE static int fs__utime_handle(HANDLE handle, double atime, double mtime) { return 0; } -INLINE static DWORD fs__utime_impl_from_path(WCHAR* path, +inline static DWORD fs__utime_impl_from_path(WCHAR* path, double atime, double mtime, int do_lutime) { @@ -2312,7 +2312,7 @@ INLINE static DWORD fs__utime_impl_from_path(WCHAR* path, return ret; } -INLINE static void fs__utime_impl(uv_fs_t* req, int do_lutime) { +inline static void fs__utime_impl(uv_fs_t* req, int do_lutime) { DWORD error; error = fs__utime_impl_from_path(req->file.pathw, diff --git a/extensions/filesystem/libuv/src/win/handle-inl.h b/extensions/filesystem/libuv/src/win/handle-inl.h index 5c843c241e..6a01df0642 100644 --- a/extensions/filesystem/libuv/src/win/handle-inl.h +++ b/extensions/filesystem/libuv/src/win/handle-inl.h @@ -85,7 +85,7 @@ } while (0) -INLINE static void uv__want_endgame(uv_loop_t* loop, uv_handle_t* handle) { +inline static void uv__want_endgame(uv_loop_t* loop, uv_handle_t* handle) { if (!(handle->flags & UV_HANDLE_ENDGAME_QUEUED)) { handle->flags |= UV_HANDLE_ENDGAME_QUEUED; @@ -95,7 +95,7 @@ INLINE static void uv__want_endgame(uv_loop_t* loop, uv_handle_t* handle) { } -INLINE static void uv__process_endgames(uv_loop_t* loop) { +inline static void uv__process_endgames(uv_loop_t* loop) { uv_handle_t* handle; while (loop->endgame_handles) { @@ -163,7 +163,7 @@ INLINE static void uv__process_endgames(uv_loop_t* loop) { } } -INLINE static HANDLE uv__get_osfhandle(int fd) +inline static HANDLE uv__get_osfhandle(int fd) { /* _get_osfhandle() raises an assert in debug builds if the FD is invalid. * But it also correctly checks the FD and returns INVALID_HANDLE_VALUE for diff --git a/extensions/filesystem/libuv/src/win/req-inl.h b/extensions/filesystem/libuv/src/win/req-inl.h index 48760a06bb..6440f8ae8f 100644 --- a/extensions/filesystem/libuv/src/win/req-inl.h +++ b/extensions/filesystem/libuv/src/win/req-inl.h @@ -82,12 +82,12 @@ } -INLINE static uv_req_t* uv__overlapped_to_req(OVERLAPPED* overlapped) { +inline static uv_req_t* uv__overlapped_to_req(OVERLAPPED* overlapped) { return CONTAINING_RECORD(overlapped, uv_req_t, u.io.overlapped); } -INLINE static void uv__insert_pending_req(uv_loop_t* loop, uv_req_t* req) { +inline static void uv__insert_pending_req(uv_loop_t* loop, uv_req_t* req) { req->next_req = NULL; if (loop->pending_reqs_tail) { #ifdef _DEBUG @@ -138,7 +138,7 @@ INLINE static void uv__insert_pending_req(uv_loop_t* loop, uv_req_t* req) { } while (0) -INLINE static void uv__process_reqs(uv_loop_t* loop) { +inline static void uv__process_reqs(uv_loop_t* loop) { uv_req_t* req; uv_req_t* first; uv_req_t* next; diff --git a/extensions/filesystem/libuv/src/win/stream-inl.h b/extensions/filesystem/libuv/src/win/stream-inl.h index 91b1e785da..487dc45ca6 100644 --- a/extensions/filesystem/libuv/src/win/stream-inl.h +++ b/extensions/filesystem/libuv/src/win/stream-inl.h @@ -30,7 +30,7 @@ #include "req-inl.h" -INLINE static void uv__stream_init(uv_loop_t* loop, +inline static void uv__stream_init(uv_loop_t* loop, uv_stream_t* handle, uv_handle_type type) { uv__handle_init(loop, (uv_handle_t*) handle, type); @@ -46,7 +46,7 @@ INLINE static void uv__stream_init(uv_loop_t* loop, } -INLINE static void uv__connection_init(uv_stream_t* handle) { +inline static void uv__connection_init(uv_stream_t* handle) { handle->flags |= UV_HANDLE_CONNECTION; } diff --git a/extensions/filesystem/mod-filesystem.c b/extensions/filesystem/mod-filesystem.c index a07e343169..221de76ce7 100644 --- a/extensions/filesystem/mod-filesystem.c +++ b/extensions/filesystem/mod-filesystem.c @@ -114,7 +114,7 @@ enum { PATH_OPT_SRC_IS_DIR = 1 << 0 }; -inline static bool Last_In_Mold_Is_Slash(REB_MOLD *mo) { +INLINE bool Last_In_Mold_Is_Slash(REB_MOLD *mo) { if (mo->base.size == Series_Used(mo->series)) return false; // nothing added yet diff --git a/extensions/filesystem/p-file.c b/extensions/filesystem/p-file.c index 2ce4e6c1a5..4b12c97cfa 100644 --- a/extensions/filesystem/p-file.c +++ b/extensions/filesystem/p-file.c @@ -86,7 +86,7 @@ extern Value* Rename_File_Or_Directory(const Value* port, const Value* to); extern Value* Truncate_File(const Value* port); -inline static uint64_t File_Size_Cacheable_May_Fail(const Value* port) +INLINE uint64_t File_Size_Cacheable_May_Fail(const Value* port) { uint64_t size; Value* error = Get_File_Size_Cacheable(&size, port); diff --git a/extensions/javascript/mod-javascript.c b/extensions/javascript/mod-javascript.c index 5b3d28e4e5..e3da572d35 100644 --- a/extensions/javascript/mod-javascript.c +++ b/extensions/javascript/mod-javascript.c @@ -113,7 +113,7 @@ static bool PG_JS_Trace = false; // Turned on/off with JS-TRACE native - inline static void Javascript_Trace_Helper_Debug(const char *buf) { + INLINE void Javascript_Trace_Helper_Debug(const char *buf) { if (PG_JS_Trace) { printf("@%ld: %s\n", cast(long, TG_tick), buf); // prefix ticks fflush(stdout); // just to be safe @@ -188,13 +188,13 @@ typedef unsigned int heapaddr_t; -inline static heapaddr_t Heapaddr_From_Pointer(const void *p) { +INLINE heapaddr_t Heapaddr_From_Pointer(const void *p) { uintptr_t u = i_cast(uintptr_t, p); assert(u < UINT_MAX); return u; } -inline static void* Pointer_From_Heapaddr(heapaddr_t addr) +INLINE void* Pointer_From_Heapaddr(heapaddr_t addr) { return p_cast(void*, cast(uintptr_t, addr)); } static void cleanup_js_object(const Value* v) { @@ -228,15 +228,15 @@ static void cleanup_js_object(const Value* v) { // from JavaScript code may only be caught by JavaScript code." // -inline static heapaddr_t Level_Id_For_Level(Level* L) { +INLINE heapaddr_t Level_Id_For_Level(Level* L) { return Heapaddr_From_Pointer(L); } -inline static Level* Level_From_Level_Id(heapaddr_t id) { +INLINE Level* Level_From_Level_Id(heapaddr_t id) { return cast(Level*, Pointer_From_Heapaddr(id)); } -inline static Value* Value_From_Value_Id(heapaddr_t id) { +INLINE Value* Value_From_Value_Id(heapaddr_t id) { if (id == 0) return nullptr; @@ -262,7 +262,7 @@ inline static Value* Value_From_Value_Id(heapaddr_t id) { // was put in that table at the time of creation (the native_id). // -inline static heapaddr_t Native_Id_For_Action(Action* act) +INLINE heapaddr_t Native_Id_For_Action(Action* act) { return Heapaddr_From_Pointer(ACT_IDENTITY(act)); } enum { @@ -972,7 +972,7 @@ DECLARE_NATIVE(js_native) // "Evaluate textual JavaScript code" // // return: "Note: Only supports types that reb.Box() supports" -// [~ ~null~ logic? integer! text!] +// [~ logic? integer! text!] // source "JavaScript code as a text string" [text!] // /local "Evaluate in local scope (as opposed to global)" // /value "Return a Rebol value" diff --git a/extensions/network/reb-net.h b/extensions/network/reb-net.h index c4311d2545..f4be570f90 100644 --- a/extensions/network/reb-net.h +++ b/extensions/network/reb-net.h @@ -69,7 +69,7 @@ struct Reb_Sock_Port_State { typedef struct Reb_Sock_Port_State SOCKREQ; -inline static SOCKREQ *Sock_Of_Port(const Value* port) +INLINE SOCKREQ *Sock_Of_Port(const Value* port) { Value* state = CTX_VAR(VAL_CONTEXT(port), STD_PORT_STATE); return VAL_HANDLE_POINTER(SOCKREQ, state); diff --git a/extensions/process/call-posix.c b/extensions/process/call-posix.c index 8a5dceb08f..c2e4a41154 100644 --- a/extensions/process/call-posix.c +++ b/extensions/process/call-posix.c @@ -61,11 +61,11 @@ #include "reb-process.h" -static inline bool retry_read(int nbytes) { +INLINE bool retry_read(int nbytes) { return nbytes < 0 && (errno == EAGAIN || errno == EINTR); } -static inline ssize_t safe_read(int f, void*b, size_t c) { +INLINE ssize_t safe_read(int f, void*b, size_t c) { read_again: ; ssize_t r = read(f,b,c); if (retry_read(r)) @@ -73,7 +73,7 @@ static inline ssize_t safe_read(int f, void*b, size_t c) { return r; } -inline static bool Open_Pipe_Fails(int pipefd[2]) { +INLINE bool Open_Pipe_Fails(int pipefd[2]) { #ifdef USE_PIPE2_NOT_PIPE // // NOTE: pipe() is POSIX, but pipe2() is Linux-specific. With pipe() it @@ -107,7 +107,7 @@ inline static bool Open_Pipe_Fails(int pipefd[2]) { return false; } -inline static bool Set_Nonblocking_Fails(int fd) { +INLINE bool Set_Nonblocking_Fails(int fd) { int oldflags = fcntl(fd, F_GETFL); if (oldflags < 0) return true; diff --git a/extensions/process/reb-process.h b/extensions/process/reb-process.h index 19d1b0273b..6e4db56fec 100644 --- a/extensions/process/reb-process.h +++ b/extensions/process/reb-process.h @@ -24,12 +24,12 @@ ATTRIBUTE_NO_RETURN -inline static void Fail_Permission_Denied(void) { +INLINE void Fail_Permission_Denied(void) { rebJumps("fail {The process does not have enough permission}"); } ATTRIBUTE_NO_RETURN -inline static void Fail_No_Process(const Value* arg) { +INLINE void Fail_No_Process(const Value* arg) { rebJumps( "fail [{The target process (group) does not exist:}", arg, "]" ); @@ -37,7 +37,7 @@ inline static void Fail_No_Process(const Value* arg) { #if TO_WINDOWS ATTRIBUTE_NO_RETURN - inline static void Fail_Terminate_Failed(DWORD err) { // GetLastError() + INLINE void Fail_Terminate_Failed(DWORD err) { // GetLastError() rebJumps( "fail [{Terminate failed with error number:}", rebI(err), "]" ); diff --git a/extensions/stdio/readline-posix.c b/extensions/stdio/readline-posix.c index 1e5f82cdf9..bcdccc9490 100644 --- a/extensions/stdio/readline-posix.c +++ b/extensions/stdio/readline-posix.c @@ -68,7 +68,7 @@ enum { }; -inline static void WRITE_UTF8(const unsigned char *utf8, size_t size) { +INLINE void WRITE_UTF8(const unsigned char *utf8, size_t size) { if (write(STDOUT_FILENO, utf8, size) == -1) { /* Error here, or better to "just try to keep going"? */ } @@ -98,10 +98,10 @@ struct Reb_Terminal_Struct { static bool Term_Initialized = false; // Terminal init was successful -inline static unsigned int Term_End(STD_TERM *t) +INLINE unsigned int Term_End(STD_TERM *t) { return rebUnboxInteger("length of", t->buffer); } -inline static unsigned int Term_Remain(STD_TERM *t) +INLINE unsigned int Term_Remain(STD_TERM *t) { return Term_End(t) - t->pos; } diff --git a/extensions/stdio/readline-windows.c b/extensions/stdio/readline-windows.c index 760ff13870..035182ac2d 100644 --- a/extensions/stdio/readline-windows.c +++ b/extensions/stdio/readline-windows.c @@ -185,10 +185,10 @@ static void WRITE_UTF8(const unsigned char *utf8, size_t size) static bool Term_Initialized = false; // Terminal init was successful -inline static unsigned int Term_End(STD_TERM *t) +INLINE unsigned int Term_End(STD_TERM *t) { return rebUnboxInteger("length of", t->buffer); } -inline static unsigned int Term_Remain(STD_TERM *t) +INLINE unsigned int Term_Remain(STD_TERM *t) { return Term_End(t) - t->pos; } // Older MSVC installations don't define SetConsoleMode()'s "extended flags" diff --git a/src/core/a-lib.c b/src/core/a-lib.c index dc868c8e2d..7eaea30d31 100644 --- a/src/core/a-lib.c +++ b/src/core/a-lib.c @@ -90,7 +90,7 @@ static bool PG_Api_Initialized = false; // are Is_Api_Value() mustn't be nulled. nullptr is the only currency exposed // to the clients of the API for NULL. // -inline static const RebolValue* NULLIFY_NULLED(const Value* value) { +INLINE const RebolValue* NULLIFY_NULLED(const Value* value) { if (Is_Nulled(value)) return nullptr; return value; @@ -1092,7 +1092,7 @@ static bool Run_Va_Throws( // or use rebElide() and say it doesn't matter. (or just find a way in the // executed code passed to not have it evaluate to nihil) // -inline static void Run_Va_Undecayed_May_Fail_Calls_Va_End( +INLINE void Run_Va_Undecayed_May_Fail_Calls_Va_End( RebolSpecifier** specifier_ref, Atom* out, const void* p, // first pointer (may be END, nullptr means NULLED) @@ -1119,7 +1119,7 @@ inline static void Run_Va_Undecayed_May_Fail_Calls_Va_End( // APIs just as if you'd tried to do a SET-WORD!...so you don't have to worry // about multi-return packs etc. // -inline static void Run_Va_Decay_May_Fail_Calls_Va_End( +INLINE void Run_Va_Decay_May_Fail_Calls_Va_End( RebolSpecifier** specifier_ref, Value* out, const void* p, // first pointer (may be END, nullptr means NULLED) diff --git a/src/core/c-value.c b/src/core/c-value.c index c09aba2910..33948d0264 100644 --- a/src/core/c-value.c +++ b/src/core/c-value.c @@ -116,7 +116,7 @@ ATTRIBUTE_NO_RETURN void Panic_Value_Debug(const Cell* v) { #if DEBUG_HAS_PROBE -inline static void Probe_Print_Helper( +INLINE void Probe_Print_Helper( const void *p, // the Value*, Series*, or UTF-8 char* const char *expr, // stringified contents of the PROBE() macro const char *label, // detected type of `p` (see %rebnod.h) @@ -134,7 +134,7 @@ inline static void Probe_Print_Helper( } -inline static void Probe_Molded_Value(const Value* v) +INLINE void Probe_Molded_Value(const Value* v) { DECLARE_MOLD (mo); Push_Mold(mo); diff --git a/src/core/evaluator/c-eval.c b/src/core/evaluator/c-eval.c index 1dcd86e884..0ce78d9ac2 100644 --- a/src/core/evaluator/c-eval.c +++ b/src/core/evaluator/c-eval.c @@ -144,7 +144,7 @@ STATIC_ASSERT( // an arity-1 function. `1 + x: whatever ...`. This overrides the no // lookahead behavior flag right up front. // -inline static Level* Maybe_Rightward_Continuation_Needed(Level* L) +INLINE Level* Maybe_Rightward_Continuation_Needed(Level* L) { if (Is_Feed_At_End(L->feed)) // `do [x:]`, `do [o.x:]`, etc. are illegal fail (Error_Need_Non_End(L_current)); diff --git a/src/core/f-deci.c b/src/core/f-deci.c index ed50410e29..ffe6856298 100644 --- a/src/core/f-deci.c +++ b/src/core/f-deci.c @@ -65,14 +65,14 @@ static const uint32_t min_int64_t_as_deci[] = {0u, 0x80000000u, 0u}; 0 means a = b; 1 means a > b; */ -inline static int32_t m_cmp(int32_t n, const uint32_t a[], const uint32_t b[]) { +INLINE int32_t m_cmp(int32_t n, const uint32_t a[], const uint32_t b[]) { int32_t i; for (i = n - 1; i >= 0; i--) if (a[i] != b[i]) return a[i] < b[i] ? -1 : 1; return 0; } -inline static bool m_is_zero(int32_t n, const uint32_t a[]) { +INLINE bool m_is_zero(int32_t n, const uint32_t a[]) { int32_t i; for (i = 0; (i < n) and (a[i] == 0); i++) NOOP; @@ -119,7 +119,7 @@ static const uint32_t P26_1[] = {3825205247u, 3704098002u, 5421010u}; Computes max decimal shift left for nonzero significand a with length 3; using double arithmetic; */ -inline static int32_t max_shift_left(const uint32_t a[]) { +INLINE int32_t max_shift_left(const uint32_t a[]) { int32_t i; i = (int32_t)(log10((a[2] * two_to_32 + a[1]) * two_to_32 + a[0]) + 0.5); return m_cmp (3, P[i], a) <= 0 ? 25 - i : 26 - i; @@ -159,7 +159,7 @@ static const uint32_t Q[][6] = { Computes minimal decimal shift right for "double significand" with length 6 to fit length 3, using double arithmetic. */ -inline static int32_t min_shift_right(const uint32_t a[6]) { +INLINE int32_t min_shift_right(const uint32_t a[6]) { int32_t i; if (m_cmp (6, a, P26) < 0) return 0; i = (int32_t) (log10 ( @@ -191,7 +191,7 @@ deci deci_abs(deci a) { a must be "large enough" to contain the sum; using 64-bit arithmetic; */ -inline static void m_add_1(uint32_t *a, const uint32_t b) { +INLINE void m_add_1(uint32_t *a, const uint32_t b) { REBU64 c = (REBU64) b; while (c) { c += (REBU64) *a; @@ -204,7 +204,7 @@ inline static void m_add_1(uint32_t *a, const uint32_t b) { Subtracts unsigned 32-bit value b from significand a; using 64-bit arithmetic; */ -inline static void m_subtract_1(uint32_t *a, const uint32_t b) { +INLINE void m_subtract_1(uint32_t *a, const uint32_t b) { REBI64 c = - (REBI64) b; while (c) { c += 0xffffffffu + (REBI64)*a + 1; @@ -217,7 +217,7 @@ inline static void m_subtract_1(uint32_t *a, const uint32_t b) { Adds significand b to significand a yielding sum s; using 64-bit arithmetic; */ -inline static void m_add(int32_t n, uint32_t s[], const uint32_t a[], const uint32_t b[]) { +INLINE void m_add(int32_t n, uint32_t s[], const uint32_t a[], const uint32_t b[]) { REBU64 c = (REBU64) 0; int32_t i; for (i = 0; i < n; i++) { @@ -233,7 +233,7 @@ inline static void m_add(int32_t n, uint32_t s[], const uint32_t a[], const uint returns carry flag to signal whether the result is negative; using 64-bit arithmetic; */ -inline static int32_t m_subtract( +INLINE int32_t m_subtract( int32_t n, uint32_t d[], const uint32_t a[], @@ -253,7 +253,7 @@ inline static int32_t m_subtract( Negates significand a; using 64-bit arithmetic; */ -inline static void m_negate(int32_t n, uint32_t a[]) { +INLINE void m_negate(int32_t n, uint32_t a[]) { REBU64 c = (REBU64) 1; int32_t i; for (i = 0; i < n; i++) { @@ -268,7 +268,7 @@ inline static void m_negate(int32_t n, uint32_t a[]) { p and a may be the same; using 64-bit arithmetic; */ -inline static void m_multiply_1(int32_t n, uint32_t p[], const uint32_t a[], uint32_t b) { +INLINE void m_multiply_1(int32_t n, uint32_t p[], const uint32_t a[], uint32_t b) { int32_t j; REBU64 f = b, g = (REBU64) 0; for (j = 0; j < n; j++) { @@ -284,7 +284,7 @@ inline static void m_multiply_1(int32_t n, uint32_t p[], const uint32_t a[], uin a must be longer than the complete result; n is the initial length of a; */ -inline static void dsl(int32_t n, uint32_t a[], int32_t shift) { +INLINE void dsl(int32_t n, uint32_t a[], int32_t shift) { int32_t shift1; for (; shift > 0; shift -= shift1) { shift1 = 9 <= shift ? 9 : shift; @@ -297,7 +297,7 @@ inline static void dsl(int32_t n, uint32_t a[], int32_t shift) { Multiplies significand a by significand b yielding the product p; using 64-bit arithmetic; */ -inline static void m_multiply( +INLINE void m_multiply( uint32_t p[/* n + m */], int32_t n, const uint32_t a[], @@ -325,7 +325,7 @@ inline static void m_multiply( b must be nonzero! using 64-bit arithmetic; */ -inline static uint32_t m_divide_1(int32_t n, uint32_t q[], const uint32_t a[], uint32_t b) { +INLINE uint32_t m_divide_1(int32_t n, uint32_t q[], const uint32_t a[], uint32_t b) { int32_t i; REBU64 f = 0, g = b; for (i = n - 1; i >= 0; i--) { @@ -344,7 +344,7 @@ inline static uint32_t m_divide_1(int32_t n, uint32_t q[], const uint32_t a[], u 2 - exactly half of the least significant unit truncated 3 - more than half of the least significant unit truncated */ -inline static void dsr(int32_t n, uint32_t a[], int32_t shift, int32_t *t_flag) { +INLINE void dsr(int32_t n, uint32_t a[], int32_t shift, int32_t *t_flag) { uint32_t remainder, divisor; int32_t shift1; for (; shift > 0; shift -= shift1) { @@ -362,7 +362,7 @@ inline static void dsr(int32_t n, uint32_t a[], int32_t shift, int32_t *t_flag) ea and eb are exponents; ta and tb are truncate flags like above; */ -inline static void make_comparable( +INLINE void make_comparable( uint32_t a[4], int32_t *ea, int32_t *ta, @@ -636,7 +636,7 @@ deci decimal_to_deci(REBDEC a) { ta is a truncate flag as described above; *f is supposed to be in range [-128; 127]; */ -inline static void m_ldexp(uint32_t a[4], int32_t *f, int32_t e, int32_t ta) { +INLINE void m_ldexp(uint32_t a[4], int32_t *f, int32_t e, int32_t ta) { /* take care of zero significand */ if (m_is_zero (3, a)) { *f = 0; @@ -1021,7 +1021,7 @@ deci deci_multiply(const deci a, const deci b) { #define MAX_N 7 #define MAX_M 3 -inline static void m_divide( +INLINE void m_divide( uint32_t q[/* n - m + 1 */], uint32_t r[/* m */], const int32_t n, @@ -1166,7 +1166,7 @@ deci deci_divide(deci a, deci b) { #define MAX_NB 7 -inline static int32_t m_to_string(Byte* s, uint32_t n, const uint32_t a[]) { +INLINE int32_t m_to_string(Byte* s, uint32_t n, const uint32_t a[]) { uint32_t r, b[MAX_NB]; Byte v[10 * MAX_NB + 1], *vmax, *k; diff --git a/src/core/l-scan.c b/src/core/l-scan.c index 04f0bd9f74..97d4de3580 100755 --- a/src/core/l-scan.c +++ b/src/core/l-scan.c @@ -55,15 +55,15 @@ ((L)->flags.bits &= ~SCAN_EXECUTOR_FLAG_##name) -inline static bool Is_Dot_Or_Slash(char c) +INLINE bool Is_Dot_Or_Slash(char c) { return c == '/' or c == '.'; } -inline static bool Interstitial_Match(char c, char mode) { +INLINE bool Interstitial_Match(char c, char mode) { assert(mode == '/' or mode == '.'); return c == mode; } -inline static Sigil Sigil_From_Token(Token t) { +INLINE Sigil Sigil_From_Token(Token t) { assert(t < u_cast(int, SIGIL_MAX)); assert(t != u_cast(int, SIGIL_0)); assert(t != u_cast(int, SIGIL_SET)); diff --git a/src/core/m-gc.c b/src/core/m-gc.c index 9b515e43b6..1f2fa5a090 100755 --- a/src/core/m-gc.c +++ b/src/core/m-gc.c @@ -91,26 +91,26 @@ // To avoid the cost of incrementing and decrementing, only in debug builds. // #if DEBUG - inline static void Remove_GC_Mark(const Node* node) { // stub or pairing + INLINE void Remove_GC_Mark(const Node* node) { // stub or pairing assert(Is_Node_Marked(node)); Clear_Node_Marked_Bit(node); g_gc.mark_count -= 1; } - inline static void Remove_GC_Mark_If_Marked(const Node* node) { + INLINE void Remove_GC_Mark_If_Marked(const Node* node) { if (Is_Node_Marked(node)) { Clear_Node_Marked_Bit(node); g_gc.mark_count -= 1; } } - inline static void Add_GC_Mark(const Node* node) { + INLINE void Add_GC_Mark(const Node* node) { assert(not Is_Node_Marked(node)); Set_Node_Marked_Bit(node); g_gc.mark_count += 1; } - inline static void Add_GC_Mark_If_Not_Already_Marked(const Node* node) { + INLINE void Add_GC_Mark_If_Not_Already_Marked(const Node* node) { if (not Is_Node_Marked(node)) { Set_Node_Marked_Bit(node); g_gc.mark_count += 1; @@ -126,7 +126,7 @@ static void Queue_Mark_Cell_Deep(const Cell* v); -inline static void Queue_Mark_Maybe_Fresh_Cell_Deep(const Cell* v) { +INLINE void Queue_Mark_Maybe_Fresh_Cell_Deep(const Cell* v) { if (not Is_Fresh(v)) Queue_Mark_Cell_Deep(v); } diff --git a/src/core/n-math.c b/src/core/n-math.c index 4b70a7e5e3..af1515ae77 100644 --- a/src/core/n-math.c +++ b/src/core/n-math.c @@ -924,7 +924,7 @@ DECLARE_NATIVE(minimum) } -inline static Element* Init_Zeroed_Hack(Sink(Element*) out, Heart heart) { +INLINE Element* Init_Zeroed_Hack(Sink(Element*) out, Heart heart) { // // !!! This captures of a dodgy behavior of R3-Alpha, which was to assume // that clearing the payload of a value and then setting the header made diff --git a/src/core/t-logic.c b/src/core/t-logic.c index f1577569e6..422ed14ae6 100644 --- a/src/core/t-logic.c +++ b/src/core/t-logic.c @@ -149,7 +149,7 @@ DECLARE_INTRINSIC(not_1) // see TO-C-NAME // This scales the idea back to a very simple concept of a quoted GROUP!, // WORD!, or TUPLE!. // -inline static bool Do_Logic_Right_Side_Throws( +INLINE bool Do_Logic_Right_Side_Throws( Sink(Value*) out, const Value* right ){ @@ -286,7 +286,7 @@ DECLARE_NATIVE(unless) } -inline static bool Math_Arg_For_Logic(Value* arg) +INLINE bool Math_Arg_For_Logic(Value* arg) { if (Is_Logic(arg)) return Cell_Logic(arg); diff --git a/src/core/t-map.c b/src/core/t-map.c index 0e50bdda67..0a99d05fd8 100755 --- a/src/core/t-map.c +++ b/src/core/t-map.c @@ -367,7 +367,7 @@ Bounce MAKE_Map( } -inline static Map* Copy_Map(const Map* map, bool deeply) { +INLINE Map* Copy_Map(const Map* map, bool deeply) { Array* copy = Copy_Array_Shallow_Flags( MAP_PAIRLIST(map), SERIES_MASK_PAIRLIST diff --git a/src/core/t-varargs.c b/src/core/t-varargs.c index c893d0e6f6..650704c2f0 100644 --- a/src/core/t-varargs.c +++ b/src/core/t-varargs.c @@ -29,7 +29,7 @@ #include "sys-core.h" -inline static void Init_For_Vararg_End(Atom* out, enum Reb_Vararg_Op op) { +INLINE void Init_For_Vararg_End(Atom* out, enum Reb_Vararg_Op op) { if (op == VARARG_OP_TAIL_Q) Init_True(out); else @@ -43,7 +43,7 @@ inline static void Init_For_Vararg_End(Atom* out, enum Reb_Vararg_Op op) { // prelude which sees if it can answer the current query just from looking one // unit ahead. // -inline static bool Vararg_Op_If_No_Advance_Handled( +INLINE bool Vararg_Op_If_No_Advance_Handled( Atom* out, enum Reb_Vararg_Op op, Option(const Element*) opt_look, // the first value in the varargs input diff --git a/src/core/t-word.c b/src/core/t-word.c index ca8e765dd3..05de0b3ac1 100644 --- a/src/core/t-word.c +++ b/src/core/t-word.c @@ -220,7 +220,7 @@ void MF_Word(REB_MOLD *mo, const Cell* v, bool form) { } -inline static void Mold_Decorable_Word(REB_MOLD *mo, const Cell* v) +INLINE void Mold_Decorable_Word(REB_MOLD *mo, const Cell* v) { const Symbol* symbol = Cell_Word_Symbol(v); Append_Utf8(mo->series, String_UTF8(symbol), String_Size(symbol)); diff --git a/src/core/u-parse.c b/src/core/u-parse.c index 0e8e0434f0..db2935e153 100755 --- a/src/core/u-parse.c +++ b/src/core/u-parse.c @@ -217,7 +217,7 @@ STATIC_ASSERT((int)AM_FIND_MATCH == (int)PF_FIND_MATCH); // !!! This and other efficiency tricks from R3-Alpha should be reviewed to // see if they're really the best option. // -inline static Option(SymId) VAL_CMD(const Cell* v) { +INLINE Option(SymId) VAL_CMD(const Cell* v) { Option(SymId) sym = Cell_Word_Id(v); if (sym >= SYM_SET and sym <= SYM_END) return sym; @@ -351,19 +351,19 @@ static bool Subparse_Throws( // question, but now the `where` at the time of failure will indicate the // location in the parse dialect that's the problem. -inline static Context* Error_Parse3_Rule(void) { +INLINE Context* Error_Parse3_Rule(void) { return Error_Parse3_Rule_Raw(); } -inline static Context* Error_Parse3_End(void) { +INLINE Context* Error_Parse3_End(void) { return Error_Parse3_End_Raw(); } -inline static Context* Error_Parse3_Command(Level* level_) { +INLINE Context* Error_Parse3_Command(Level* level_) { return Error_Parse3_Command_Raw(P_RULE); } -inline static Context* Error_Parse3_Variable(Level* level_) { +INLINE Context* Error_Parse3_Variable(Level* level_) { return Error_Parse3_Variable_Raw(P_RULE); } diff --git a/src/include/assert-fix.h b/src/include/assert-fix.h index f1d9944e8d..f34473ab56 100644 --- a/src/include/assert-fix.h +++ b/src/include/assert-fix.h @@ -45,7 +45,7 @@ // of in the debugger. // #if defined(__HAIKU__) || defined(__EMSCRIPTEN__) - inline static void debug_break() { + static inline void debug_break() { int x = 0; #if !defined(NDEBUG) printf("debug_break() called\n"); @@ -62,7 +62,7 @@ #include // include so it will think it has been included #undef assert // (this way its include guard prevents it defining again) - inline static void Assertion_Failure( + static inline void Assertion_Failure( const char* file, int line, const char* expr diff --git a/src/include/structs/struct-node.h b/src/include/structs/struct-node.h index ecc0aafb1b..337e555403 100644 --- a/src/include/structs/struct-node.h +++ b/src/include/structs/struct-node.h @@ -190,28 +190,28 @@ typedef uintptr_t Flags; #define THIRD_BYTE(p) x_cast(Byte*, (p))[2] #define FOURTH_BYTE(p) x_cast(Byte*, (p))[3] #else - inline static Byte FIRST_BYTE(const void* p) + INLINE Byte FIRST_BYTE(const void* p) { return cast(const Byte*, p)[0]; } - inline static Byte& FIRST_BYTE(void* p) + INLINE Byte& FIRST_BYTE(void* p) { return cast(Byte*, p)[0]; } - inline static Byte SECOND_BYTE(const void* p) + INLINE Byte SECOND_BYTE(const void* p) { return cast(const Byte*, p)[1]; } - inline static Byte& SECOND_BYTE(void* p) + INLINE Byte& SECOND_BYTE(void* p) { return cast(Byte*, p)[1]; } - inline static Byte THIRD_BYTE(const void* p) + INLINE Byte THIRD_BYTE(const void* p) { return cast(const Byte*, p)[2]; } - inline static Byte& THIRD_BYTE(void *p) + INLINE Byte& THIRD_BYTE(void *p) { return cast(Byte*, p)[2]; } - inline static Byte FOURTH_BYTE(const void* p) + INLINE Byte FOURTH_BYTE(const void* p) { return cast(const Byte*, p)[3]; } - inline static Byte& FOURTH_BYTE(void* p) + INLINE Byte& FOURTH_BYTE(void* p) { return cast(Byte*, p)[3]; } #endif diff --git a/tools/make-librebol.r b/tools/make-librebol.r index 1a6ab9d25f..a78ba40e6c 100644 --- a/tools/make-librebol.r +++ b/tools/make-librebol.r @@ -238,7 +238,7 @@ for-each-api [ append variadic-api-c-helpers cscape [:api { $ - inline static $ $_helper( /* C version */ + static inline $ $_helper( /* C version */ RebolSpecifier** specifier_ref, $ const void* p, ... @@ -450,7 +450,7 @@ e-lib/emit [ver { #define Compiler_Lacks_Variadic_Macros_If_This_Errors(...) \ (__VA_ARGS__ + 304) - inline static int Feature_Test_Compiler_For_Variadic_Macros(void) + static inline int Feature_Test_Compiler_For_Variadic_Macros(void) { return Compiler_Lacks_Variadic_Macros_If_This_Errors(1020); } #endif @@ -1125,7 +1125,7 @@ e-lib/emit [ver { ((T*)rebTryAllocBytes(sizeof(T) * (n))) /* Used during boot to zero out global variables */ - inline static void rebReleaseAndNull(RebolValue** v) { + static inline void rebReleaseAndNull(RebolValue** v) { rebRelease(*v); *v = rebNull; /* nullptr may not be defined */ }