Remove some includes

This commit is contained in:
Justine Tunney 2022-08-18 17:41:32 -07:00
parent 75832f7379
commit 6bb9ce553e
30 changed files with 52 additions and 118 deletions

View file

@ -525,13 +525,13 @@
.macro .underrun
#ifdef __SANITIZE_ADDRESS__
.poison __BASE_FILE__, kAsanGlobalUnderrun
.poison __BASE_FILE__, -20 # kAsanGlobalUnderrun
#endif
.endm
.macro .overrun
#ifdef __SANITIZE_ADDRESS__
.poison __BASE_FILE__, kAsanGlobalUnderrun
.poison __BASE_FILE__, -21 # kAsanGlobalOverrun
#endif
.endm

View file

@ -19,6 +19,7 @@
#include "libc/calls/struct/sigaction.h"
#include "libc/log/check.h"
#include "libc/runtime/gc.internal.h"
#include "libc/str/str.h"
#include "libc/sysv/consts/sa.h"
#include "libc/sysv/consts/sig.h"
#include "libc/testlib/ezbench.h"

View file

@ -105,4 +105,5 @@ TOOL_BUILD_LIB_TESTS = $(foreach x,$(TOOL_BUILD_LIB_ARTIFACTS),$($(x)_TESTS))
.PHONY: o/$(MODE)/tool/build/lib
o/$(MODE)/tool/build/lib: \
$(TOOL_BUILD_LIB_COMS) \
$(TOOL_BUILD_LIB_CHECKS)
$(TOOL_BUILD_LIB_CHECKS) \
$(TOOL_BUILD_LIB_A)

View file

@ -17,12 +17,10 @@
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/calls/calls.h"
#include "libc/calls/internal.h"
#include "libc/calls/struct/stat.h"
#include "libc/elf/elf.h"
#include "libc/log/check.h"
#include "libc/runtime/gc.internal.h"
#include "libc/stdio/stdio.h"
#include "libc/runtime/runtime.h"
#include "libc/sysv/consts/map.h"
#include "libc/sysv/consts/o.h"
#include "libc/sysv/consts/prot.h"

View file

@ -17,12 +17,9 @@
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/assert.h"
#include "libc/intrin/safemacros.internal.h"
#include "libc/calls/calls.h"
#include "libc/calls/struct/iovec.h"
#include "libc/macros.internal.h"
#include "libc/runtime/runtime.h"
#include "libc/sock/sock.h"
#include "libc/intrin/safemacros.internal.h"
#include "libc/str/str.h"
#include "libc/sysv/consts/o.h"
#include "tool/build/lib/demangle.h"

View file

@ -16,21 +16,14 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/mem/alg.h"
#include "libc/mem/arraylist2.internal.h"
#include "libc/intrin/safemacros.internal.h"
#include "libc/fmt/bing.internal.h"
#include "libc/fmt/fmt.h"
#include "libc/fmt/itoa.h"
#include "libc/log/check.h"
#include "libc/log/log.h"
#include "libc/macros.internal.h"
#include "libc/mem/arraylist2.internal.h"
#include "libc/mem/mem.h"
#include "libc/runtime/runtime.h"
#include "libc/str/str.h"
#include "libc/str/tpenc.h"
#include "third_party/xed/x86.h"
#include "tool/build/lib/case.h"
#include "tool/build/lib/demangle.h"
#include "tool/build/lib/dis.h"
#include "tool/build/lib/endian.h"

View file

@ -16,9 +16,8 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/assert.h"
#include "libc/intrin/bits.h"
#include "libc/fmt/itoa.h"
#include "libc/intrin/bits.h"
#include "libc/limits.h"
#include "libc/log/check.h"
#include "libc/macros.internal.h"

View file

@ -18,7 +18,6 @@
*/
#include "libc/log/check.h"
#include "libc/str/str.h"
#include "third_party/zlib/zlib.h"
#include "tool/build/lib/dis.h"
#include "tool/build/lib/high.h"
#include "tool/build/lib/modrm.h"

