mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-27 06:48:31 +00:00
Change noinline to dontinline (#312)
We defined `noinline` as an abbreviation for the longer version `__attribute__((__noinline__))` which caused name clashes since third party codebases often write it as `__attribute__((noinline))`.
This commit is contained in:
parent
ca611efc43
commit
6f658f058b
59 changed files with 122 additions and 122 deletions
|
@ -34,7 +34,7 @@ static uint32_t KnuthMultiplicativeHash32(const void *buf, size_t size) {
|
|||
return h;
|
||||
}
|
||||
|
||||
static textwindows noinline uint32_t GetUserNameHash(void) {
|
||||
static textwindows dontinline uint32_t GetUserNameHash(void) {
|
||||
char16_t buf[257];
|
||||
uint32_t size = ARRAYLEN(buf);
|
||||
GetUserName(&buf, &size);
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include "libc/nt/thread.h"
|
||||
#include "libc/str/str.h"
|
||||
|
||||
static textwindows noinline int sys_sched_setaffinity_nt(int pid,
|
||||
static textwindows dontinline int sys_sched_setaffinity_nt(int pid,
|
||||
uint64_t bitsetsize,
|
||||
const void *bitset) {
|
||||
int rc;
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include "libc/str/str.h"
|
||||
#include "libc/sysv/errfuns.h"
|
||||
|
||||
static textwindows noinline int sys_ttyname_nt(int fd, char *buf, size_t size) {
|
||||
static textwindows dontinline int sys_ttyname_nt(int fd, char *buf, size_t size) {
|
||||
uint32_t mode;
|
||||
if (GetConsoleMode(g_fds.p[fd].handle, &mode)) {
|
||||
if (mode & kNtEnableVirtualTerminalInput) {
|
||||
|
|
|
@ -36,7 +36,7 @@ static struct HostsTxtInitialStaticMemory {
|
|||
char strings[64];
|
||||
} g_hoststxt_init;
|
||||
|
||||
static textwindows noinline char *GetNtHostsTxtPath(char *pathbuf,
|
||||
static textwindows dontinline char *GetNtHostsTxtPath(char *pathbuf,
|
||||
uint32_t size) {
|
||||
const char *const kWinHostsPath = "\\drivers\\etc\\hosts";
|
||||
uint32_t len = GetSystemDirectoryA(&pathbuf[0], size);
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
* @param p needs at least 12 bytes
|
||||
* @return pointer to nul byte
|
||||
*/
|
||||
noinline char *FormatUint32(char p[static 12], uint32_t x) {
|
||||
dontinline char *FormatUint32(char p[static 12], uint32_t x) {
|
||||
char t;
|
||||
size_t i, a, b;
|
||||
i = 0;
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
* @param p needs at least 21 bytes
|
||||
* @return pointer to nul byte
|
||||
*/
|
||||
noinline char *FormatUint64(char p[static 21], uint64_t x) {
|
||||
dontinline char *FormatUint64(char p[static 21], uint64_t x) {
|
||||
char t;
|
||||
size_t i, a, b;
|
||||
i = 0;
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
* @param p needs at least 21 bytes
|
||||
* @return pointer to nul byte
|
||||
*/
|
||||
noinline char *FormatUint64Thousands(char p[static 27], uint64_t x) {
|
||||
dontinline char *FormatUint64Thousands(char p[static 27], uint64_t x) {
|
||||
size_t i;
|
||||
char m[26];
|
||||
i = 0;
|
||||
|
|
|
@ -28,7 +28,7 @@ uint128_t __udivmodti4(uint128_t, uint128_t, uint128_t *);
|
|||
* @param a needs at least 40 bytes
|
||||
* @return bytes written w/o nul
|
||||
*/
|
||||
noinline size_t uint128toarray_radix10(uint128_t i, char *a) {
|
||||
dontinline size_t uint128toarray_radix10(uint128_t i, char *a) {
|
||||
size_t j;
|
||||
uint128_t rem;
|
||||
j = 0;
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
#include "libc/fmt/conv.h"
|
||||
#include "libc/fmt/itoa.h"
|
||||
|
||||
noinline size_t uint64toarray(uint64_t i, char *a, int r) {
|
||||
dontinline size_t uint64toarray(uint64_t i, char *a, int r) {
|
||||
size_t j;
|
||||
j = 0;
|
||||
do {
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
* @param a needs at least 21 bytes
|
||||
* @return bytes written w/o nul
|
||||
*/
|
||||
noinline size_t uint64toarray_radix10(uint64_t i, char a[hasatleast 21]) {
|
||||
dontinline size_t uint64toarray_radix10(uint64_t i, char a[hasatleast 21]) {
|
||||
size_t j = 0;
|
||||
do {
|
||||
a[j++] = i % 10 + '0';
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
* @param a needs at least 24 bytes
|
||||
* @return bytes written w/o nul
|
||||
*/
|
||||
noinline size_t uint64toarray_radix8(uint64_t i, char a[hasatleast 24]) {
|
||||
dontinline size_t uint64toarray_radix8(uint64_t i, char a[hasatleast 24]) {
|
||||
size_t j;
|
||||
j = 0;
|
||||
do {
|
||||
|
|
|
@ -241,13 +241,13 @@ typedef uint64_t uintmax_t;
|
|||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef noinline
|
||||
#ifndef dontinline
|
||||
#if !defined(__STRICT_ANSI__) && \
|
||||
(__has_attribute(__noinline__) || \
|
||||
(__GNUC__ + 0) * 100 + (__GNUC_MINOR__ + 0) >= 301)
|
||||
#define noinline __attribute__((__noinline__))
|
||||
#define dontinline __attribute__((__noinline__))
|
||||
#else
|
||||
#define noinline
|
||||
#define dontinline
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
@ -606,7 +606,7 @@ typedef uint64_t uintmax_t;
|
|||
} while (0)
|
||||
|
||||
#ifndef __STRICT_ANSI__
|
||||
#define testonly noinline _Section(".test")
|
||||
#define testonly dontinline _Section(".test")
|
||||
#define textstartup _Section(".text.startup") noinstrument
|
||||
#define textexit _Section(".text.exit") noinstrument
|
||||
#define textreal _Section(".text.real")
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
typedef char xmm_t __attribute__((__vector_size__(16), __aligned__(1)));
|
||||
typedef long long xmm_a __attribute__((__vector_size__(16), __aligned__(16)));
|
||||
|
||||
noasan static noinline antiquity void bzero_sse(char *p, size_t n) {
|
||||
noasan static dontinline antiquity void bzero_sse(char *p, size_t n) {
|
||||
xmm_t v = {0};
|
||||
if (IsAsan()) __asan_verify(p, n);
|
||||
if (n <= 32) {
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
typedef char xmm_t __attribute__((__vector_size__(16), __aligned__(1)));
|
||||
|
||||
static noinline antiquity int memcmp_sse(const unsigned char *p,
|
||||
static dontinline antiquity int memcmp_sse(const unsigned char *p,
|
||||
const unsigned char *q, size_t n) {
|
||||
uint64_t w;
|
||||
unsigned u, u0, u1, u2, u3;
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
typedef char xmm_t __attribute__((__vector_size__(16), __aligned__(1)));
|
||||
typedef long long xmm_a __attribute__((__vector_size__(16), __aligned__(16)));
|
||||
|
||||
noasan static noinline antiquity void *memset_sse(char *p, char c, size_t n) {
|
||||
noasan static dontinline antiquity void *memset_sse(char *p, char c, size_t n) {
|
||||
xmm_t v = {c, c, c, c, c, c, c, c, c, c, c, c, c, c, c, c};
|
||||
if (IsAsan()) __asan_verify(p, n);
|
||||
if (n <= 32) {
|
||||
|
|
|
@ -103,7 +103,7 @@ static size_t __arena_bulk_free(void *p[], size_t n) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static noinline bool __arena_grow(size_t offset, size_t request) {
|
||||
static dontinline bool __arena_grow(size_t offset, size_t request) {
|
||||
size_t greed;
|
||||
greed = __arena.size + 1;
|
||||
do {
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
STATIC_YOINK("rdrand_init");
|
||||
|
||||
static noinline uint64_t rdrand_failover(void) {
|
||||
static dontinline uint64_t rdrand_failover(void) {
|
||||
int f;
|
||||
size_t i;
|
||||
ssize_t r;
|
||||
|
|
|
@ -111,7 +111,7 @@ static int arch_prctl_freebsd(int code, int64_t addr) {
|
|||
}
|
||||
}
|
||||
|
||||
static privileged noinline int arch_prctl_xnu(int code, int64_t addr) {
|
||||
static privileged dontinline int arch_prctl_xnu(int code, int64_t addr) {
|
||||
int ax;
|
||||
switch (code) {
|
||||
case ARCH_SET_GS:
|
||||
|
@ -129,7 +129,7 @@ static privileged noinline int arch_prctl_xnu(int code, int64_t addr) {
|
|||
}
|
||||
}
|
||||
|
||||
static privileged noinline int arch_prctl_openbsd(int code, int64_t addr) {
|
||||
static privileged dontinline int arch_prctl_openbsd(int code, int64_t addr) {
|
||||
int64_t rax;
|
||||
switch (code) {
|
||||
case ARCH_GET_FS:
|
||||
|
|
|
@ -32,7 +32,7 @@ struct clockinfo_netbsd {
|
|||
|
||||
static int clk_tck;
|
||||
|
||||
static noinline int __clk_tck_init(void) {
|
||||
static dontinline int __clk_tck_init(void) {
|
||||
int x;
|
||||
int cmd[2];
|
||||
size_t len;
|
||||
|
|
|
@ -59,7 +59,7 @@ static textwindows noasan char16_t *ParseInt(char16_t *p, int64_t *x) {
|
|||
return p;
|
||||
}
|
||||
|
||||
static noinline textwindows noasan bool ForkIo(int64_t h, void *buf, size_t n,
|
||||
static dontinline textwindows noasan bool ForkIo(int64_t h, void *buf, size_t n,
|
||||
bool32 (*f)()) {
|
||||
char *p;
|
||||
size_t i;
|
||||
|
@ -72,14 +72,14 @@ static noinline textwindows noasan bool ForkIo(int64_t h, void *buf, size_t n,
|
|||
return true;
|
||||
}
|
||||
|
||||
static noinline textwindows noasan void WriteAll(int64_t h, void *buf,
|
||||
static dontinline textwindows noasan void WriteAll(int64_t h, void *buf,
|
||||
size_t n) {
|
||||
if (!ForkIo(h, buf, n, WriteFile)) {
|
||||
SYSDEBUG("fork() WriteFile(%zu) failed %d\n", n, GetLastError());
|
||||
}
|
||||
}
|
||||
|
||||
static textwindows noinline noasan void ReadAll(int64_t h, void *buf,
|
||||
static textwindows dontinline noasan void ReadAll(int64_t h, void *buf,
|
||||
size_t n) {
|
||||
if (!ForkIo(h, buf, n, ReadFile)) {
|
||||
SYSDEBUG("fork() ReadFile(%zu) failed %d\n", n, GetLastError());
|
||||
|
|
|
@ -150,7 +150,7 @@ static noasan void *MapMemory(void *addr, size_t size, int prot, int flags,
|
|||
* This is useful on Windows since it allows us to partially unmap or
|
||||
* punch holes into existing mappings.
|
||||
*/
|
||||
static textwindows noinline noasan void *MapMemories(char *addr, size_t size,
|
||||
static textwindows dontinline noasan void *MapMemories(char *addr, size_t size,
|
||||
int prot, int flags,
|
||||
int fd, int64_t off, int f,
|
||||
int x, size_t n) {
|
||||
|
|
|
@ -1318,7 +1318,7 @@ static textwindows struct PortState *port_state_from_handle_tree_node(
|
|||
return CONTAINOF(tree_node, struct PortState, handle_tree_node);
|
||||
}
|
||||
|
||||
static textwindows noinline int sys_epoll_create1_nt(uint32_t flags) {
|
||||
static textwindows dontinline int sys_epoll_create1_nt(uint32_t flags) {
|
||||
int fd;
|
||||
int64_t ephnd;
|
||||
struct PortState *port_state;
|
||||
|
@ -1344,7 +1344,7 @@ static textwindows noinline int sys_epoll_create1_nt(uint32_t flags) {
|
|||
return fd;
|
||||
}
|
||||
|
||||
static textwindows noinline int sys_epoll_ctl_nt(int epfd, int op, int fd,
|
||||
static textwindows dontinline int sys_epoll_ctl_nt(int epfd, int op, int fd,
|
||||
struct epoll_event *ev) {
|
||||
int r;
|
||||
struct PortState *port_state;
|
||||
|
@ -1374,7 +1374,7 @@ static textwindows noinline int sys_epoll_ctl_nt(int epfd, int op, int fd,
|
|||
}
|
||||
}
|
||||
|
||||
static textwindows noinline int sys_epoll_wait_nt(int epfd,
|
||||
static textwindows dontinline int sys_epoll_wait_nt(int epfd,
|
||||
struct epoll_event *events,
|
||||
int maxevents,
|
||||
int timeoutms) {
|
||||
|
|
|
@ -134,7 +134,7 @@ static textwindows DIR *opendir_nt_impl(char16_t *name, size_t len) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static textwindows noinline DIR *opendir_nt(const char *path) {
|
||||
static textwindows dontinline DIR *opendir_nt(const char *path) {
|
||||
int len;
|
||||
DIR *res;
|
||||
char16_t *name;
|
||||
|
@ -149,7 +149,7 @@ static textwindows noinline DIR *opendir_nt(const char *path) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static textwindows noinline DIR *fdopendir_nt(int fd) {
|
||||
static textwindows dontinline DIR *fdopendir_nt(int fd) {
|
||||
DIR *res;
|
||||
char16_t *name;
|
||||
if (__isfdkind(fd, kFdFile)) {
|
||||
|
@ -189,7 +189,7 @@ static textwindows uint8_t GetNtDirentType(struct NtWin32FindData *w) {
|
|||
}
|
||||
}
|
||||
|
||||
static textwindows noinline struct dirent *readdir_nt(DIR *dir) {
|
||||
static textwindows dontinline struct dirent *readdir_nt(DIR *dir) {
|
||||
size_t i;
|
||||
if (!dir->isdone) {
|
||||
bzero(&dir->ent, sizeof(dir->ent));
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
typedef uint64_t xmm_t __attribute__((__vector_size__(16), __aligned__(1)));
|
||||
|
||||
static noinline antiquity int memcmp_sse(const char *p, const char *q,
|
||||
static dontinline antiquity int memcmp_sse(const char *p, const char *q,
|
||||
size_t n) {
|
||||
xmm_t a;
|
||||
while (n > 32) {
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
void djbsort_avx2(int32_t *, long);
|
||||
|
||||
static noinline void intsort(int *x, size_t n, size_t t) {
|
||||
static dontinline void intsort(int *x, size_t n, size_t t) {
|
||||
int a, b, c;
|
||||
size_t i, p, q;
|
||||
for (p = t; p > 0; p >>= 1) {
|
||||
|
|
|
@ -25,7 +25,7 @@ size_t strclen(const char *s) {
|
|||
return strnclen(s, -1);
|
||||
}
|
||||
|
||||
noinline size_t strnclen(const char *s, size_t n) {
|
||||
dontinline size_t strnclen(const char *s, size_t n) {
|
||||
size_t r = 0;
|
||||
if (n) {
|
||||
while (n && *s && (*s & 0300) == 0200) ++s, --n;
|
||||
|
|
|
@ -26,7 +26,7 @@ size_t strclen16(const char16_t *s) {
|
|||
return strnclen16(s, -1ull);
|
||||
}
|
||||
|
||||
noinline size_t strnclen16(const char16_t *p, size_t n) {
|
||||
dontinline size_t strnclen16(const char16_t *p, size_t n) {
|
||||
size_t l = 0;
|
||||
if (n) {
|
||||
while (*p) {
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
typedef uint64_t xmm_t __attribute__((__vector_size__(16), __aligned__(1)));
|
||||
|
||||
noasan static noinline antiquity unsigned timingsafe_bcmp_sse(const char *p,
|
||||
noasan static dontinline antiquity unsigned timingsafe_bcmp_sse(const char *p,
|
||||
const char *q,
|
||||
size_t n) {
|
||||
uint64_t w;
|
||||
|
|
|
@ -30,11 +30,11 @@
|
|||
#include "libc/sysv/consts/rusage.h"
|
||||
#include "libc/time/time.h"
|
||||
|
||||
static noinline long ConvertMicros(struct timeval tv) {
|
||||
static dontinline long ConvertMicros(struct timeval tv) {
|
||||
return tv.tv_sec * CLK_TCK + tv.tv_usec / (1000000 / CLK_TCK);
|
||||
}
|
||||
|
||||
static noinline long times2(struct tms *out_times, struct rusage *ru) {
|
||||
static dontinline long times2(struct tms *out_times, struct rusage *ru) {
|
||||
struct timeval tv;
|
||||
struct NtFileTime CreationTime, ExitTime, KernelTime, UserTime;
|
||||
if (!IsWindows()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue