From: Dan Gohman Date: Mon, 15 Apr 2019 17:51:44 +0000 (-0700) Subject: Format changes to musl code to fit musl's style. X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=ec9f1c3956036a03082c3e7342d284d6f06bd79d;p=wasi-libc.git Format changes to musl code to fit musl's style. The whitespace diffs are converting from spaces to tabs. --- diff --git a/libc-top-half/musl/src/conf/sysconf.c b/libc-top-half/musl/src/conf/sysconf.c index 5f56ad7..7e3f290 100644 --- a/libc-top-half/musl/src/conf/sysconf.c +++ b/libc-top-half/musl/src/conf/sysconf.c @@ -33,7 +33,7 @@ long sysconf(int name) #ifdef __wasilibc_unmodified_upstream // WASI has no processes [_SC_CHILD_MAX] = RLIM(NPROC), #else - // Not supported on wasi. + // Not supported on wasi. [_SC_CHILD_MAX] = -1, #endif [_SC_CLK_TCK] = 100, @@ -76,7 +76,7 @@ long sysconf(int name) #ifdef __wasilibc_unmodified_upstream // WASI has no realtime signals [_SC_RTSIG_MAX] = _NSIG - 1 - 31 - 3, #else - // Not supported on wasi. + // Not supported on wasi. [_SC_RTSIG_MAX] = -1, #endif #ifdef __wasilibc_unmodified_upstream // WASI has no semaphores @@ -220,7 +220,7 @@ long sysconf(int name) return -1; return lim.rlim_cur > LONG_MAX ? LONG_MAX : lim.rlim_cur; #else - // Not supported on wasi. + // Not supported on wasi. errno = EINVAL; return -1; #endif @@ -253,7 +253,7 @@ long sysconf(int name) for (; set[i]; set[i]&=set[i]-1, cnt++); return cnt; #else - // With no thread support, just say there's 1 processor. + // With no thread support, just say there's 1 processor. return 1; #endif #ifdef __wasilibc_unmodified_upstream // WASI has no sysinfo diff --git a/libc-top-half/musl/src/internal/libm.h b/libc-top-half/musl/src/internal/libm.h index b0e404c..22e4d92 100644 --- a/libc-top-half/musl/src/internal/libm.h +++ b/libc-top-half/musl/src/internal/libm.h @@ -85,10 +85,8 @@ union ldshape { } \ } while(0) #else -/* - * WebAssembly doesn't have floating-point status flags, so there's no reason - * to force evaluations. - * */ +/* WebAssembly doesn't have floating-point status flags, so there's no reason + * to force evaluations. */ #define FORCE_EVAL(x) ((void)(x)) #endif diff --git a/libc-top-half/musl/src/locale/newlocale.c b/libc-top-half/musl/src/locale/newlocale.c index 823e418..be8fe44 100644 --- a/libc-top-half/musl/src/locale/newlocale.c +++ b/libc-top-half/musl/src/locale/newlocale.c @@ -51,13 +51,13 @@ locale_t __newlocale(int mask, const char *name, locale_t loc) * variant of the C locale honoring the default locale's encoding. */ pthread_once(&default_locale_once, default_locale_init); #else - { - static int called; - if (called == 0) { - default_locale_init(); - called = 1; - } - } + { + static int called; + if (called == 0) { + default_locale_init(); + called = 1; + } + } #endif if (!memcmp(&tmp, &default_locale, sizeof tmp)) return &default_locale; if (!memcmp(&tmp, &default_ctype_locale, sizeof tmp)) diff --git a/libc-top-half/musl/src/misc/uname.c b/libc-top-half/musl/src/misc/uname.c index 03682e2..b6163c3 100644 --- a/libc-top-half/musl/src/misc/uname.c +++ b/libc-top-half/musl/src/misc/uname.c @@ -10,23 +10,23 @@ int uname(struct utsname *uts) #ifdef __wasilibc_unmodified_upstream // Implement uname with placeholders return syscall(SYS_uname, uts); #else - // Just fill in the fields with placeholder values. + // Just fill in the fields with placeholder values. strcpy(uts->sysname, "wasi"); strcpy(uts->nodename, "(none)"); strcpy(uts->release, "0.0.0"); strcpy(uts->version, "0.0.0"); #if defined(__wasm32__) - strcpy(uts->machine, "wasm32"); + strcpy(uts->machine, "wasm32"); #elif defined(__wasm64__) - strcpy(uts->machine, "wasm64"); + strcpy(uts->machine, "wasm64"); #else - strcpy(uts->machine, "unknown"); + strcpy(uts->machine, "unknown"); #endif #ifdef _GNU_SOURCE - strcpy(uts->domainname, "(none)"); + strcpy(uts->domainname, "(none)"); #else - strcpy(uts->__domainname, "(none)"); + strcpy(uts->__domainname, "(none)"); #endif - return 0; + return 0; #endif } diff --git a/libc-top-half/musl/src/stdio/fopen.c b/libc-top-half/musl/src/stdio/fopen.c index 1befe03..07f035d 100644 --- a/libc-top-half/musl/src/stdio/fopen.c +++ b/libc-top-half/musl/src/stdio/fopen.c @@ -41,7 +41,7 @@ FILE *fopen(const char *restrict filename, const char *restrict mode) #ifdef __wasilibc_unmodified_upstream // WASI has no syscall __syscall(SYS_close, fd); #else - close(fd); + close(fd); #endif return 0; } diff --git a/libc-top-half/musl/src/stdio/freopen.c b/libc-top-half/musl/src/stdio/freopen.c index f12cd7d..5331db0 100644 --- a/libc-top-half/musl/src/stdio/freopen.c +++ b/libc-top-half/musl/src/stdio/freopen.c @@ -50,12 +50,12 @@ FILE *freopen(const char *restrict filename, const char *restrict mode, FILE *re #ifdef __wasilibc_unmodified_upstream // WASI has no dup else if (__dup3(f2->fd, f->fd, fl&O_CLOEXEC)<0) goto fail2; #else - // WASI doesn't have dup3, but does have a way to renumber - // an existing file descriptor. + // WASI doesn't have dup3, but does have a way to renumber + // an existing file descriptor. else { - if (__wasilibc_fd_renumber(f2->fd, f->fd)<0) goto fail2; - f2->fd = -1; /* avoid closing in fclose */ - } + if (__wasilibc_fd_renumber(f2->fd, f->fd)<0) goto fail2; + f2->fd = -1; /* avoid closing in fclose */ + } #endif f->flags = (f->flags & F_PERM) | f2->flags; diff --git a/libc-top-half/musl/src/stdio/getc.h b/libc-top-half/musl/src/stdio/getc.h index c61dd64..e62e3f0 100644 --- a/libc-top-half/musl/src/stdio/getc.h +++ b/libc-top-half/musl/src/stdio/getc.h @@ -23,7 +23,7 @@ static inline int do_getc(FILE *f) return getc_unlocked(f); return locking_getc(f); #else - // With no threads, locking is unnecessary. + // With no threads, locking is unnecessary. return getc_unlocked(f); #endif } diff --git a/libc-top-half/musl/src/stdio/putc.h b/libc-top-half/musl/src/stdio/putc.h index 6173fd4..2cc63d2 100644 --- a/libc-top-half/musl/src/stdio/putc.h +++ b/libc-top-half/musl/src/stdio/putc.h @@ -23,7 +23,7 @@ static inline int do_putc(int c, FILE *f) return putc_unlocked(c, f); return locking_putc(c, f); #else - // With no threads, locking is unnecessary. + // With no threads, locking is unnecessary. return putc_unlocked(c, f); #endif } diff --git a/libc-top-half/musl/src/stdio/vfprintf.c b/libc-top-half/musl/src/stdio/vfprintf.c index 91d9a69..7da2e50 100644 --- a/libc-top-half/musl/src/stdio/vfprintf.c +++ b/libc-top-half/musl/src/stdio/vfprintf.c @@ -138,7 +138,7 @@ static void pop_arg(union arg *arg, int type, va_list *ap) #if defined(__wasilibc_printscan_no_floating_point) break; case DBL: case LDBL: - floating_point_not_supported(); + floating_point_not_supported(); #else break; case DBL: arg->f = va_arg(*ap, double); #if defined(__wasilibc_printscan_no_long_double) diff --git a/libc-top-half/musl/src/stdio/vfwprintf.c b/libc-top-half/musl/src/stdio/vfwprintf.c index 4c935c3..e418d25 100644 --- a/libc-top-half/musl/src/stdio/vfwprintf.c +++ b/libc-top-half/musl/src/stdio/vfwprintf.c @@ -320,7 +320,7 @@ static int wprintf_core(FILE *f, const wchar_t *fmt, va_list *ap, union arg *nl_ if (xp && p<0) goto overflow; #if defined(__wasilibc_printscan_no_long_double) - // Omit the 'L' modifier for floating-point cases. + // Omit the 'L' modifier for floating-point cases. switch (t|32) { case 'a': case 'e': case 'f': case 'g': snprintf(charfmt, sizeof charfmt, "%%%s%s%s%s%s*.*%c", diff --git a/libc-top-half/musl/src/stdlib/strtod.c b/libc-top-half/musl/src/stdlib/strtod.c index 4e2ea87..6015829 100644 --- a/libc-top-half/musl/src/stdlib/strtod.c +++ b/libc-top-half/musl/src/stdlib/strtod.c @@ -58,12 +58,12 @@ weak_alias(strtold, __strtold_l); // WebAssembly doesn't permit signature-changing aliases, so use wrapper // functions instead. weak float strtof_l(const char *restrict s, char **restrict p, locale_t loc) { - return strtof(s, p); + return strtof(s, p); } weak double strtod_l(const char *restrict s, char **restrict p, locale_t loc) { - return strtod(s, p); + return strtod(s, p); } weak long double strtold_l(const char *restrict s, char **restrict p, locale_t loc) { - return strtold(s, p); + return strtold(s, p); } #endif