View file

@ -17,7 +17,6 @@
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/limits.h"
#include "libc/log/log.h"
#include "tool/build/lib/divmul.h"
#include "tool/build/lib/endian.h"
#include "tool/build/lib/flags.h"

View file

@ -16,25 +16,19 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/mem/arraylist2.internal.h"
#include "libc/assert.h"
#include "libc/calls/calls.h"
#include "libc/elf/def.h"
#include "libc/log/check.h"
#include "libc/macros.internal.h"
#include "libc/mem/fmt.h"
#include "libc/mem/mem.h"
#include "libc/mem/arraylist2.internal.h"
#include "libc/runtime/gc.internal.h"
#include "libc/runtime/memtrack.internal.h"
#include "libc/runtime/runtime.h"
#include "libc/str/str.h"
#include "libc/sysv/consts/map.h"
#include "libc/sysv/consts/mremap.h"
#include "libc/sysv/consts/msync.h"
#include "libc/sysv/consts/o.h"
#include "libc/sysv/consts/ok.h"
#include "libc/sysv/consts/prot.h"
#include "libc/x/x.h"
#include "tool/build/lib/elfwriter.h"
#include "tool/build/lib/interner.h"
static const Elf64_Ehdr kObjHeader = {
.e_ident = {ELFMAG0, ELFMAG1, ELFMAG2, ELFMAG3, ELFCLASS64, ELFDATA2LSB, 1,

View file

@ -16,21 +16,17 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/intrin/bits.h"
#include "libc/calls/calls.h"
#include "libc/calls/struct/timespec.h"
#include "libc/dos.h"
#include "libc/elf/def.h"
#include "libc/fmt/conv.h"
#include "libc/limits.h"
#include "libc/log/check.h"
#include "libc/nexgen32e/crc32.h"
#include "libc/nt/enum/fileflagandattributes.h"
#include "libc/stdio/rand.h"
#include "libc/runtime/gc.internal.h"
#include "libc/stdio/rand.h"
#include "libc/str/str.h"
#include "libc/sysv/consts/s.h"
#include "libc/time/struct/tm.h"
#include "libc/time/time.h"
#include "libc/x/x.h"
#include "libc/zip.h"
#include "third_party/zlib/zlib.h"

View file

@ -1,6 +1,5 @@
#ifndef COSMOPOLITAN_TOOL_BUILD_LIB_ENDIAN_H_
#define COSMOPOLITAN_TOOL_BUILD_LIB_ENDIAN_H_
#include "libc/str/str.h"
static inline uint8_t Read8(const uint8_t *p) {
return p[0];
@ -13,7 +12,7 @@ static inline void Write8(uint8_t *p, uint8_t v) {
static inline uint16_t Read16(const uint8_t *p) {
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
uint16_t v;
memcpy(&v, p, sizeof(v));
__builtin_memcpy(&v, p, sizeof(v));
return v;
#else
return p[1] << 8 | p[0];
@ -22,7 +21,7 @@ static inline uint16_t Read16(const uint8_t *p) {
static inline void Write16(uint8_t *p, uint16_t v) {
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
memcpy(p, &v, sizeof(v));
__builtin_memcpy(p, &v, sizeof(v));
#else
p[0] = (0x00FF & v) >> 000;
p[1] = (0xFF00 & v) >> 010;
@ -32,7 +31,7 @@ static inline void Write16(uint8_t *p, uint16_t v) {
static inline uint32_t Read32(const uint8_t *p) {
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
uint32_t v;
memcpy(&v, p, sizeof(v));
__builtin_memcpy(&v, p, sizeof(v));
return v;
#else
return ((uint32_t)p[0] << 000 | (uint32_t)p[1] << 010 |
@ -42,7 +41,7 @@ static inline uint32_t Read32(const uint8_t *p) {
static inline void Write32(uint8_t *p, uint32_t v) {
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
memcpy(p, &v, sizeof(v));
__builtin_memcpy(p, &v, sizeof(v));
#else
p[0] = (0x000000FF & v) >> 000;
p[1] = (0x0000FF00 & v) >> 010;
@ -54,7 +53,7 @@ static inline void Write32(uint8_t *p, uint32_t v) {
static inline uint64_t Read64(const uint8_t *p) {
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
uint64_t v;
memcpy(&v, p, sizeof(v));
__builtin_memcpy(&v, p, sizeof(v));
return v;
#else
return ((uint64_t)p[0] << 000 | (uint64_t)p[1] << 010 |
@ -66,7 +65,7 @@ static inline uint64_t Read64(const uint8_t *p) {
static inline void Write64(uint8_t *p, uint64_t v) {
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
memcpy(p, &v, sizeof(v));
__builtin_memcpy(p, &v, sizeof(v));
#else
p[0] = (0x00000000000000FF & v) >> 000;
p[1] = (0x000000000000FF00 & v) >> 010;

View file

@ -18,22 +18,14 @@
*/
#include "libc/calls/calls.h"
#include "libc/calls/struct/iovec.h"
#include "libc/errno.h"
#include "libc/log/check.h"
#include "libc/log/log.h"
#include "libc/stdio/rand.h"
#include "libc/sock/sock.h"
#include "libc/macros.internal.h"
#include "libc/sysv/consts/sig.h"
#include "libc/x/x.h"
#include "net/https/https.h"
#include "third_party/mbedtls/ctr_drbg.h"
#include "third_party/mbedtls/ecp.h"
#include "third_party/mbedtls/error.h"
#include "third_party/mbedtls/net_sockets.h"
#include "third_party/mbedtls/platform.h"
#include "third_party/mbedtls/ssl.h"
#include "tool/build/lib/eztls.h"
#include "tool/build/lib/psk.h"
struct EzTlsBio ezbio;
mbedtls_ssl_config ezconf;

View file

@ -18,7 +18,6 @@
*/
#include "libc/log/check.h"
#include "libc/mem/mem.h"
#include "libc/x/x.h"
#include "tool/build/lib/fds.h"
int MachineFdAdd(struct MachineFds *mf) {

View file

@ -17,20 +17,17 @@
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/math.h"
#include "libc/runtime/pc.internal.h"
#include "libc/runtime/runtime.h"
#include "libc/nt/struct/importobjectheader.internal.h"
#include "libc/str/str.h"
#include "tool/build/lib/case.h"
#include "tool/build/lib/endian.h"
#include "tool/build/lib/flags.h"
#include "tool/build/lib/fpu.h"
#include "tool/build/lib/ldbl.h"
#include "tool/build/lib/machine.h"
#include "tool/build/lib/memory.h"
#include "tool/build/lib/modrm.h"
#include "tool/build/lib/pun.h"
#include "tool/build/lib/throw.h"
#include "tool/build/lib/word.h"
#define FPUREG 0
#define MEMORY 1

View file

@ -19,15 +19,13 @@
#include "libc/assert.h"
#include "libc/calls/calls.h"
#include "libc/calls/struct/stat.h"
#include "libc/errno.h"
#include "libc/log/log.h"
#include "libc/runtime/runtime.h"
#include "libc/stdio/stdio.h"
#include "libc/str/str.h"
#include "libc/sysv/consts/map.h"
#include "libc/sysv/consts/o.h"
#include "libc/sysv/consts/prot.h"
#include "libc/sysv/errfuns.h"
#include "libc/x/x.h"
#include "tool/build/lib/getargs.h"
/**

View file

@ -16,8 +16,6 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/mem/arraylist.internal.h"
#include "libc/mem/arraylist2.internal.h"
#include "libc/intrin/safemacros.internal.h"
#include "libc/mem/mem.h"
#include "libc/nexgen32e/crc32.h"

View file

@ -16,11 +16,7 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/calls/struct/iovec.h"
#include "libc/dce.h"
#include "libc/log/log.h"
#include "libc/nexgen32e/uart.internal.h"
#include "libc/sock/sock.h"
#include "libc/sysv/consts/fileno.h"
#include "libc/sysv/consts/poll.h"
#include "tool/build/lib/ioports.h"

View file

@ -16,9 +16,23 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/macros.internal.h"
#include "libc/mem/mem.h"
#include "libc/str/str.h"
#include "tool/build/lib/iovs.h"
void InitIovs(struct Iovs *ib) {
ib->p = ib->init;
ib->i = 0;
ib->n = ARRAYLEN(ib->init);
}
void FreeIovs(struct Iovs *ib) {
if (ib->p != ib->init) {
free(ib->p);
}
}
/**
* Appends memory region to i/o vector builder.
*/

View file

@ -1,8 +1,6 @@
#ifndef COSMOPOLITAN_TOOL_BUILD_LIB_IOVS_H_
#define COSMOPOLITAN_TOOL_BUILD_LIB_IOVS_H_
#include "libc/calls/struct/iovec.h"
#include "libc/macros.internal.h"
#include "libc/mem/mem.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
@ -12,20 +10,10 @@ struct Iovs {
struct iovec init[2];
};
void InitIovs(struct Iovs *);
void FreeIovs(struct Iovs *);
int AppendIovs(struct Iovs *, void *, size_t);
forceinline void InitIovs(struct Iovs *ib) {
ib->p = ib->init;
ib->i = 0;
ib->n = ARRAYLEN(ib->init);
}
forceinline void FreeIovs(struct Iovs *ib) {
if (ib->p != ib->init) {
free(ib->p);
}
}
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_TOOL_BUILD_LIB_IOVS_H_ */

View file

@ -16,7 +16,6 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/limits.h"
#include "libc/mem/mem.h"
#include "libc/str/str.h"
#include "tool/build/lib/javadown.h"

View file

@ -16,24 +16,22 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/intrin/bits.h"
#include "libc/intrin/popcnt.h"
#include "libc/calls/calls.h"
#include "libc/calls/struct/stat.h"
#include "libc/elf/elf.h"
#include "libc/elf/struct/phdr.h"
#include "libc/intrin/bits.h"
#include "libc/intrin/popcnt.h"
#include "libc/log/check.h"
#include "libc/log/log.h"
#include "libc/macros.internal.h"
#include "libc/nexgen32e/vendor.internal.h"
#include "libc/runtime/pc.internal.h"
#include "libc/runtime/runtime.h"
#include "libc/stdio/stdio.h"
#include "libc/str/str.h"
#include "libc/sysv/consts/fileno.h"
#include "libc/sysv/consts/map.h"
#include "libc/sysv/consts/o.h"
#include "libc/sysv/consts/prot.h"
#include "third_party/xed/x86.h"
#include "tool/build/lib/argv.h"
#include "tool/build/lib/endian.h"
#include "tool/build/lib/loader.h"

View file

@ -16,20 +16,14 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/assert.h"
#include "libc/log/check.h"
#include "libc/log/log.h"
#include "libc/macros.internal.h"
#include "libc/mem/mem.h"
#include "libc/nt/struct/importobjectheader.internal.h"
#include "libc/runtime/memtrack.internal.h"
#include "libc/runtime/pc.internal.h"
#include "libc/str/str.h"
#include "libc/x/x.h"
#include "tool/build/lib/endian.h"
#include "tool/build/lib/machine.h"
#include "tool/build/lib/memory.h"
#include "tool/build/lib/pml4t.h"
#include "tool/build/lib/stats.h"
#include "tool/build/lib/throw.h"
void SetReadAddr(struct Machine *m, int64_t addr, uint32_t size) {

View file

@ -16,21 +16,14 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/assert.h"
#include "libc/calls/calls.h"
#include "libc/log/check.h"
#include "libc/log/log.h"
#include "libc/mem/mem.h"
#include "libc/runtime/pc.internal.h"
#include "libc/runtime/runtime.h"
#include "libc/str/str.h"
#include "libc/sysv/errfuns.h"
#include "libc/x/x.h"
#include "tool/build/lib/buffer.h"
#include "tool/build/lib/endian.h"
#include "tool/build/lib/machine.h"
#include "tool/build/lib/memory.h"
#include "tool/build/lib/pml4t.h"
struct Machine *NewMachine(void) {
struct Machine *m;

View file

@ -18,7 +18,6 @@
*/
#include "libc/log/check.h"
#include "libc/macros.internal.h"
#include "libc/math.h"
#include "libc/mem/mem.h"
#include "libc/str/str.h"
#include "libc/str/unicode.h"
@ -43,8 +42,8 @@ void PrintMessageBox(int fd, const char *msg, long tyn, long txn) {
AppendLines(lines, msg);
h = 3 + lines->n + 3;
w = 4 + GetWidthOfLongestLine(lines) + 4;
x = lrint(txn / 2. - w / 2.);
y = lrint(tyn / 2. - h / 2.);
x = (txn / 2. - w / 2.) + .5;
y = (tyn / 2. - h / 2.) + .5;
bzero(&b, sizeof(b));
AppendFmt(&b, "\e[%d;%dH", y++, x);
for (i = 0; i < w; ++i) AppendStr(&b, " ");

View file

@ -16,8 +16,8 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/intrin/safemacros.internal.h"
#include "libc/fmt/conv.h"
#include "libc/intrin/safemacros.internal.h"
#include "libc/mem/mem.h"
#include "libc/str/str.h"
#include "libc/str/tpdecode.internal.h"

View file

@ -16,23 +16,17 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/mem/arraylist2.internal.h"
#include "libc/assert.h"
#include "libc/fmt/itoa.h"
#include "libc/intrin/bits.h"
#include "libc/intrin/safemacros.internal.h"
#include "libc/fmt/conv.h"
#include "libc/fmt/itoa.h"
#include "libc/log/check.h"
#include "libc/log/log.h"
#include "libc/macros.internal.h"
#include "libc/mem/arraylist2.internal.h"
#include "libc/mem/mem.h"
#include "libc/nexgen32e/bsr.h"
#include "libc/runtime/runtime.h"
#include "libc/str/str.h"
#include "libc/str/thompike.h"
#include "libc/str/tpenc.h"
#include "libc/sysv/errfuns.h"
#include "libc/str/unicode.h"
#include "libc/sysv/errfuns.h"
#include "libc/x/x.h"
#include "tool/build/lib/pty.h"
@ -1178,8 +1172,7 @@ ssize_t PtyWriteInput(struct Pty *pty, const void *data, size_t n) {
m = pty->input.n;
if (i + n * 2 + 1 > m) {
m = MAX(m, 8);
do
m += m >> 1;
do m += m >> 1;
while (i + n * 2 + 1 > m);
if (!(p = realloc(p, m))) {
return -1;

View file

@ -17,6 +17,7 @@
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/macros.internal.h"
#include "libc/str/str.h"
#include "tool/build/lib/endian.h"
#include "tool/build/lib/machine.h"
#include "tool/build/lib/modrm.h"

View file

@ -16,8 +16,6 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/dce.h"
#include "libc/log/log.h"
#include "libc/macros.internal.h"
#include "libc/math.h"
#include "libc/str/str.h"

View file

@ -17,6 +17,7 @@
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/errno.h"
#include "libc/str/str.h"
#include "libc/sysv/consts/af.h"
#include "libc/sysv/consts/at.h"
#include "libc/sysv/consts/clock.h"