Browse Source

Format changes to musl code to fit musl's style.

The whitespace diffs are converting from spaces to tabs.
pull/26/head
Dan Gohman 6 years ago
parent
commit
ec9f1c3956
  1. 8
      libc-top-half/musl/src/conf/sysconf.c
  2. 6
      libc-top-half/musl/src/internal/libm.h
  3. 14
      libc-top-half/musl/src/locale/newlocale.c
  4. 14
      libc-top-half/musl/src/misc/uname.c
  5. 2
      libc-top-half/musl/src/stdio/fopen.c
  6. 10
      libc-top-half/musl/src/stdio/freopen.c
  7. 2
      libc-top-half/musl/src/stdio/getc.h
  8. 2
      libc-top-half/musl/src/stdio/putc.h
  9. 2
      libc-top-half/musl/src/stdio/vfprintf.c
  10. 2
      libc-top-half/musl/src/stdio/vfwprintf.c
  11. 6
      libc-top-half/musl/src/stdlib/strtod.c

8
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

6
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

14
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))

14
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
}

2
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;
}

10
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;

2
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
}

2
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
}

2
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)

2
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",

6
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

Loading…
Cancel
Save