Pay off more technical debt

This makes breaking changes to add underscores to many non-standard
function names provided by the c library. MODE=tiny is now tinier and
we now use smaller locks that are better for tiny apps in this mode.
Some headers have been renamed to be in the same folder as the build
package, so it'll be easier to know which build dependency is needed.
Certain old misguided interfaces have been removed. Intel intrinsics
headers are now listed in libc/isystem (but not in the amalgamation)
to help further improve open source compatibility. Header complexity
has also been reduced. Lastly, more shell scripts are now available.
This commit is contained in:
Justine Tunney 2022-09-12 23:10:38 -07:00
parent b69f3d2488
commit 6f7d0cb1c3
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
960 changed files with 4072 additions and 4873 deletions

View file

@ -29,7 +29,7 @@
#define LUA_CORE
#include "libc/intrin/weaken.h"
#include "libc/log/log.h"
#include "libc/runtime/gc.h"
#include "libc/mem/gc.h"
#include "libc/runtime/internal.h"
#include "libc/runtime/runtime.h"
#include "libc/str/str.h"
@ -153,9 +153,8 @@ l_noret luaD_throw (lua_State *L, int errcode) {
lua_unlock(L);
g->panic(L); /* call panic function (last chance to jump out) */
}
if (weaken(__die)) weaken(__die)();
__restorewintty();
_Exit(41);
if (_weaken(__die)) _weaken(__die)();
_Exitr(41);
}
}
}

View file

@ -1,7 +1,7 @@
#ifndef lobject_h
#define lobject_h
#include "libc/nexgen32e/bsr.h"
#include "libc/intrin/bsr.h"
#include "third_party/lua/llimits.h"
#include "third_party/lua/lua.h"
@ -786,7 +786,7 @@ LUAI_FUNC void luaO_chunkid (char *out, const char *source, size_t srclen);
** Computes ceil(log2(x))
*/
static inline int luaO_ceillog2 (unsigned int x) {
return --x ? bsr(x) + 1 : 0;
return --x ? _bsr(x) + 1 : 0;
}
#endif

View file

@ -26,20 +26,20 @@
*/
#define lua_c
#include "libc/mem/alg.h"
#include "libc/calls/calls.h"
#include "libc/calls/struct/sigaction.h"
#include "libc/errno.h"
#include "libc/intrin/nomultics.internal.h"
#include "libc/thread/thread.h"
#include "libc/log/check.h"
#include "libc/macros.internal.h"
#include "libc/mem/alg.h"
#include "libc/mem/gc.h"
#include "libc/mem/mem.h"
#include "libc/runtime/gc.h"
#include "libc/runtime/runtime.h"
#include "libc/stdio/stdio.h"
#include "libc/str/str.h"
#include "libc/sysv/consts/sa.h"
#include "libc/thread/thread.h"
#include "third_party/linenoise/linenoise.h"
#include "third_party/lua/cosmo.h"
#include "third_party/lua/lauxlib.h"
@ -148,7 +148,7 @@ void lua_readline_completions (const char *p, linenoiseCompletions *c) {
while (lua_next(L, -2)) {
if (lua_type(L, -2) == LUA_TSTRING) {
name = lua_tolstring(L, -2, &n);
if (startswithi(name, a) && (s = malloc(a - p + n + 1))) {
if (_startswithi(name, a) && (s = malloc(a - p + n + 1))) {
memcpy(s, p, a - p);
memcpy(s + (a - p), name, n + 1);
lua_readline_addcompletion(c, s);
@ -161,7 +161,7 @@ void lua_readline_completions (const char *p, linenoiseCompletions *c) {
lua_pop(L, 1); // pop table
for (i = 0; i < ARRAYLEN(kKeywordHints); ++i) {
if (startswithi(kKeywordHints[i], p)) {
if (_startswithi(kKeywordHints[i], p)) {
if ((s = strdup(kKeywordHints[i]))) {
lua_readline_addcompletion(c, s);
}

View file

@ -31,7 +31,7 @@
#include "libc/dce.h"
#include "libc/errno.h"
#include "libc/log/log.h"
#include "libc/runtime/gc.h"
#include "libc/mem/gc.h"
#include "libc/runtime/stack.h"
#include "libc/sock/sock.h"
#include "libc/sock/struct/pollfd.h"

View file

@ -23,9 +23,9 @@
#include "libc/log/log.h"
#include "libc/log/rop.h"
#include "libc/mem/mem.h"
#include "libc/runtime/gc.internal.h"
#include "libc/mem/gc.internal.h"
#include "libc/runtime/stack.h"
#include "libc/stdio/append.internal.h"
#include "libc/stdio/append.h"
#include "libc/stdio/strlist.internal.h"
#include "libc/str/str.h"
#include "net/http/escape.h"

View file

@ -23,7 +23,7 @@
#include "libc/math.h"
#include "libc/mem/mem.h"
#include "libc/runtime/stack.h"
#include "libc/stdio/append.internal.h"
#include "libc/stdio/append.h"
#include "libc/stdio/strlist.internal.h"
#include "libc/str/str.h"
#include "libc/x/x.h"

View file

@ -16,7 +16,7 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/stdio/append.internal.h"
#include "libc/stdio/append.h"
#include "third_party/lua/cosmo.h"
#include "third_party/lua/lauxlib.h"

View file

@ -21,13 +21,13 @@
#include "libc/calls/ioctl.h"
#include "libc/calls/makedev.h"
#include "libc/calls/pledge.h"
#include "libc/calls/strace.internal.h"
#include "libc/calls/struct/bpf.h"
#include "libc/calls/struct/dirent.h"
#include "libc/calls/struct/flock.h"
#include "libc/calls/struct/itimerval.h"
#include "libc/calls/struct/rlimit.h"
#include "libc/calls/struct/rusage.h"
#include "libc/calls/struct/sigaction.h"
#include "libc/calls/struct/siginfo.h"
#include "libc/calls/struct/sigset.h"
#include "libc/calls/struct/stat.h"
@ -43,6 +43,7 @@
#include "libc/fmt/itoa.h"
#include "libc/fmt/magnumstrs.internal.h"
#include "libc/intrin/bits.h"
#include "libc/intrin/strace.internal.h"
#include "libc/log/log.h"
#include "libc/macros.internal.h"
#include "libc/mem/fmt.h"
@ -56,9 +57,8 @@
#include "libc/sock/struct/linger.h"
#include "libc/sock/struct/pollfd.h"
#include "libc/sock/syslog.h"
#include "libc/stdio/append.internal.h"
#include "libc/stdio/append.h"
#include "libc/stdio/stdio.h"
#include "libc/str/errfun.h"
#include "libc/str/path.h"
#include "libc/str/str.h"
#include "libc/sysv/consts/af.h"
@ -2585,11 +2585,11 @@ static int LuaUnixErrnoWinerr(lua_State *L) {
}
static int LuaUnixErrnoName(lua_State *L) {
return ReturnString(L, strerrno(GetUnixErrno(L)->errno_));
return ReturnString(L, _strerrno(GetUnixErrno(L)->errno_));
}
static int LuaUnixErrnoDoc(lua_State *L) {
return ReturnString(L, strerdoc(GetUnixErrno(L)->errno_));
return ReturnString(L, _strerdoc(GetUnixErrno(L)->errno_));
}
static int LuaUnixErrnoCall(lua_State *L) {
@ -2604,7 +2604,7 @@ static int LuaUnixErrnoToString(lua_State *L) {
strerror_wr(e->errno_, e->winerr, msg, sizeof(msg));
lua_pushfstring(L, "%s() failed: %s", e->call, msg);
} else {
lua_pushstring(L, strerrno(e->errno_));
lua_pushstring(L, _strerrno(e->errno_));
}
return 1;
}

View file

@ -17,7 +17,7 @@
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/log/rop.h"
#include "libc/stdio/append.internal.h"
#include "libc/stdio/append.h"
#include "third_party/lua/cosmo.h"
#include "third_party/lua/lua.h"