Prove that Makefile is fully defined

The whole repository is now buildable with GNU Make Landlock sandboxing.
This proves that no Makefile targets exist which touch files other than
their declared prerequisites. In order to do this, we had to:

  1. Stop code morphing GCC output in package.com and instead run a
     newly introduced FIXUPOBJ.COM command after GCC invocations.

  2. Disable all the crumby Python unit tests that do things like create
     files in the current directory, or rename() files between folders.
     This ended up being a lot of tests, but most of them are still ok.

  3. Introduce an .UNSANDBOXED variable to GNU Make to disable Landlock.
     We currently only do this for things like `make tags`.

  4. This change deletes some GNU Make code that was preventing the
     execve() optimization from working. This means it should no longer
     be necessary in most cases for command invocations to be indirected
     through the cocmd interpreter.

  5. Missing dependencies had to be declared in certain places, in cases
     where they couldn't be automatically determined by MKDEPS.COM

  6. The libcxx header situation has finally been tamed. One of the
     things that makes this difficult is MKDEPS.COM only wants to
     consider the first 64kb of a file, in order to go fast. But libcxx
     likes to have #include lines buried after huge documentation.

  7. An .UNVEIL variable has been introduced to GNU Make just in case
     we ever wish to explicitly specify additional things that need to
     be whitelisted which aren't strictly prerequisites. This works in
     a manner similar to the recently introduced .EXTRA_PREREQS feature.

There's now a new build/bootstrap/make.com prebuilt binary available. It
should no longer be possible to write invalid Makefile code.
This commit is contained in:
Justine Tunney 2022-08-06 03:51:50 -07:00
parent acdf591833
commit cf93ecbbb2
181 changed files with 1902 additions and 1986 deletions

View file

@ -252,14 +252,17 @@ o/$(MODE)/srcs-old.txt: o/$(MODE)/.x $(MAKEFILES) $(call uniq,$(foreach x,$(SRCS
o/$(MODE)/hdrs-old.txt: o/$(MODE)/.x $(MAKEFILES) $(call uniq,$(foreach x,$(HDRS) $(INCS),$(dir $(x)))) o/$(MODE)/hdrs-old.txt: o/$(MODE)/.x $(MAKEFILES) $(call uniq,$(foreach x,$(HDRS) $(INCS),$(dir $(x))))
$(file >$@) $(foreach x,$(HDRS) $(INCS),$(file >>$@,$(x))) $(file >$@) $(foreach x,$(HDRS) $(INCS),$(file >>$@,$(x)))
TAGS: .UNSANDBOXED = 1
TAGS: o/$(MODE)/srcs-old.txt $(SRCS) TAGS: o/$(MODE)/srcs-old.txt $(SRCS)
@$(RM) $@ @$(RM) $@
@$(COMPILE) -ATAGS -T$@ $(TAGS) $(TAGSFLAGS) -L $< -o $@ @$(COMPILE) -ATAGS -T$@ $(TAGS) $(TAGSFLAGS) -L $< -o $@
HTAGS: .UNSANDBOXED = 1
HTAGS: o/$(MODE)/hdrs-old.txt $(HDRS) HTAGS: o/$(MODE)/hdrs-old.txt $(HDRS)
@$(RM) $@ @$(RM) $@
@$(COMPILE) -ATAGS -T$@ build/htags -L $< -o $@ @$(COMPILE) -ATAGS -T$@ build/htags -L $< -o $@
loc: .UNSANDBOXED = 1
loc: o/$(MODE)/tool/build/summy.com loc: o/$(MODE)/tool/build/summy.com
find -name \*.h -or -name \*.c -or -name \*.S | \ find -name \*.h -or -name \*.c -or -name \*.S | \
$(XARGS) wc -l | grep total | awk '{print $$1}' | $< $(XARGS) wc -l | grep total | awk '{print $$1}' | $<

View file

@ -130,14 +130,14 @@ o/$(MODE)/ape/ape-copy-self.o: \
$(OUTPUT_OPTION) \ $(OUTPUT_OPTION) \
-DAPE_NO_MODIFY_SELF $< -DAPE_NO_MODIFY_SELF $<
o/$(MODE)/ape/loader.o: ape/loader.c o/$(MODE)/ape/loader.o: ape/loader.c ape/loader.h
@$(COMPILE) -AOBJECTIFY.c $(CC) -DSUPPORT_VECTOR=0b01111001 -g $(APE_LOADER_FLAGS) @$(COMPILE) -AOBJECTIFY.c $(CC) -DSUPPORT_VECTOR=0b01111001 -g $(APE_LOADER_FLAGS)
o/$(MODE)/ape/loader-gcc.asm: ape/loader.c o/$(MODE)/ape/loader-gcc.asm: ape/loader.c
@$(COMPILE) -AOBJECTIFY.c $(CC) -DSUPPORT_VECTOR=0b01111001 -S -g0 $(APE_LOADER_FLAGS) @$(COMPILE) -AOBJECTIFY.c $(CC) -DSUPPORT_VECTOR=0b01111001 -S -g0 $(APE_LOADER_FLAGS)
o/$(MODE)/ape/loader-clang.asm: ape/loader.c o/$(MODE)/ape/loader-clang.asm: ape/loader.c
@$(COMPILE) -AOBJECTIFY.c $(CLANG) -DSUPPORT_VECTOR=0b01111001 -S -g0 $(APE_LOADER_FLAGS) @$(COMPILE) -AOBJECTIFY.c $(CLANG) -DSUPPORT_VECTOR=0b01111001 -S -g0 $(APE_LOADER_FLAGS)
o/$(MODE)/ape/loader-xnu.o: ape/loader.c o/$(MODE)/ape/loader-xnu.o: ape/loader.c ape/loader.h
@$(COMPILE) -AOBJECTIFY.c $(CC) -DSUPPORT_VECTOR=0b00001000 -g $(APE_LOADER_FLAGS) @$(COMPILE) -AOBJECTIFY.c $(CC) -DSUPPORT_VECTOR=0b00001000 -g $(APE_LOADER_FLAGS)
o/$(MODE)/ape/loader-xnu-gcc.asm: ape/loader.c o/$(MODE)/ape/loader-xnu-gcc.asm: ape/loader.c
@$(COMPILE) -AOBJECTIFY.c $(CC) -DSUPPORT_VECTOR=0b00001000 -S -g0 $(APE_LOADER_FLAGS) @$(COMPILE) -AOBJECTIFY.c $(CC) -DSUPPORT_VECTOR=0b00001000 -S -g0 $(APE_LOADER_FLAGS)

BIN
build/bootstrap/fixupobj.com Executable file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -62,6 +62,7 @@ TOUCH = build/bootstrap/touch.com
PKG = build/bootstrap/package.com PKG = build/bootstrap/package.com
MKDEPS = build/bootstrap/mkdeps.com MKDEPS = build/bootstrap/mkdeps.com
ZIPOBJ = build/bootstrap/zipobj.com ZIPOBJ = build/bootstrap/zipobj.com
FIXUPOBJ = build/bootstrap/fixupobj.com
MKDIR = build/bootstrap/mkdir.com -p MKDIR = build/bootstrap/mkdir.com -p
COMPILE = build/bootstrap/compile.com -V9 -P4096 $(QUOTA) COMPILE = build/bootstrap/compile.com -V9 -P4096 $(QUOTA)
@ -165,7 +166,7 @@ DEFAULT_CPPFLAGS = \
-DMODE='"$(MODE)"' \ -DMODE='"$(MODE)"' \
-DIMAGE_BASE_VIRTUAL=$(IMAGE_BASE_VIRTUAL) \ -DIMAGE_BASE_VIRTUAL=$(IMAGE_BASE_VIRTUAL) \
-nostdinc \ -nostdinc \
-iquote. -iquote .
DEFAULT_CFLAGS = \ DEFAULT_CFLAGS = \
-std=gnu2x -std=gnu2x
@ -232,7 +233,7 @@ cpp.flags = \
$(CONFIG_CPPFLAGS) \ $(CONFIG_CPPFLAGS) \
$(CPPFLAGS) \ $(CPPFLAGS) \
$(OVERRIDE_CPPFLAGS) \ $(OVERRIDE_CPPFLAGS) \
-includelibc/integral/normalize.inc -include libc/integral/normalize.inc
copt.flags = \ copt.flags = \
$(TARGET_ARCH) \ $(TARGET_ARCH) \

View file

@ -25,11 +25,8 @@ o/%.o: %.S ; @$(COMPILE) -AOBJECTIFY.S $(OBJECTIFY.S) $(
o/%.o: o/%.S ; @$(COMPILE) -AOBJECTIFY.S $(OBJECTIFY.S) $(OUTPUT_OPTION) $< o/%.o: o/%.S ; @$(COMPILE) -AOBJECTIFY.S $(OBJECTIFY.S) $(OUTPUT_OPTION) $<
o/%.s: %.i ; @$(COMPILE) -ACOMPILE.i $(COMPILE.i) $(OUTPUT_OPTION) $< o/%.s: %.i ; @$(COMPILE) -ACOMPILE.i $(COMPILE.i) $(OUTPUT_OPTION) $<
o/%.s: o/%.i ; @$(COMPILE) -ACOMPILE.i $(COMPILE.i) $(OUTPUT_OPTION) $< o/%.s: o/%.i ; @$(COMPILE) -ACOMPILE.i $(COMPILE.i) $(OUTPUT_OPTION) $<
o/%.o: %.cc ; @$(COMPILE) -AOBJECTIFY.cxx $(OBJECTIFY.cxx) $(OUTPUT_OPTION) $<
o/%.o: o/%.cc ; @$(COMPILE) -AOBJECTIFY.cxx $(OBJECTIFY.cxx) $(OUTPUT_OPTION) $<
o/%.lds: %.lds ; @$(COMPILE) -APREPROCESS $(PREPROCESS.lds) $(OUTPUT_OPTION) $< o/%.lds: %.lds ; @$(COMPILE) -APREPROCESS $(PREPROCESS.lds) $(OUTPUT_OPTION) $<
o/%.inc: %.h ; @$(COMPILE) -APREPROCESS $(PREPROCESS) $(OUTPUT_OPTION) -D__ASSEMBLER__ -P $< o/%.inc: %.h ; @$(COMPILE) -APREPROCESS $(PREPROCESS) $(OUTPUT_OPTION) -D__ASSEMBLER__ -P $<
o/%.okk: % ; @$(COMPILE) -ACHECK.h $(COMPILE.cxx) -xc++ -g0 -o $@ $<
o/%.greg.o: %.greg.c ; @$(COMPILE) -AOBJECTIFY.greg $(OBJECTIFY.greg.c) $(OUTPUT_OPTION) $< o/%.greg.o: %.greg.c ; @$(COMPILE) -AOBJECTIFY.greg $(OBJECTIFY.greg.c) $(OUTPUT_OPTION) $<
o/%.zip.o: o/% ; @$(COMPILE) -AZIPOBJ $(ZIPOBJ) $(ZIPOBJ_FLAGS) $(OUTPUT_OPTION) $< o/%.zip.o: o/% ; @$(COMPILE) -AZIPOBJ $(ZIPOBJ) $(ZIPOBJ_FLAGS) $(OUTPUT_OPTION) $<
@ -38,10 +35,8 @@ o/$(MODE)/%.o: %.s ; @$(COMPILE) -AOBJECTIFY.s $(OBJECTIFY.s) $(
o/$(MODE)/%.o: o/$(MODE)/%.s ; @$(COMPILE) -AOBJECTIFY.s $(OBJECTIFY.s) $(OUTPUT_OPTION) $< o/$(MODE)/%.o: o/$(MODE)/%.s ; @$(COMPILE) -AOBJECTIFY.s $(OBJECTIFY.s) $(OUTPUT_OPTION) $<
o/$(MODE)/%.s: %.S ; @$(COMPILE) -APREPROCESS $(PREPROCESS) $(OUTPUT_OPTION) $< o/$(MODE)/%.s: %.S ; @$(COMPILE) -APREPROCESS $(PREPROCESS) $(OUTPUT_OPTION) $<
o/$(MODE)/%.s: o/$(MODE)/%.S ; @$(COMPILE) -APREPROCESS $(PREPROCESS) $(OUTPUT_OPTION) $< o/$(MODE)/%.s: o/$(MODE)/%.S ; @$(COMPILE) -APREPROCESS $(PREPROCESS) $(OUTPUT_OPTION) $<
o/$(MODE)/%.o: %.c ; @$(COMPILE) -AOBJECTIFY.c $(OBJECTIFY.c) $(OUTPUT_OPTION) $<
o/$(MODE)/%.o: %.f ; @$(COMPILE) -AOBJECTIFY.f $(OBJECTIFY.f) $(OUTPUT_OPTION) $< o/$(MODE)/%.o: %.f ; @$(COMPILE) -AOBJECTIFY.f $(OBJECTIFY.f) $(OUTPUT_OPTION) $<
o/$(MODE)/%.o: %.F ; @$(COMPILE) -AOBJECTIFY.F $(OBJECTIFY.F) $(OUTPUT_OPTION) $< o/$(MODE)/%.o: %.F ; @$(COMPILE) -AOBJECTIFY.F $(OBJECTIFY.F) $(OUTPUT_OPTION) $<
o/$(MODE)/%.o: o/$(MODE)/%.c ; @$(COMPILE) -AOBJECTIFY.c $(OBJECTIFY.c) $(OUTPUT_OPTION) $<
o/$(MODE)/%.ss: %.c ; @$(COMPILE) -ACOMPILE.c $(COMPILE.c) $(OUTPUT_OPTION) $< o/$(MODE)/%.ss: %.c ; @$(COMPILE) -ACOMPILE.c $(COMPILE.c) $(OUTPUT_OPTION) $<
o/$(MODE)/%.ss: o/$(MODE)/%.c ; @$(COMPILE) -AOBJECTIFY.s $(COMPILE.c) $(OUTPUT_OPTION) $< o/$(MODE)/%.ss: o/$(MODE)/%.c ; @$(COMPILE) -AOBJECTIFY.s $(COMPILE.c) $(OUTPUT_OPTION) $<
o/$(MODE)/%.i: %.S ; @$(COMPILE) -APREPROCESS $(PREPROCESS) $(OUTPUT_OPTION) $< o/$(MODE)/%.i: %.S ; @$(COMPILE) -APREPROCESS $(PREPROCESS) $(OUTPUT_OPTION) $<
@ -55,9 +50,7 @@ o/$(MODE)/%.o: o/$(MODE)/%.S ; @$(COMPILE) -AOBJECTIFY.S $(OBJECTIFY.S) $(
o/$(MODE)/%.s: %.i ; @$(COMPILE) -ACOMPILE.i $(COMPILE.i) $(OUTPUT_OPTION) $< o/$(MODE)/%.s: %.i ; @$(COMPILE) -ACOMPILE.i $(COMPILE.i) $(OUTPUT_OPTION) $<
o/$(MODE)/%.s: o/$(MODE)/%.i ; @$(COMPILE) -ACOMPILE.i $(COMPILE.i) $(OUTPUT_OPTION) $< o/$(MODE)/%.s: o/$(MODE)/%.i ; @$(COMPILE) -ACOMPILE.i $(COMPILE.i) $(OUTPUT_OPTION) $<
o/$(MODE)/%.o: %.cc ; @$(COMPILE) -AOBJECTIFY.cxx $(OBJECTIFY.cxx) $(OUTPUT_OPTION) $< o/$(MODE)/%.o: %.cc ; @$(COMPILE) -AOBJECTIFY.cxx $(OBJECTIFY.cxx) $(OUTPUT_OPTION) $<
o/$(MODE)/%.o: o/$(MODE)/%.cc ; @$(COMPILE) -AOBJECTIFY.cxx $(OBJECTIFY.cxx) $(OUTPUT_OPTION) $<
o/$(MODE)/%.lds: %.lds ; @$(COMPILE) -APREPROCESS $(PREPROCESS.lds) $(OUTPUT_OPTION) $< o/$(MODE)/%.lds: %.lds ; @$(COMPILE) -APREPROCESS $(PREPROCESS.lds) $(OUTPUT_OPTION) $<
o/$(MODE)/%.okk: % ; @$(COMPILE) -ACHECK.h $(COMPILE.cxx) -xc++ -g0 -o $@ $<
o/$(MODE)/%.cxx.o: %.c ; @$(COMPILE) -AOBJECTIFY.cxx $(OBJECTIFY.cxx) -xc++ $(OUTPUT_OPTION) $< o/$(MODE)/%.cxx.o: %.c ; @$(COMPILE) -AOBJECTIFY.cxx $(OBJECTIFY.cxx) -xc++ $(OUTPUT_OPTION) $<
o/$(MODE)/%.o: %.greg.c ; @$(COMPILE) -AOBJECTIFY.greg $(OBJECTIFY.greg.c) $(OUTPUT_OPTION) $< o/$(MODE)/%.o: %.greg.c ; @$(COMPILE) -AOBJECTIFY.greg $(OBJECTIFY.greg.c) $(OUTPUT_OPTION) $<
o/$(MODE)/%.greg.o: %.greg.c ; @$(COMPILE) -AOBJECTIFY.greg $(OBJECTIFY.greg.c) $(OUTPUT_OPTION) $< o/$(MODE)/%.greg.o: %.greg.c ; @$(COMPILE) -AOBJECTIFY.greg $(OBJECTIFY.greg.c) $(OUTPUT_OPTION) $<
@ -78,6 +71,26 @@ o/$(MODE)/%-clang.asm: %.c ; @$(COMPILE) -AOBJECTIFY.c $(OBJECTIFY.c) -S
o/$(MODE)/%-clang.asm: %.cc ; @$(COMPILE) -AOBJECTIFY.c $(OBJECTIFY.cxx) -S -g0 $(OUTPUT_OPTION) $< o/$(MODE)/%-clang.asm: %.cc ; @$(COMPILE) -AOBJECTIFY.c $(OBJECTIFY.cxx) -S -g0 $(OUTPUT_OPTION) $<
o/$(MODE)/%-clang.asm: CC = $(CLANG) o/$(MODE)/%-clang.asm: CC = $(CLANG)
o/%.o: %.cc
@$(COMPILE) -AOBJECTIFY.cxx $(OBJECTIFY.cxx) $(OUTPUT_OPTION) $<
@$(COMPILE) -AFIXUPOBJ -T$@ $(FIXUPOBJ) $@
o/%.o: o/%.cc
@$(COMPILE) -AOBJECTIFY.cxx $(OBJECTIFY.cxx) $(OUTPUT_OPTION) $<
@$(COMPILE) -AFIXUPOBJ -T$@ $(FIXUPOBJ) $@
o/$(MODE)/%.o: %.c
@$(COMPILE) -AOBJECTIFY.c $(OBJECTIFY.c) $(OUTPUT_OPTION) $<
@$(COMPILE) -AFIXUPOBJ -T$@ $(FIXUPOBJ) $@
o/$(MODE)/%.o: o/$(MODE)/%.c
@$(COMPILE) -AOBJECTIFY.c $(OBJECTIFY.c) $(OUTPUT_OPTION) $<
@$(COMPILE) -AFIXUPOBJ -T$@ $(FIXUPOBJ) $@
o/$(MODE)/%.o: o/$(MODE)/%.cc
@$(COMPILE) -AOBJECTIFY.cxx $(OBJECTIFY.cxx) $(OUTPUT_OPTION) $<
@$(COMPILE) -AFIXUPOBJ -T$@ $(FIXUPOBJ) $@
o/%.a: o/%.a:
$(file >$@.args,$^) $(file >$@.args,$^)
@$(COMPILE) -AARCHIVE -T$@ $(AR) $(ARFLAGS) $@ @$@.args @$(COMPILE) -AARCHIVE -T$@ $(AR) $(ARFLAGS) $@ @$@.args
@ -109,11 +122,17 @@ o/$(MODE)/%: o/$(MODE)/%.com o/$(MODE)/tool/build/cp.com o/$(MODE)/tool/build/as
# TODO(jart): find a way to generate dependencies # TODO(jart): find a way to generate dependencies
# or alternatively disable sandboxing # or alternatively disable sandboxing
o/%.h.ok: %.h o/%.h.ok: %.h
# @$(COMPILE) -ACHECK.h -T$@ build/bootstrap/touch.com $@ @$(COMPILE) -ACHECK.h -T$@ build/bootstrap/touch.com $@
@$(COMPILE) -ACHECK.h $(COMPILE.c) -xc -g0 -o $@ $< # @$(COMPILE) -ACHECK.h $(COMPILE.c) -xc -g0 -o $@ $<
o/$(MODE)/%.h.ok: %.h o/$(MODE)/%.h.ok: %.h
# @$(COMPILE) -ACHECK.h -T$@ build/bootstrap/touch.com $@ @$(COMPILE) -ACHECK.h -T$@ build/bootstrap/touch.com $@
@$(COMPILE) -ACHECK.h $(COMPILE.c) -xc -g0 -o $@ $< # @$(COMPILE) -ACHECK.h $(COMPILE.c) -xc -g0 -o $@ $<
o/$(MODE)/%.hh.ok: %.hh o/$(MODE)/%.hh.ok: %.hh
# @$(COMPILE) -ACHECK.h -T$@ build/bootstrap/touch.com $@ @$(COMPILE) -ACHECK.h -T$@ build/bootstrap/touch.com $@
@$(COMPILE) -ACHECK.h $(COMPILE.cxx) -xc++ -g0 -o $@ $< # @$(COMPILE) -ACHECK.h $(COMPILE.cxx) -xc++ -g0 -o $@ $<
o/%.okk: %
@$(COMPILE) -ACHECK.h -T$@ build/bootstrap/touch.com $@
# @$(COMPILE) -ACHECK.h $(COMPILE.cxx) -xc++ -g0 -o $@ $<
o/$(MODE)/%.okk: %
@$(COMPILE) -ACHECK.h -T$@ build/bootstrap/touch.com $@
# @$(COMPILE) -ACHECK.h $(COMPILE.cxx) -xc++ -g0 -o $@ $<

View file

@ -25,6 +25,7 @@
#include "libc/mem/mem.h" #include "libc/mem/mem.h"
#include "libc/runtime/runtime.h" #include "libc/runtime/runtime.h"
#include "libc/sock/sock.h" #include "libc/sock/sock.h"
#include "libc/sock/struct/pollfd.h"
#include "libc/str/str.h" #include "libc/str/str.h"
#include "libc/sysv/consts/poll.h" #include "libc/sysv/consts/poll.h"
#include "libc/sysv/errfuns.h" #include "libc/sysv/errfuns.h"

View file

@ -21,6 +21,7 @@
#include "libc/calls/termios.h" #include "libc/calls/termios.h"
#include "libc/errno.h" #include "libc/errno.h"
#include "libc/sock/sock.h" #include "libc/sock/sock.h"
#include "libc/sock/struct/pollfd.h"
#include "libc/sysv/consts/poll.h" #include "libc/sysv/consts/poll.h"
#include "libc/sysv/consts/termios.h" #include "libc/sysv/consts/termios.h"

View file

@ -30,6 +30,8 @@
#include "libc/runtime/stack.h" #include "libc/runtime/stack.h"
#include "libc/runtime/sysconf.h" #include "libc/runtime/sysconf.h"
#include "libc/sock/sock.h" #include "libc/sock/sock.h"
#include "libc/sock/struct/pollfd.h"
#include "libc/sock/struct/sockaddr.h"
#include "libc/str/str.h" #include "libc/str/str.h"
#include "libc/sysv/consts/af.h" #include "libc/sysv/consts/af.h"
#include "libc/sysv/consts/clock.h" #include "libc/sysv/consts/clock.h"

View file

@ -14,6 +14,8 @@
#include "libc/macros.internal.h" #include "libc/macros.internal.h"
#include "libc/runtime/runtime.h" #include "libc/runtime/runtime.h"
#include "libc/sock/sock.h" #include "libc/sock/sock.h"
#include "libc/sock/struct/linger.h"
#include "libc/sock/struct/pollfd.h"
#include "libc/stdio/stdio.h" #include "libc/stdio/stdio.h"
#include "libc/str/str.h" #include "libc/str/str.h"
#include "libc/sysv/consts/af.h" #include "libc/sysv/consts/af.h"
@ -34,7 +36,8 @@
* Here's an example usage: * Here's an example usage:
* *
* make -j8 o//examples/nc.com * make -j8 o//examples/nc.com
* printf 'GET /\r\nHost: justine.lol\r\n\r\n' | o//examples/nc.com justine.lol 80 * printf 'GET /\r\nHost: justine.lol\r\n\r\n' | o//examples/nc.com
* justine.lol 80
* *
* Once upon time we called this command "telnet" * Once upon time we called this command "telnet"
*/ */

View file

@ -28,6 +28,7 @@
#include "libc/mem/mem.h" #include "libc/mem/mem.h"
#include "libc/runtime/runtime.h" #include "libc/runtime/runtime.h"
#include "libc/sock/sock.h" #include "libc/sock/sock.h"
#include "libc/sock/struct/pollfd.h"
#include "libc/stdio/stdio.h" #include "libc/stdio/stdio.h"
#include "libc/str/str.h" #include "libc/str/str.h"
#include "libc/sysv/consts/ex.h" #include "libc/sysv/consts/ex.h"

View file

@ -32,11 +32,10 @@
* . Formatted as per Cosmopolitan's standards. * . Formatted as per Cosmopolitan's standards.
*/ */
#include <libc/log/log.h>
#include <libc/stdio/stdio.h>
#include "libc/fmt/conv.h" #include "libc/fmt/conv.h"
#include "libc/fmt/fmt.h" #include "libc/fmt/fmt.h"
#include "libc/log/log.h"
#include "libc/stdio/stdio.h"
enum { PICOL_OK, PICOL_ERR, PICOL_RETURN, PICOL_BREAK, PICOL_CONTINUE }; enum { PICOL_OK, PICOL_ERR, PICOL_RETURN, PICOL_BREAK, PICOL_CONTINUE };
enum { PT_ESC, PT_STR, PT_CMD, PT_VAR, PT_SEP, PT_EOL, PT_EOF }; enum { PT_ESC, PT_STR, PT_CMD, PT_VAR, PT_SEP, PT_EOL, PT_EOF };

View file

@ -7,9 +7,13 @@
http://creativecommons.org/publicdomain/zero/1.0/ │ http://creativecommons.org/publicdomain/zero/1.0/ │
*/ */
#endif #endif
#include "libc/dce.h"
#include "libc/stdio/stdio.h" #include "libc/stdio/stdio.h"
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
if (IsWindows()) {
system("notepad"); system("notepad");
return 0; } else {
system("ls | tr a-z A-Z");
}
} }

View file

@ -29,6 +29,7 @@
#include "libc/runtime/runtime.h" #include "libc/runtime/runtime.h"
#include "libc/sock/internal.h" #include "libc/sock/internal.h"
#include "libc/sock/sock.h" #include "libc/sock/sock.h"
#include "libc/sock/struct/ifconf.h"
#include "libc/str/str.h" #include "libc/str/str.h"
#include "libc/sysv/consts/af.h" #include "libc/sysv/consts/af.h"
#include "libc/sysv/consts/iff.h" #include "libc/sysv/consts/iff.h"

View file

@ -26,6 +26,8 @@
#include "libc/mem/mem.h" #include "libc/mem/mem.h"
#include "libc/sock/internal.h" #include "libc/sock/internal.h"
#include "libc/sock/sock.h" #include "libc/sock/sock.h"
#include "libc/sock/struct/ifconf.h"
#include "libc/sock/struct/ifreq.h"
#include "libc/str/str.h" #include "libc/str/str.h"
#include "libc/sysv/consts/af.h" #include "libc/sysv/consts/af.h"
#include "libc/sysv/consts/sio.h" #include "libc/sysv/consts/sio.h"

View file

@ -1,7 +1,7 @@
/*-*- mode:unix-assembly; indent-tabs-mode:t; tab-width:8; coding:utf-8 -*-│ /*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
vi: set et ft=asm ts=8 tw=8 fenc=utf-8 :vi vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi
Copyright 2020 Justine Alexandra Roberts Tunney Copyright 2022 Justine Alexandra Roberts Tunney
Permission to use, copy, modify, and/or distribute this software for Permission to use, copy, modify, and/or distribute this software for
any purpose with or without fee is hereby granted, provided that the any purpose with or without fee is hereby granted, provided that the
@ -16,30 +16,62 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "libc/runtime/runtime.h" #include "libc/calls/calls.h"
#include "libc/dce.h" #include "libc/dce.h"
#include "libc/macros.internal.h" #include "libc/macros.internal.h"
#include "libc/nt/systeminfo.h"
#include "libc/runtime/runtime.h"
#include "libc/str/str.h"
#define kTmpPathMax 80 /**
* RII constant holding temporary file directory.
*
* The order of precedence is:
*
* - $TMPDIR/
* - GetTempPath()
* - /tmp/
*
* This guarantees trailing slash.
*/
char kTmpPath[PATH_MAX];
// RII constant holding /tmp/ directory. static inline int IsAlpha(int c) {
// return ('A' <= c && c <= 'Z') || ('a' <= c && c <= 'z');
// @note on win32 this is firstNonNull($TMP, $TEMP, $PWD) }
// @note guarantees trailing slash if non-empty
.initbss 300,_init_kTmpPath
kTmpPath:
.zero kTmpPathMax
.endobj kTmpPath,globl
.previous
.init.start 300,_init_kTmpPath __attribute__((__constructor__)) static void kTmpPathInit(void) {
movl $'/'|'t'<<010|'m'<<020|'p'<<030,(%rdi) int i;
movw $'/',4(%rdi) char *s;
#if SupportsWindows() uint32_t n;
pushpop kTmpPathMax,%rdx char16_t path16[PATH_MAX];
ezlea GetTempPathA_flunk,ax
call __getntsyspath if ((s = getenv("TMPDIR")) && (n = strlen(s)) < PATH_MAX) {
#else memcpy(kTmpPath, s, n);
add $kTmpPathMax,%rdi if (n && kTmpPath[n - 1] != '/') {
#endif kTmpPath[n + 0] = '/';
.init.end 300,_init_kTmpPath kTmpPath[n + 1] = 0;
}
return;
}
if (IsWindows() &&
((n = GetTempPath(ARRAYLEN(path16), path16)) && n < ARRAYLEN(path16))) {
// turn c:\foo\bar\ into c:/foo/bar/
for (i = 0; i < n; ++i) {
if (path16[i] == '\\') {
path16[i] = '/';
}
}
// turn c:/... into /c/...
if (IsAlpha(path16[0]) && path16[1] == ':' && path16[2] == '/') {
path16[1] = path16[0];
path16[0] = '/';
path16[2] = '/';
}
tprecode16to8(kTmpPath, sizeof(kTmpPath), path16);
return;
}
strcpy(kTmpPath, "/tmp/");
}

View file

@ -7,6 +7,8 @@ struct iovec {
size_t iov_len; size_t iov_len;
}; };
ssize_t readv(int, const struct iovec *, int);
ssize_t writev(int, const struct iovec *, int);
ssize_t preadv(int, struct iovec *, int, int64_t); ssize_t preadv(int, struct iovec *, int, int64_t);
ssize_t pwritev(int, const struct iovec *, int, int64_t); ssize_t pwritev(int, const struct iovec *, int, int64_t);
ssize_t vmsplice(int, const struct iovec *, int64_t, uint32_t); ssize_t vmsplice(int, const struct iovec *, int64_t, uint32_t);

View file

@ -3,6 +3,7 @@
#include "libc/calls/weirdtypes.h" #include "libc/calls/weirdtypes.h"
#include "libc/dns/resolvconf.h" #include "libc/dns/resolvconf.h"
#include "libc/sock/sock.h" #include "libc/sock/sock.h"
#include "libc/sock/struct/sockaddr.h"
#define DNS_PORT 53 #define DNS_PORT 53
#define DNS_NAME_MAX 253 #define DNS_NAME_MAX 253

View file

@ -24,6 +24,7 @@
#include "libc/macros.internal.h" #include "libc/macros.internal.h"
#include "libc/runtime/runtime.h" #include "libc/runtime/runtime.h"
#include "libc/sock/sock.h" #include "libc/sock/sock.h"
#include "libc/sock/struct/sockaddr.h"
#include "libc/stdio/stdio.h" #include "libc/stdio/stdio.h"
static struct ResolvConf *g_resolvconf; static struct ResolvConf *g_resolvconf;

View file

@ -1,6 +1,6 @@
#ifndef COSMOPOLITAN_LIBC_DNS_HOSTSTXT_H_ #ifndef COSMOPOLITAN_LIBC_DNS_HOSTSTXT_H_
#define COSMOPOLITAN_LIBC_DNS_HOSTSTXT_H_ #define COSMOPOLITAN_LIBC_DNS_HOSTSTXT_H_
#include "libc/sock/sock.h" #include "libc/sock/struct/sockaddr.h"
#include "libc/stdio/stdio.h" #include "libc/stdio/stdio.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0) #if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_ COSMOPOLITAN_C_START_

View file

@ -38,8 +38,8 @@ static textwindows noasan bool IsBeingDebugged(void) {
*/ */
int IsDebuggerPresent(bool force) { int IsDebuggerPresent(bool force) {
/* asan runtime depends on this function */ /* asan runtime depends on this function */
int fd, res;
ssize_t got; ssize_t got;
int e, fd, res;
char *p, buf[1024]; char *p, buf[1024];
if (!force && IsGenuineCosmo()) return 0; if (!force && IsGenuineCosmo()) return 0;
if (!force && __getenv(environ, "HEISENDEBUG")) return 0; if (!force && __getenv(environ, "HEISENDEBUG")) return 0;
@ -47,6 +47,7 @@ int IsDebuggerPresent(bool force) {
if (__isworker) return false; if (__isworker) return false;
if (!PLEDGED(RPATH)) return false; if (!PLEDGED(RPATH)) return false;
res = 0; res = 0;
e = errno;
if ((fd = __sysv_open("/proc/self/status", O_RDONLY, 0)) >= 0) { if ((fd = __sysv_open("/proc/self/status", O_RDONLY, 0)) >= 0) {
if ((got = __sysv_read(fd, buf, sizeof(buf) - 1)) > 0) { if ((got = __sysv_read(fd, buf, sizeof(buf) - 1)) > 0) {
buf[got] = '\0'; buf[got] = '\0';
@ -57,5 +58,6 @@ int IsDebuggerPresent(bool force) {
} }
__sysv_close(fd); __sysv_close(fd);
} }
errno = e;
return res; return res;
} }

View file

@ -5,7 +5,7 @@ PKGS += LIBC
LIBC_HDRS = $(filter %.h,$(LIBC_FILES)) LIBC_HDRS = $(filter %.h,$(LIBC_FILES))
LIBC_INCS = $(filter %.inc,$(LIBC_FILES)) LIBC_INCS = $(filter %.inc,$(LIBC_FILES))
LIBC_FILES := $(wildcard libc/*) LIBC_FILES := $(wildcard libc/*) $(wildcard libc/isystem/*)
LIBC_CHECKS = $(LIBC_HDRS:%=o/$(MODE)/%.ok) LIBC_CHECKS = $(LIBC_HDRS:%=o/$(MODE)/%.ok)
.PHONY: o/$(MODE)/libc .PHONY: o/$(MODE)/libc

View file

@ -18,7 +18,6 @@
*/ */
#include "libc/macros.internal.h" #include "libc/macros.internal.h"
.real .real
.code16 # .code32 .code64
// Function Profiling Hook. // Function Profiling Hook.
// cc -pg adds this to the start of global functions. // cc -pg adds this to the start of global functions.

View file

@ -143,7 +143,8 @@ o/libc/nt/ntdllimport.inc: \
libc/nt/ntdllimport.h \ libc/nt/ntdllimport.h \
libc/macros.internal.h \ libc/macros.internal.h \
libc/macros.internal.inc \ libc/macros.internal.inc \
libc/macros-cpp.internal.inc libc/macros-cpp.internal.inc \
libc/intrin/asancodes.h
#─────────────────────────────────────────────────────────────────────────────── #───────────────────────────────────────────────────────────────────────────────
@ -368,11 +369,17 @@ $(LIBC_NT_PSAPI_A).pkg: \
#─────────────────────────────────────────────────────────────────────────────── #───────────────────────────────────────────────────────────────────────────────
$(LIBC_NT_OBJS): o/libc/nt/codegen.inc $(LIBC_NT_OBJS): \
o/libc/nt/codegen.inc
o/libc/nt/codegen.inc: \ o/libc/nt/codegen.inc: \
ape/idata.internal.h \ ape/idata.internal.h \
ape/macros.internal.h ape/macros.internal.h \
ape/relocations.h \
libc/macros.internal.h \
libc/macros.internal.inc \
libc/macros-cpp.internal.inc \
libc/intrin/asancodes.h
.PHONY: o/$(MODE)/libc/nt .PHONY: o/$(MODE)/libc/nt
o/$(MODE)/libc/nt: \ o/$(MODE)/libc/nt: \

View file

@ -7,6 +7,7 @@
#include "libc/nt/struct/pollfd.h" #include "libc/nt/struct/pollfd.h"
#include "libc/nt/struct/timeval.h" #include "libc/nt/struct/timeval.h"
#include "libc/sock/sock.h" #include "libc/sock/sock.h"
#include "libc/sock/struct/sockaddr.h"
/* ░▓█████████████████████████████████████████████▓▒ /* ░▓█████████████████████████████████████████████▓▒

View file

@ -35,7 +35,7 @@ static double rt_log2(double x)
static int mp, sccfirst; static int mp, sccfirst;
static unsigned int monte[MONTEN]; static unsigned int monte[MONTEN];
static long inmont, mcount; static long inmont, mcount_;
static double cexp_, incirc, montex, montey, montepi, static double cexp_, incirc, montex, montey, montepi,
scc, sccun, sccu0, scclast, scct1, scct2, scct3, scc, sccun, sccu0, scclast, scct1, scct2, scct3,
ent, chisq, datasum; ent, chisq, datasum;
@ -55,7 +55,7 @@ void rt_init(int binmode)
datasum = 0.0; /* Clear sum of bytes for arithmetic mean */ datasum = 0.0; /* Clear sum of bytes for arithmetic mean */
mp = 0; /* Reset Monte Carlo accumulator pointer */ mp = 0; /* Reset Monte Carlo accumulator pointer */
mcount = 0; /* Clear Monte Carlo tries */ mcount_ = 0; /* Clear Monte Carlo tries */
inmont = 0; /* Clear Monte Carlo inside count */ inmont = 0; /* Clear Monte Carlo inside count */
incirc = 65535.0 * 65535.0;/* In-circle distance for Monte Carlo */ incirc = 65535.0 * 65535.0;/* In-circle distance for Monte Carlo */
@ -98,7 +98,7 @@ void rt_add(void *buf, int bufl)
int mj; int mj;
mp = 0; mp = 0;
mcount++; mcount_++;
montex = montey = 0; montex = montey = 0;
for (mj = 0; mj < MONTEN / 2; mj++) { for (mj = 0; mj < MONTEN / 2; mj++) {
montex = (montex * 256.0) + monte[mj]; montex = (montex * 256.0) + monte[mj];
@ -172,7 +172,7 @@ void rt_end(double *r_ent, double *r_chisq, double *r_mean,
/* Calculate Monte Carlo value for PI from percentage of hits /* Calculate Monte Carlo value for PI from percentage of hits
within the circle */ within the circle */
montepi = 4.0 * (((double) inmont) / mcount); montepi = 4.0 * (((double) inmont) / mcount_);
/* Return results through arguments */ /* Return results through arguments */

View file

@ -21,7 +21,7 @@ extern char *program_invocation_name; /* RII */
extern char *program_invocation_short_name; /* RII */ extern char *program_invocation_short_name; /* RII */
extern uint64_t __syscount; /* RII */ extern uint64_t __syscount; /* RII */
extern uint64_t kStartTsc; /* RII */ extern uint64_t kStartTsc; /* RII */
extern const char kTmpPath[]; /* RII */ extern char kTmpPath[]; /* RII */
extern const char kNtSystemDirectory[]; /* RII */ extern const char kNtSystemDirectory[]; /* RII */
extern const char kNtWindowsDirectory[]; /* RII */ extern const char kNtWindowsDirectory[]; /* RII */
extern unsigned char _base[] forcealign(PAGESIZE); /* αpε */ extern unsigned char _base[] forcealign(PAGESIZE); /* αpε */

View file

@ -17,7 +17,7 @@
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "libc/intrin/asan.internal.h" #include "libc/intrin/asan.internal.h"
#include "libc/sock/sock.h" #include "libc/sock/struct/msghdr.h"
bool __asan_is_valid_msghdr(const struct msghdr *msg) { bool __asan_is_valid_msghdr(const struct msghdr *msg) {
if (!__asan_is_valid(msg, sizeof(struct msghdr))) return false; if (!__asan_is_valid(msg, sizeof(struct msghdr))) return false;

View file

@ -22,6 +22,7 @@
#include "libc/nt/winsock.h" #include "libc/nt/winsock.h"
#include "libc/sock/internal.h" #include "libc/sock/internal.h"
#include "libc/sock/sock.h" #include "libc/sock/sock.h"
#include "libc/sock/struct/linger.h"
#include "libc/sock/syscall_fd.internal.h" #include "libc/sock/syscall_fd.internal.h"
#include "libc/str/str.h" #include "libc/str/str.h"
#include "libc/sysv/consts/so.h" #include "libc/sysv/consts/so.h"

View file

@ -17,6 +17,7 @@
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "libc/sock/sock.h" #include "libc/sock/sock.h"
#include "libc/sock/struct/sockaddr.h"
/** /**
* Converts dotted IPv4 address string to network order binary. * Converts dotted IPv4 address string to network order binary.

View file

@ -27,6 +27,7 @@
*/ */
#include "libc/fmt/conv.h" #include "libc/fmt/conv.h"
#include "libc/sock/sock.h" #include "libc/sock/sock.h"
#include "libc/sock/struct/sockaddr.h"
#include "libc/str/str.h" #include "libc/str/str.h"
asm(".ident\t\"\\n\\n\ asm(".ident\t\"\\n\\n\

View file

@ -18,6 +18,7 @@
*/ */
#include "libc/fmt/itoa.h" #include "libc/fmt/itoa.h"
#include "libc/sock/sock.h" #include "libc/sock/sock.h"
#include "libc/sock/struct/sockaddr.h"
/** /**
* Converts IPv4 network address to array. * Converts IPv4 network address to array.

View file

@ -5,6 +5,8 @@
#include "libc/nt/winsock.h" #include "libc/nt/winsock.h"
#include "libc/sock/select.h" #include "libc/sock/select.h"
#include "libc/sock/sock.h" #include "libc/sock/sock.h"
#include "libc/sock/struct/msghdr.h"
#include "libc/sock/struct/pollfd.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0) #if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_ COSMOPOLITAN_C_START_

14
libc/sock/ppoll.h Normal file
View file

@ -0,0 +1,14 @@
#ifndef COSMOPOLITAN_LIBC_SOCK_PPOLL_H_
#define COSMOPOLITAN_LIBC_SOCK_PPOLL_H_
#include "libc/calls/struct/sigset.h"
#include "libc/calls/struct/timespec.h"
#include "libc/sock/struct/pollfd.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
int ppoll(struct pollfd *, uint64_t, const struct timespec *,
const struct sigset *);
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_SOCK_PPOLL_H_ */

View file

@ -21,6 +21,7 @@
#include "libc/macros.internal.h" #include "libc/macros.internal.h"
#include "libc/nt/struct/linger.h" #include "libc/nt/struct/linger.h"
#include "libc/sock/internal.h" #include "libc/sock/internal.h"
#include "libc/sock/struct/linger.h"
#include "libc/sock/syscall_fd.internal.h" #include "libc/sock/syscall_fd.internal.h"
#include "libc/sysv/consts/so.h" #include "libc/sysv/consts/so.h"
#include "libc/sysv/consts/sol.h" #include "libc/sysv/consts/sol.h"

View file

@ -1,12 +1,6 @@
#ifndef COSMOPOLITAN_LIBC_SOCK_SOCK_H_ #ifndef COSMOPOLITAN_LIBC_SOCK_SOCK_H_
#define COSMOPOLITAN_LIBC_SOCK_SOCK_H_ #define COSMOPOLITAN_LIBC_SOCK_SOCK_H_
#include "libc/bits/bswap.h" #include "libc/bits/bswap.h"
#include "libc/calls/struct/sigset.h"
#include "libc/calls/struct/timespec.h"
#include "libc/sock/struct/linger.h"
#include "libc/sock/struct/msghdr.h"
#include "libc/sock/struct/pollfd.h"
#include "libc/sock/struct/sockaddr.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0) #if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_ COSMOPOLITAN_C_START_
/*───────────────────────────────────────────────────────────────────────────│─╗ /*───────────────────────────────────────────────────────────────────────────│─╗
@ -20,63 +14,13 @@ COSMOPOLITAN_C_START_
#define htonl(u32) bswap_32(u32) #define htonl(u32) bswap_32(u32)
#define ntohl(u32) bswap_32(u32) #define ntohl(u32) bswap_32(u32)
struct ip_mreq {
struct in_addr imr_multiaddr; /* IP multicast address of group */
struct in_addr imr_interface; /* local IP address of interface */
};
/*
* Structure used in SIOCGIFCONF request.
* Used to retrieve interface configuration
* for machine (useful for programs which
* must know all networks accessible).
*/
struct ifconf {
uint64_t ifc_len; /* size of buffer */
union {
char *ifcu_buf;
struct ifreq *ifcu_req;
} ifc_ifcu;
};
/* Shortcuts to the ifconf buffer or ifreq array */
#define ifc_buf ifc_ifcu.ifcu_buf /* buffer address */
#define ifc_req ifc_ifcu.ifcu_req /* array of structures */
#define IFHWADDRLEN 6 #define IFHWADDRLEN 6
#define IF_NAMESIZE 16 #define IF_NAMESIZE 16
#define IFNAMSIZ IF_NAMESIZE #define IFNAMSIZ IF_NAMESIZE
struct ifreq {
union {
char ifrn_name[IFNAMSIZ]; /* Interface name, e.g. "en0". */
} ifr_ifrn;
union {
struct sockaddr ifru_addr; /* SIOCGIFADDR */
struct sockaddr ifru_dstaddr; /* SIOCGIFDSTADDR */
struct sockaddr ifru_netmask; /* SIOCGIFNETMASK */
struct sockaddr ifru_broadaddr; /* SIOCGIFBRDADDR */
short ifru_flags; /* SIOCGIFFLAGS */
char ifru_pad[24]; /* ifru_map is the largest, just pad */
} ifr_ifru;
};
#define ifr_name ifr_ifrn.ifrn_name /* interface name */
#define ifr_addr ifr_ifru.ifru_addr /* address */
#define ifr_netmask ifr_ifru.ifru_netmask /* netmask */
#define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */
#define ifr_dstaddr ifr_ifru.ifru_dstaddr /* destination address */
#define ifr_flags ifr_ifru.ifru_flags /* flags */
#define _IOT_ifreq _IOT(_IOTS(char), IFNAMSIZ, _IOTS(char), 16, 0, 0)
#define _IOT_ifreq_short _IOT(_IOTS(char), IFNAMSIZ, _IOTS(short), 1, 0, 0)
#define _IOT_ifreq_int _IOT(_IOTS(char), IFNAMSIZ, _IOTS(int), 1, 0, 0)
const char *inet_ntop(int, const void *, char *, uint32_t); const char *inet_ntop(int, const void *, char *, uint32_t);
int inet_aton(const char *, struct in_addr *);
int inet_pton(int, const char *, void *); int inet_pton(int, const char *, void *);
uint32_t inet_addr(const char *); uint32_t inet_addr(const char *);
char *inet_ntoa(struct in_addr);
int parseport(const char *); int parseport(const char *);
uint32_t *GetHostIps(void); uint32_t *GetHostIps(void);
@ -91,18 +35,11 @@ int getsockname(int, void *, uint32_t *);
int getpeername(int, void *, uint32_t *); int getpeername(int, void *, uint32_t *);
ssize_t send(int, const void *, size_t, int); ssize_t send(int, const void *, size_t, int);
ssize_t recv(int, void *, size_t, int); ssize_t recv(int, void *, size_t, int);
ssize_t recvmsg(int, struct msghdr *, int);
ssize_t recvfrom(int, void *, size_t, uint32_t, void *, uint32_t *); ssize_t recvfrom(int, void *, size_t, uint32_t, void *, uint32_t *);
ssize_t sendmsg(int, const struct msghdr *, int);
ssize_t readv(int, const struct iovec *, int);
ssize_t writev(int, const struct iovec *, int);
ssize_t sendfile(int, int, int64_t *, size_t); ssize_t sendfile(int, int, int64_t *, size_t);
int getsockopt(int, int, int, void *, uint32_t *); int getsockopt(int, int, int, void *, uint32_t *);
int setsockopt(int, int, int, const void *, uint32_t); int setsockopt(int, int, int, const void *, uint32_t);
int socketpair(int, int, int, int[2]); int socketpair(int, int, int, int[2]);
int poll(struct pollfd *, uint64_t, int32_t);
int ppoll(struct pollfd *, uint64_t, const struct timespec *,
const struct sigset *);
ssize_t sendto(int, const void *, size_t, uint32_t, const void *, uint32_t); ssize_t sendto(int, const void *, size_t, uint32_t, const void *, uint32_t);
COSMOPOLITAN_C_END_ COSMOPOLITAN_C_END_

27
libc/sock/struct/ifconf.h Normal file
View file

@ -0,0 +1,27 @@
#ifndef COSMOPOLITAN_LIBC_SOCK_STRUCT_IFCONF_H_
#define COSMOPOLITAN_LIBC_SOCK_STRUCT_IFCONF_H_
#include "libc/sock/struct/ifreq.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
/*
* Structure used in SIOCGIFCONF request.
* Used to retrieve interface configuration
* for machine (useful for programs which
* must know all networks accessible).
*/
struct ifconf {
uint64_t ifc_len; /* size of buffer */
union {
char *ifcu_buf;
struct ifreq *ifcu_req;
} ifc_ifcu;
};
/* Shortcuts to the ifconf buffer or ifreq array */
#define ifc_buf ifc_ifcu.ifcu_buf /* buffer address */
#define ifc_req ifc_ifcu.ifcu_req /* array of structures */
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_SOCK_STRUCT_IFCONF_H_ */

30
libc/sock/struct/ifreq.h Normal file
View file

@ -0,0 +1,30 @@
#ifndef COSMOPOLITAN_LIBC_SOCK_STRUCT_IFREQ_H_
#define COSMOPOLITAN_LIBC_SOCK_STRUCT_IFREQ_H_
#include "libc/sock/struct/sockaddr.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
struct ifreq {
union {
char ifrn_name[IFNAMSIZ]; /* Interface name, e.g. "en0". */
} ifr_ifrn;
union {
struct sockaddr ifru_addr; /* SIOCGIFADDR */
struct sockaddr ifru_dstaddr; /* SIOCGIFDSTADDR */
struct sockaddr ifru_netmask; /* SIOCGIFNETMASK */
struct sockaddr ifru_broadaddr; /* SIOCGIFBRDADDR */
short ifru_flags; /* SIOCGIFFLAGS */
char ifru_pad[24]; /* ifru_map is the largest, just pad */
} ifr_ifru;
};
#define ifr_name ifr_ifrn.ifrn_name /* interface name */
#define ifr_addr ifr_ifru.ifru_addr /* address */
#define ifr_netmask ifr_ifru.ifru_netmask /* netmask */
#define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */
#define ifr_dstaddr ifr_ifru.ifru_dstaddr /* destination address */
#define ifr_flags ifr_ifru.ifru_flags /* flags */
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_SOCK_STRUCT_IFREQ_H_ */

View file

@ -0,0 +1,13 @@
#ifndef COSMOPOLITAN_LIBC_SOCK_STRUCT_IP_MREQ_H_
#define COSMOPOLITAN_LIBC_SOCK_STRUCT_IP_MREQ_H_
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
struct ip_mreq {
struct in_addr imr_multiaddr; /* IP multicast address of group */
struct in_addr imr_interface; /* local IP address of interface */
};
COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_SOCK_STRUCT_IP_MREQ_H_ */

View file

@ -14,6 +14,9 @@ struct msghdr { /* Linux+NT ABI */
uint32_t msg_flags; /* MSG_XXX */ uint32_t msg_flags; /* MSG_XXX */
}; };
ssize_t recvmsg(int, struct msghdr *, int);
ssize_t sendmsg(int, const struct msghdr *, int);
COSMOPOLITAN_C_END_ COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */ #endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_SOCK_STRUCT_MSGHDR_H_ */ #endif /* COSMOPOLITAN_LIBC_SOCK_STRUCT_MSGHDR_H_ */

View file

@ -9,6 +9,8 @@ struct pollfd {
int16_t revents; int16_t revents;
}; };
int poll(struct pollfd *, uint64_t, int32_t);
COSMOPOLITAN_C_END_ COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */ #endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_SOCK_STRUCT_POLLFD_H_ */ #endif /* COSMOPOLITAN_LIBC_SOCK_STRUCT_POLLFD_H_ */

View file

@ -33,6 +33,9 @@ struct sockaddr_storage {
}; };
}; };
int inet_aton(const char *, struct in_addr *);
char *inet_ntoa(struct in_addr);
COSMOPOLITAN_C_END_ COSMOPOLITAN_C_END_
#endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */ #endif /* !(__ASSEMBLER__ + __LINKER__ + 0) */
#endif /* COSMOPOLITAN_LIBC_SOCK_STRUCT_SOCKADDR_H_ */ #endif /* COSMOPOLITAN_LIBC_SOCK_STRUCT_SOCKADDR_H_ */

View file

@ -28,6 +28,7 @@
#include "libc/nt/events.h" #include "libc/nt/events.h"
#include "libc/nt/runtime.h" #include "libc/nt/runtime.h"
#include "libc/sock/sock.h" #include "libc/sock/sock.h"
#include "libc/sock/struct/sockaddr.h"
#include "libc/sock/syslog.h" #include "libc/sock/syslog.h"
#include "libc/stdio/stdio.h" #include "libc/stdio/stdio.h"
#include "libc/str/str.h" #include "libc/str/str.h"

View file

@ -75,6 +75,13 @@ o/libc/sysv/consts/syscon.internal.inc: \
libc/sysv/consts/syscon.internal.h \ libc/sysv/consts/syscon.internal.h \
libc/macros.internal.h \ libc/macros.internal.h \
libc/macros-cpp.internal.inc \ libc/macros-cpp.internal.inc \
libc/macros.internal.inc \
libc/dce.h \
libc/intrin/asancodes.h \
ape/relocations.h
o/libc/sysv/macros.internal.inc: \
libc/sysv/macros.internal.h \
libc/macros.internal.inc libc/macros.internal.inc
#─────────────────────────────────────────────────────────────────────────────── #───────────────────────────────────────────────────────────────────────────────

View file

@ -127,6 +127,10 @@ $(LIBC_TESTLIB_A).pkg: \
$(LIBC_TESTLIB_A_OBJS) \ $(LIBC_TESTLIB_A_OBJS) \
$(foreach x,$(LIBC_TESTLIB_A_DIRECTDEPS),$($(x)_A).pkg) $(foreach x,$(LIBC_TESTLIB_A_DIRECTDEPS),$($(x)_A).pkg)
o/$(MODE)/libc/testlib/blocktronics.o: libc/testlib/blocktronics.txt
o/$(MODE)/libc/testlib/hyperion.o: libc/testlib/hyperion.txt
o/$(MODE)/libc/testlib/moby.o: libc/testlib/moby.txt
#─────────────────────────────────────────────────────────────────────────────── #───────────────────────────────────────────────────────────────────────────────
LIBC_TESTLIB_ARTIFACTS += LIBC_TESTLIB_RUNNER_A LIBC_TESTLIB_ARTIFACTS += LIBC_TESTLIB_RUNNER_A

View file

@ -42,6 +42,7 @@
#include "libc/runtime/symbols.internal.h" #include "libc/runtime/symbols.internal.h"
#include "libc/runtime/sysconf.h" #include "libc/runtime/sysconf.h"
#include "libc/sock/sock.h" #include "libc/sock/sock.h"
#include "libc/sock/struct/pollfd.h"
#include "libc/stdio/stdio.h" #include "libc/stdio/stdio.h"
#include "libc/sysv/consts/ex.h" #include "libc/sysv/consts/ex.h"
#include "libc/sysv/consts/exit.h" #include "libc/sysv/consts/exit.h"

View file

@ -8,7 +8,7 @@ NET_HTTP = $(NET_HTTP_A_DEPS) $(NET_HTTP_A)
NET_HTTP_A = o/$(MODE)/net/http/http.a NET_HTTP_A = o/$(MODE)/net/http/http.a
NET_HTTP_A_FILES := $(wildcard net/http/*) NET_HTTP_A_FILES := $(wildcard net/http/*)
NET_HTTP_A_HDRS = $(filter %.h,$(NET_HTTP_A_FILES)) NET_HTTP_A_HDRS = $(filter %.h,$(NET_HTTP_A_FILES))
NET_HTTP_A_INCS := $(filter %.inc,$(NET_HTTP_A_FILES)) NET_HTTP_A_INCS = $(filter %.inc,$(NET_HTTP_A_FILES))
NET_HTTP_A_SRCS_C = $(filter %.c,$(NET_HTTP_A_FILES)) NET_HTTP_A_SRCS_C = $(filter %.c,$(NET_HTTP_A_FILES))
NET_HTTP_A_SRCS_S = $(filter %.S,$(NET_HTTP_A_FILES)) NET_HTTP_A_SRCS_S = $(filter %.S,$(NET_HTTP_A_FILES))
NET_HTTP_A_SRCS = $(NET_HTTP_A_SRCS_S) $(NET_HTTP_A_SRCS_C) NET_HTTP_A_SRCS = $(NET_HTTP_A_SRCS_S) $(NET_HTTP_A_SRCS_C)
@ -64,6 +64,7 @@ o/$(MODE)/net/http/formathttpdatetime.o: \
NET_HTTP_LIBS = $(foreach x,$(NET_HTTP_ARTIFACTS),$($(x))) NET_HTTP_LIBS = $(foreach x,$(NET_HTTP_ARTIFACTS),$($(x)))
NET_HTTP_SRCS = $(foreach x,$(NET_HTTP_ARTIFACTS),$($(x)_SRCS)) NET_HTTP_SRCS = $(foreach x,$(NET_HTTP_ARTIFACTS),$($(x)_SRCS))
NET_HTTP_HDRS = $(foreach x,$(NET_HTTP_ARTIFACTS),$($(x)_HDRS)) NET_HTTP_HDRS = $(foreach x,$(NET_HTTP_ARTIFACTS),$($(x)_HDRS))
NET_HTTP_INCS = $(foreach x,$(NET_HTTP_ARTIFACTS),$($(x)_INCS))
NET_HTTP_OBJS = $(foreach x,$(NET_HTTP_ARTIFACTS),$($(x)_OBJS)) NET_HTTP_OBJS = $(foreach x,$(NET_HTTP_ARTIFACTS),$($(x)_OBJS))
NET_HTTP_CHECKS = $(foreach x,$(NET_HTTP_ARTIFACTS),$($(x)_CHECKS)) NET_HTTP_CHECKS = $(foreach x,$(NET_HTTP_ARTIFACTS),$($(x)_CHECKS))

View file

@ -25,6 +25,8 @@
#include "libc/mem/mem.h" #include "libc/mem/mem.h"
#include "libc/runtime/gc.internal.h" #include "libc/runtime/gc.internal.h"
#include "libc/sock/sock.h" #include "libc/sock/sock.h"
#include "libc/sock/struct/ifconf.h"
#include "libc/sock/struct/ifreq.h"
#include "libc/stdio/stdio.h" #include "libc/stdio/stdio.h"
#include "libc/sysv/consts/af.h" #include "libc/sysv/consts/af.h"
#include "libc/sysv/consts/ipproto.h" #include "libc/sysv/consts/ipproto.h"

View file

@ -97,14 +97,12 @@ int extract(const char *from, const char *to, int mode) {
TEST(unveil, api_differences) { TEST(unveil, api_differences) {
SPAWN(fork); SPAWN(fork);
ASSERT_SYS(0, 0, stat("/", &st));
ASSERT_SYS(0, 0, unveil(".", "rw"));
if (IsOpenbsd()) { if (IsOpenbsd()) {
// openbsd imposes restrictions immediately // openbsd imposes restrictions immediately
ASSERT_SYS(ENOENT, -1, open("/", O_RDONLY | O_DIRECTORY)); ASSERT_SYS(ENOENT, -1, open("/", O_RDONLY | O_DIRECTORY));
} else { } else {
// restrictions on linux don't go into effect until unveil(0,0) // restrictions on linux don't go into effect until unveil(0,0)
ASSERT_SYS(0, 3, open("/", O_RDONLY | O_DIRECTORY)); ASSERT_SYS(0, 3, open(".", O_RDONLY | O_DIRECTORY));
ASSERT_SYS(0, 0, close(3)); ASSERT_SYS(0, 0, close(3));
} }
ASSERT_SYS(0, 0, unveil(0, 0)); ASSERT_SYS(0, 0, unveil(0, 0));

View file

@ -68,6 +68,15 @@ o/$(MODE)/test/libc/mem/%.com.dbg: \
$(APE_NO_MODIFY_SELF) $(APE_NO_MODIFY_SELF)
@$(APELINK) @$(APELINK)
o/$(MODE)/test/libc/mem/prog/sock.o: \
test/libc/mem/prog/sock.c \
libc/errno.h \
libc/sock/sock.h \
libc/bits/bswap.h \
libc/sysv/consts/af.h \
libc/runtime/symbolic.h \
libc/sysv/consts/sock.h
################################################################################ ################################################################################
o/$(MODE)/test/libc/mem/prog/life.com.dbg: \ o/$(MODE)/test/libc/mem/prog/life.com.dbg: \

View file

@ -47,8 +47,6 @@
#include "libc/x/x.h" #include "libc/x/x.h"
#include "third_party/xed/x86.h" #include "third_party/xed/x86.h"
#define TMP firstnonnull(getenv("TMPDIR"), kTmpPath)
char testlib_enable_tmp_setup_teardown; char testlib_enable_tmp_setup_teardown;
void SetUpOnce(void) { void SetUpOnce(void) {

View file

@ -17,6 +17,7 @@
PERFORMANCE OF THIS SOFTWARE. PERFORMANCE OF THIS SOFTWARE.
*/ */
#include "libc/sock/sock.h" #include "libc/sock/sock.h"
#include "libc/sock/struct/sockaddr.h"
#include "libc/testlib/testlib.h" #include "libc/testlib/testlib.h"
TEST(inet_ntoa, test) { TEST(inet_ntoa, test) {

View file

@ -25,6 +25,8 @@
#include "libc/nt/synchronization.h" #include "libc/nt/synchronization.h"
#include "libc/runtime/gc.internal.h" #include "libc/runtime/gc.internal.h"
#include "libc/sock/sock.h" #include "libc/sock/sock.h"
#include "libc/sock/struct/pollfd.h"
#include "libc/sock/struct/sockaddr.h"
#include "libc/sysv/consts/af.h" #include "libc/sysv/consts/af.h"
#include "libc/sysv/consts/inaddr.h" #include "libc/sysv/consts/inaddr.h"
#include "libc/sysv/consts/ipproto.h" #include "libc/sysv/consts/ipproto.h"

View file

@ -21,6 +21,7 @@
#include "libc/runtime/gc.internal.h" #include "libc/runtime/gc.internal.h"
#include "libc/runtime/runtime.h" #include "libc/runtime/runtime.h"
#include "libc/sock/sock.h" #include "libc/sock/sock.h"
#include "libc/sock/struct/sockaddr.h"
#include "libc/str/str.h" #include "libc/str/str.h"
#include "libc/sysv/consts/af.h" #include "libc/sysv/consts/af.h"
#include "libc/sysv/consts/ipproto.h" #include "libc/sysv/consts/ipproto.h"

View file

@ -21,6 +21,7 @@
#include "libc/dce.h" #include "libc/dce.h"
#include "libc/runtime/gc.internal.h" #include "libc/runtime/gc.internal.h"
#include "libc/sock/sock.h" #include "libc/sock/sock.h"
#include "libc/sock/struct/msghdr.h"
#include "libc/sysv/consts/af.h" #include "libc/sysv/consts/af.h"
#include "libc/sysv/consts/o.h" #include "libc/sysv/consts/o.h"
#include "libc/sysv/consts/sock.h" #include "libc/sysv/consts/sock.h"

View file

@ -24,6 +24,7 @@
#include "libc/nt/version.h" #include "libc/nt/version.h"
#include "libc/runtime/runtime.h" #include "libc/runtime/runtime.h"
#include "libc/sock/sock.h" #include "libc/sock/sock.h"
#include "libc/sock/struct/sockaddr.h"
#include "libc/sysv/consts/af.h" #include "libc/sysv/consts/af.h"
#include "libc/sysv/consts/so.h" #include "libc/sysv/consts/so.h"
#include "libc/sysv/consts/sock.h" #include "libc/sysv/consts/sock.h"

View file

@ -22,6 +22,7 @@
#include "libc/runtime/runtime.h" #include "libc/runtime/runtime.h"
#include "libc/sock/goodsocket.internal.h" #include "libc/sock/goodsocket.internal.h"
#include "libc/sock/sock.h" #include "libc/sock/sock.h"
#include "libc/sock/struct/sockaddr.h"
#include "libc/stdio/stdio.h" #include "libc/stdio/stdio.h"
#include "libc/sysv/consts/af.h" #include "libc/sysv/consts/af.h"
#include "libc/sysv/consts/auxv.h" #include "libc/sysv/consts/auxv.h"

View file

@ -380,7 +380,7 @@ static char *replace_extn(char *tmpl, char *extn) {
static char *create_tmpfile(void) { static char *create_tmpfile(void) {
char *path = xjoinpaths(kTmpPath, "chibicc-XXXXXX"); char *path = xjoinpaths(kTmpPath, "chibicc-XXXXXX");
int fd = mkstemp(path); int fd = mkstemp(path);
if (fd == -1) error("mkstemp failed: %s", strerror(errno)); if (fd == -1) error("%s: mkstemp failed: %s", path, strerror(errno));
close(fd); close(fd);
static int len = 2; static int len = 2;
chibicc_tmpfiles = realloc(chibicc_tmpfiles, sizeof(char *) * len); chibicc_tmpfiles = realloc(chibicc_tmpfiles, sizeof(char *) * len);

View file

@ -11,7 +11,6 @@
# GCC-built chibicc, and a second time with chibicc-built chibicc # GCC-built chibicc, and a second time with chibicc-built chibicc
CHIBICC = o/$(MODE)/third_party/chibicc/chibicc.com CHIBICC = o/$(MODE)/third_party/chibicc/chibicc.com
CHIBICC2 = o/$(MODE)/third_party/chibicc/chibicc2.com
CHIBICC_FLAGS = \ CHIBICC_FLAGS = \
-fno-common \ -fno-common \
-include libc/integral/normalize.inc \ -include libc/integral/normalize.inc \
@ -22,7 +21,6 @@ PKGS += THIRD_PARTY_CHIBICC
THIRD_PARTY_CHIBICC_ARTIFACTS += THIRD_PARTY_CHIBICC_A THIRD_PARTY_CHIBICC_ARTIFACTS += THIRD_PARTY_CHIBICC_A
THIRD_PARTY_CHIBICC = $(THIRD_PARTY_CHIBICC_A_DEPS) $(THIRD_PARTY_CHIBICC_A) THIRD_PARTY_CHIBICC = $(THIRD_PARTY_CHIBICC_A_DEPS) $(THIRD_PARTY_CHIBICC_A)
THIRD_PARTY_CHIBICC_A = o/$(MODE)/third_party/chibicc/chibicc.a THIRD_PARTY_CHIBICC_A = o/$(MODE)/third_party/chibicc/chibicc.a
THIRD_PARTY_CHIBICC2_A = o/$(MODE)/third_party/chibicc/chibicc2.a
THIRD_PARTY_CHIBICC_A_FILES := $(wildcard third_party/chibicc/*) THIRD_PARTY_CHIBICC_A_FILES := $(wildcard third_party/chibicc/*)
THIRD_PARTY_CHIBICC_A_HDRS = $(filter %.h,$(THIRD_PARTY_CHIBICC_A_FILES)) THIRD_PARTY_CHIBICC_A_HDRS = $(filter %.h,$(THIRD_PARTY_CHIBICC_A_FILES))
THIRD_PARTY_CHIBICC_A_SRCS = $(filter %.c,$(THIRD_PARTY_CHIBICC_A_FILES)) THIRD_PARTY_CHIBICC_A_SRCS = $(filter %.c,$(THIRD_PARTY_CHIBICC_A_FILES))
@ -35,18 +33,13 @@ THIRD_PARTY_CHIBICC_DEFINES = \
THIRD_PARTY_CHIBICC_BINS = \ THIRD_PARTY_CHIBICC_BINS = \
o/$(MODE)/third_party/chibicc/chibicc.com.dbg \ o/$(MODE)/third_party/chibicc/chibicc.com.dbg \
o/$(MODE)/third_party/chibicc/chibicc.com \ o/$(MODE)/third_party/chibicc/chibicc.com
o/$(MODE)/third_party/chibicc/chibicc2.com.dbg \
o/$(MODE)/third_party/chibicc/chibicc2.com
THIRD_PARTY_CHIBICC_A_OBJS = \ THIRD_PARTY_CHIBICC_A_OBJS = \
$(THIRD_PARTY_CHIBICC_A_SRCS:%.c=o/$(MODE)/%.o) $(THIRD_PARTY_CHIBICC_A_SRCS:%.c=o/$(MODE)/%.o)
THIRD_PARTY_CHIBICC2_A_OBJS = \
$(THIRD_PARTY_CHIBICC_A_SRCS:%.c=o/$(MODE)/%.chibicc.o)
THIRD_PARTY_CHIBICC_A_CHECKS = \ THIRD_PARTY_CHIBICC_A_CHECKS = \
$(THIRD_PARTY_CHIBICC_A).pkg \ $(THIRD_PARTY_CHIBICC_A).pkg \
$(THIRD_PARTY_CHIBICC2_A).pkg \
$(THIRD_PARTY_CHIBICC_A_HDRS:%=o/$(MODE)/%.ok) $(THIRD_PARTY_CHIBICC_A_HDRS:%=o/$(MODE)/%.ok)
THIRD_PARTY_CHIBICC_A_DIRECTDEPS = \ THIRD_PARTY_CHIBICC_A_DIRECTDEPS = \
@ -83,14 +76,6 @@ $(THIRD_PARTY_CHIBICC_A).pkg: \
$(THIRD_PARTY_CHIBICC_A_OBJS) \ $(THIRD_PARTY_CHIBICC_A_OBJS) \
$(foreach x,$(THIRD_PARTY_CHIBICC_A_DIRECTDEPS),$($(x)_A).pkg) $(foreach x,$(THIRD_PARTY_CHIBICC_A_DIRECTDEPS),$($(x)_A).pkg)
$(THIRD_PARTY_CHIBICC2_A): \
third_party/chibicc/ \
$(THIRD_PARTY_CHIBICC2_A).pkg \
$(THIRD_PARTY_CHIBICC2_A_OBJS)
$(THIRD_PARTY_CHIBICC2_A).pkg: \
$(THIRD_PARTY_CHIBICC2_A_OBJS) \
$(foreach x,$(THIRD_PARTY_CHIBICC_A_DIRECTDEPS),$($(x)_A).pkg)
o/$(MODE)/third_party/chibicc/chibicc.com.dbg: \ o/$(MODE)/third_party/chibicc/chibicc.com.dbg: \
$(THIRD_PARTY_CHIBICC_A_DEPS) \ $(THIRD_PARTY_CHIBICC_A_DEPS) \
$(THIRD_PARTY_CHIBICC_A) \ $(THIRD_PARTY_CHIBICC_A) \
@ -100,15 +85,6 @@ o/$(MODE)/third_party/chibicc/chibicc.com.dbg: \
o/$(MODE)/third_party/chibicc/chibicc.main.o \ o/$(MODE)/third_party/chibicc/chibicc.main.o \
$(THIRD_PARTY_CHIBICC_A).pkg $(THIRD_PARTY_CHIBICC_A).pkg
@$(APELINK) @$(APELINK)
o/$(MODE)/third_party/chibicc/chibicc2.com.dbg: \
$(THIRD_PARTY_CHIBICC_A_DEPS) \
$(THIRD_PARTY_CHIBICC2_A) \
$(APE_NO_MODIFY_SELF) \
$(CRT) \
o/$(MODE)/third_party/chibicc/help.txt.zip.o \
o/$(MODE)/third_party/chibicc/chibicc.main.chibicc.o \
$(THIRD_PARTY_CHIBICC2_A).pkg
@$(APELINK)
o/$(MODE)/third_party/chibicc/chibicc.com: \ o/$(MODE)/third_party/chibicc/chibicc.com: \
o/$(MODE)/third_party/chibicc/chibicc.com.dbg \ o/$(MODE)/third_party/chibicc/chibicc.com.dbg \
@ -132,16 +108,6 @@ o/$(MODE)/third_party/chibicc/as.com.dbg: \
o/$(MODE)/third_party/chibicc/chibicc.o: \ o/$(MODE)/third_party/chibicc/chibicc.o: \
OVERRIDE_CPPFLAGS += $(THIRD_PARTY_CHIBICC_DEFINES) OVERRIDE_CPPFLAGS += $(THIRD_PARTY_CHIBICC_DEFINES)
o/$(MODE)/third_party/chibicc/chibicc.chibicc.o: \
CHIBICC_FLAGS += $(THIRD_PARTY_CHIBICC_DEFINES)
o/$(MODE)/%.chibicc.o: %.s $(CHIBICC)
@$(COMPILE) -ACHIBICC -T$@ $(CHIBICC) $(CHIBICC_FLAGS) -c -o $@ $<
o/$(MODE)/%.chibicc.o: %.c $(CHIBICC)
@$(COMPILE) -ACHIBICC -T$@ $(CHIBICC) $(CHIBICC_FLAGS) -c -o $@ $<
o/$(MODE)/%.chibicc2.o: %.c $(CHIBICC2)
@$(COMPILE) -ACHIBICC2 -T$@ $(CHIBICC2) $(CHIBICC_FLAGS) -c -o $@ $<
THIRD_PARTY_CHIBICC_LIBS = $(foreach x,$(THIRD_PARTY_CHIBICC_ARTIFACTS),$($(x))) THIRD_PARTY_CHIBICC_LIBS = $(foreach x,$(THIRD_PARTY_CHIBICC_ARTIFACTS),$($(x)))
THIRD_PARTY_CHIBICC_SRCS = $(foreach x,$(THIRD_PARTY_CHIBICC_ARTIFACTS),$($(x)_SRCS)) THIRD_PARTY_CHIBICC_SRCS = $(foreach x,$(THIRD_PARTY_CHIBICC_ARTIFACTS),$($(x)_SRCS))
THIRD_PARTY_CHIBICC_HDRS = $(foreach x,$(THIRD_PARTY_CHIBICC_ARTIFACTS),$($(x)_HDRS)) THIRD_PARTY_CHIBICC_HDRS = $(foreach x,$(THIRD_PARTY_CHIBICC_ARTIFACTS),$($(x)_HDRS))

View file

@ -22,6 +22,7 @@
// standard's wording: // standard's wording:
// https://github.com/rui314/chibicc/wiki/cpp.algo.pdf // https://github.com/rui314/chibicc/wiki/cpp.algo.pdf
#include "libc/intrin/kprintf.h"
#include "libc/log/libfatal.internal.h" #include "libc/log/libfatal.internal.h"
#include "libc/mem/arena.h" #include "libc/mem/arena.h"
#include "libc/stdio/stdio.h" #include "libc/stdio/stdio.h"
@ -639,7 +640,7 @@ char *search_include_paths(char *filename) {
if (cached) return cached; if (cached) return cached;
// Search a file from the include paths. // Search a file from the include paths.
for (int i = 0; i < include_paths.len; i++) { for (int i = 0; i < include_paths.len; i++) {
char *path = xasprintf("%s/%s", include_paths.data[i], filename); char *path = xjoinpaths(include_paths.data[i], filename);
if (!fileexists(path)) continue; if (!fileexists(path)) continue;
hashmap_put(&cache, filename, path); hashmap_put(&cache, filename, path);
include_next_idx = i + 1; include_next_idx = i + 1;

View file

@ -1,3 +1,4 @@
#include "libc/mem/alloca.h"
#include "third_party/chibicc/test/test.h" #include "third_party/chibicc/test/test.h"
void *fn(int x, void *p, int y) { void *fn(int x, void *p, int y) {

View file

@ -27,12 +27,13 @@ int main() {
ASSERT(5, include1); ASSERT(5, include1);
ASSERT(7, include2); ASSERT(7, include2);
#if 0 /* [jart] breaks mkdeps */
#include "/no/such/file" /* #if 0 */
ASSERT(0, 1); /* #include "/no/such/file" */
#if nested /* ASSERT(0, 1); */
#endif /* #if nested */
#endif /* #endif */
/* #endif */
int m = 0; int m = 0;

View file

@ -13,7 +13,6 @@
PKGS += THIRD_PARTY_CHIBICC_TEST PKGS += THIRD_PARTY_CHIBICC_TEST
THIRD_PARTY_CHIBICC_TEST_A = o/$(MODE)/third_party/chibicc/test/test.a THIRD_PARTY_CHIBICC_TEST_A = o/$(MODE)/third_party/chibicc/test/test.a
THIRD_PARTY_CHIBICC_TEST2_A = o/$(MODE)/third_party/chibicc/test/test2.a
THIRD_PARTY_CHIBICC_TEST_FILES := $(wildcard third_party/chibicc/test/*) THIRD_PARTY_CHIBICC_TEST_FILES := $(wildcard third_party/chibicc/test/*)
THIRD_PARTY_CHIBICC_TEST_SRCS = $(filter %.c,$(THIRD_PARTY_CHIBICC_TEST_FILES)) THIRD_PARTY_CHIBICC_TEST_SRCS = $(filter %.c,$(THIRD_PARTY_CHIBICC_TEST_FILES))
THIRD_PARTY_CHIBICC_TEST_SRCS_TEST = $(filter %_test.c,$(THIRD_PARTY_CHIBICC_TEST_SRCS)) THIRD_PARTY_CHIBICC_TEST_SRCS_TEST = $(filter %_test.c,$(THIRD_PARTY_CHIBICC_TEST_SRCS))
@ -21,14 +20,10 @@ THIRD_PARTY_CHIBICC_TEST_HDRS = $(filter %.h,$(THIRD_PARTY_CHIBICC_TEST_FILES))
THIRD_PARTY_CHIBICC_TEST_TESTS = $(THIRD_PARTY_CHIBICC_TEST_COMS:%=%.ok) THIRD_PARTY_CHIBICC_TEST_TESTS = $(THIRD_PARTY_CHIBICC_TEST_COMS:%=%.ok)
THIRD_PARTY_CHIBICC_TEST_COMS = \ THIRD_PARTY_CHIBICC_TEST_COMS = \
$(THIRD_PARTY_CHIBICC_TEST_SRCS_TEST:%_test.c=o/$(MODE)/%_test.com) \ $(THIRD_PARTY_CHIBICC_TEST_SRCS_TEST:%_test.c=o/$(MODE)/%_test.com)
$(THIRD_PARTY_CHIBICC_TEST_SRCS_TEST:%_test.c=o/$(MODE)/%_test2.com)
THIRD_PARTY_CHIBICC_TEST_OBJS = \ THIRD_PARTY_CHIBICC_TEST_OBJS = \
$(THIRD_PARTY_CHIBICC_TEST_SRCS:%.c=o/$(MODE)/%.chibicc.o) $(THIRD_PARTY_CHIBICC_TEST_SRCS:%.c=o/$(MODE)/%.o)
THIRD_PARTY_CHIBICC_TEST2_OBJS = \
$(THIRD_PARTY_CHIBICC_TEST_SRCS:%.c=o/$(MODE)/%.chibicc2.o)
THIRD_PARTY_CHIBICC_TEST_BINS = \ THIRD_PARTY_CHIBICC_TEST_BINS = \
$(THIRD_PARTY_CHIBICC_TEST_COMS) \ $(THIRD_PARTY_CHIBICC_TEST_COMS) \
@ -59,45 +54,27 @@ THIRD_PARTY_CHIBICC_TEST_DEPS := \
$(THIRD_PARTY_CHIBICC_TEST_A): \ $(THIRD_PARTY_CHIBICC_TEST_A): \
$(THIRD_PARTY_CHIBICC_TEST_A).pkg \ $(THIRD_PARTY_CHIBICC_TEST_A).pkg \
o/$(MODE)/third_party/chibicc/test/common.chibicc.o o/$(MODE)/third_party/chibicc/test/common.o
$(THIRD_PARTY_CHIBICC_TEST2_A): \
$(THIRD_PARTY_CHIBICC_TEST2_A).pkg \
o/$(MODE)/third_party/chibicc/test/common.chibicc2.o
$(THIRD_PARTY_CHIBICC_TEST_A).pkg: \ $(THIRD_PARTY_CHIBICC_TEST_A).pkg: \
o/$(MODE)/third_party/chibicc/test/common.chibicc.o \ o/$(MODE)/third_party/chibicc/test/common.o \
$(foreach x,$(THIRD_PARTY_CHIBICC_TEST_DIRECTDEPS),$($(x)_A).pkg)
$(THIRD_PARTY_CHIBICC_TEST2_A).pkg: \
o/$(MODE)/third_party/chibicc/test/common.chibicc2.o \
$(foreach x,$(THIRD_PARTY_CHIBICC_TEST_DIRECTDEPS),$($(x)_A).pkg) $(foreach x,$(THIRD_PARTY_CHIBICC_TEST_DIRECTDEPS),$($(x)_A).pkg)
o/$(MODE)/third_party/chibicc/test/%.com.dbg: \ o/$(MODE)/third_party/chibicc/test/%.com.dbg: \
$(THIRD_PARTY_CHIBICC_TEST_DEPS) \ $(THIRD_PARTY_CHIBICC_TEST_DEPS) \
$(THIRD_PARTY_CHIBICC_TEST_A) \ $(THIRD_PARTY_CHIBICC_TEST_A) \
o/$(MODE)/third_party/chibicc/test/%.chibicc.o \ o/$(MODE)/third_party/chibicc/test/%.o \
$(THIRD_PARTY_CHIBICC_TEST_A).pkg \ $(THIRD_PARTY_CHIBICC_TEST_A).pkg \
$(CRT) \ $(CRT) \
$(APE_NO_MODIFY_SELF) $(APE_NO_MODIFY_SELF)
@$(APELINK) @$(APELINK)
o/$(MODE)/third_party/chibicc/test/%2.com.dbg: \ $(THIRD_PARTY_CHIBICC_TEST_OBJS): CC = $(CHIBICC)
$(THIRD_PARTY_CHIBICC_TEST_DEPS) \ $(THIRD_PARTY_CHIBICC_TEST_OBJS): $(CHIBICC)
$(THIRD_PARTY_CHIBICC_TEST2_A) \
o/$(MODE)/third_party/chibicc/test/%.chibicc2.o \
$(THIRD_PARTY_CHIBICC_TEST2_A).pkg \
$(CRT) \
$(APE_NO_MODIFY_SELF)
@$(APELINK)
.PRECIOUS: $(THIRD_PARTY_CHIBICC_TEST_OBJS) .PRECIOUS: $(THIRD_PARTY_CHIBICC_TEST_OBJS)
.PRECIOUS: $(THIRD_PARTY_CHIBICC_TEST2_OBJS)
o/$(MODE)/third_party/chibicc/test/int128_test.o: QUOTA = -M512m o/$(MODE)/third_party/chibicc/test/int128_test.o: QUOTA = -M1024m
o/$(MODE)/third_party/chibicc/test/int128_test.o: QUOTA = -M512m
o/$(MODE)/third_party/chibicc/test/int128_test.chibicc.o: QUOTA = -M1024m
o/$(MODE)/third_party/chibicc/test/int128_test.chibicc2.o: QUOTA = -M1024m
.PHONY: o/$(MODE)/third_party/chibicc/test .PHONY: o/$(MODE)/third_party/chibicc/test
o/$(MODE)/third_party/chibicc/test: \ o/$(MODE)/third_party/chibicc/test: \

View file

@ -40,6 +40,7 @@
#include "libc/nt/struct/msg.h" #include "libc/nt/struct/msg.h"
#include "libc/runtime/utmp.h" #include "libc/runtime/utmp.h"
#include "libc/sock/sock.h" #include "libc/sock/sock.h"
#include "libc/sock/struct/sockaddr.h"
#include "libc/sysv/consts/fileno.h" #include "libc/sysv/consts/fileno.h"
#include "libc/time/time.h" #include "libc/time/time.h"
#include "third_party/finger/finger.h" #include "third_party/finger/finger.h"

View file

@ -9,6 +9,7 @@
#ifndef _LIBCPP_CONFIG #ifndef _LIBCPP_CONFIG
#define _LIBCPP_CONFIG #define _LIBCPP_CONFIG
#include "libc/isystem/features.h"
#define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER #define _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER
#define _LIBCPP_HAS_NO_THREADS #define _LIBCPP_HAS_NO_THREADS
@ -218,7 +219,6 @@
// Need to detect which libc we're using if we're on Linux. // Need to detect which libc we're using if we're on Linux.
#if defined(__linux__) #if defined(__linux__)
# include "libc/isystem/features.h"
# if defined(__GLIBC_PREREQ) # if defined(__GLIBC_PREREQ)
# define _LIBCPP_GLIBC_PREREQ(a, b) __GLIBC_PREREQ(a, b) # define _LIBCPP_GLIBC_PREREQ(a, b) __GLIBC_PREREQ(a, b)
# else # else
@ -246,68 +246,6 @@
# endif // __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ # endif // __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
#endif // __BYTE_ORDER__ #endif // __BYTE_ORDER__
#ifdef __FreeBSD__
# include "third_party/libcxx/sys/endian.h"
# include "third_party/libcxx/osreldate.h"
# if _BYTE_ORDER == _LITTLE_ENDIAN
# define _LIBCPP_LITTLE_ENDIAN
# else // _BYTE_ORDER == _LITTLE_ENDIAN
# define _LIBCPP_BIG_ENDIAN
# endif // _BYTE_ORDER == _LITTLE_ENDIAN
# ifndef __LONG_LONG_SUPPORTED
# define _LIBCPP_HAS_NO_LONG_LONG
# endif // __LONG_LONG_SUPPORTED
#endif // __FreeBSD__
#ifdef __NetBSD__
# include "third_party/libcxx/sys/endian.h"
# if _BYTE_ORDER == _LITTLE_ENDIAN
# define _LIBCPP_LITTLE_ENDIAN
# else // _BYTE_ORDER == _LITTLE_ENDIAN
# define _LIBCPP_BIG_ENDIAN
# endif // _BYTE_ORDER == _LITTLE_ENDIAN
# define _LIBCPP_HAS_QUICK_EXIT
#endif // __NetBSD__
#if defined(_WIN32)
# define _LIBCPP_WIN32API
# define _LIBCPP_LITTLE_ENDIAN
# define _LIBCPP_SHORT_WCHAR 1
// Both MinGW and native MSVC provide a "MSVC"-like environment
# define _LIBCPP_MSVCRT_LIKE
// If mingw not explicitly detected, assume using MS C runtime only if
// a MS compatibility version is specified.
# if defined(_MSC_VER) && !defined(__MINGW32__)
# define _LIBCPP_MSVCRT // Using Microsoft's C Runtime library
# endif
# if (defined(_M_AMD64) || defined(__x86_64__)) || (defined(_M_ARM) || defined(__arm__))
# define _LIBCPP_HAS_BITSCAN64
# endif
# define _LIBCPP_HAS_OPEN_WITH_WCHAR
# if defined(_LIBCPP_MSVCRT)
# define _LIBCPP_HAS_QUICK_EXIT
# endif
// Some CRT APIs are unavailable to store apps
# if defined(WINAPI_FAMILY)
# include "third_party/libcxx/winapifamily.h"
# if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && \
(!defined(WINAPI_PARTITION_SYSTEM) || \
!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_SYSTEM))
# define _LIBCPP_WINDOWS_STORE_APP
# endif
# endif
#endif // defined(_WIN32)
#ifdef __sun__
# include "third_party/libcxx/sys/isa_defs.h"
# ifdef _LITTLE_ENDIAN
# define _LIBCPP_LITTLE_ENDIAN
# else
# define _LIBCPP_BIG_ENDIAN
# endif
#endif // __sun__
#if defined(__CloudABI__) #if defined(__CloudABI__)
// Certain architectures provide arc4random(). Prefer using // Certain architectures provide arc4random(). Prefer using
// arc4random() over /dev/{u,}random to make it possible to obtain // arc4random() over /dev/{u,}random to make it possible to obtain
@ -328,7 +266,7 @@
#endif #endif
#if !defined(_LIBCPP_LITTLE_ENDIAN) && !defined(_LIBCPP_BIG_ENDIAN) #if !defined(_LIBCPP_LITTLE_ENDIAN) && !defined(_LIBCPP_BIG_ENDIAN)
# include "libc/isystem/endian.h" #include "libc/isystem/endian.h"
# if __BYTE_ORDER == __LITTLE_ENDIAN # if __BYTE_ORDER == __LITTLE_ENDIAN
# define _LIBCPP_LITTLE_ENDIAN # define _LIBCPP_LITTLE_ENDIAN
# elif __BYTE_ORDER == __BIG_ENDIAN # elif __BYTE_ORDER == __BIG_ENDIAN

View file

@ -18,13 +18,13 @@
#endif #endif
#if defined(_LIBCPP_HAS_NO_NULLPTR) #if defined(_LIBCPP_HAS_NO_NULLPTR)
# include "third_party/libcxx/cstddef" #include "third_party/libcxx/cstddef"
#endif #endif
#if _LIBCPP_DEBUG_LEVEL >= 1 || defined(_LIBCPP_BUILDING_LIBRARY) #if _LIBCPP_DEBUG_LEVEL >= 1 || defined(_LIBCPP_BUILDING_LIBRARY)
# include "third_party/libcxx/cstdlib" #include "third_party/libcxx/cstdlib"
# include "third_party/libcxx/cstdio" #include "third_party/libcxx/cstdio"
# include "third_party/libcxx/cstddef" #include "third_party/libcxx/cstddef"
#endif #endif
#if _LIBCPP_DEBUG_LEVEL >= 1 && !defined(_LIBCPP_ASSERT) #if _LIBCPP_DEBUG_LEVEL >= 1 && !defined(_LIBCPP_ASSERT)

View file

@ -10,6 +10,9 @@
#ifndef _LIBCPP___ERRC #ifndef _LIBCPP___ERRC
#define _LIBCPP___ERRC #define _LIBCPP___ERRC
#include "third_party/libcxx/__config"
#include "third_party/libcxx/cerrno"
/* /*
system_error synopsis system_error synopsis
@ -100,9 +103,6 @@ enum class errc
*/ */
#include "third_party/libcxx/__config"
#include "third_party/libcxx/cerrno"
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif #endif

View file

@ -10,6 +10,23 @@
#ifndef _LIBCPP___STRING #ifndef _LIBCPP___STRING
#define _LIBCPP___STRING #define _LIBCPP___STRING
#include "third_party/libcxx/__config"
#include "third_party/libcxx/algorithm" // for search and min
#include "third_party/libcxx/cstdio" // For EOF.
#include "third_party/libcxx/memory" // for __murmur2_or_cityhash
#include "third_party/libcxx/__debug"
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_PUSH_MACROS
#include "third_party/libcxx/__undef_macros"
_LIBCPP_BEGIN_NAMESPACE_STD
/* /*
string synopsis string synopsis
@ -52,23 +69,6 @@ template <> struct char_traits<char8_t>; // c++20
*/ */
#include "third_party/libcxx/__config"
#include "third_party/libcxx/algorithm" // for search and min
#include "third_party/libcxx/cstdio" // For EOF.
#include "third_party/libcxx/memory" // for __murmur2_or_cityhash
#include "third_party/libcxx/__debug"
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_PUSH_MACROS
#include "third_party/libcxx/__undef_macros"
_LIBCPP_BEGIN_NAMESPACE_STD
// char_traits // char_traits
template <class _CharT> template <class _CharT>

View file

@ -10,6 +10,34 @@
#ifndef _LIBCPP_ALGORITHM #ifndef _LIBCPP_ALGORITHM
#define _LIBCPP_ALGORITHM #define _LIBCPP_ALGORITHM
#include "third_party/libcxx/__config"
#include "third_party/libcxx/initializer_list"
#include "third_party/libcxx/type_traits"
#include "third_party/libcxx/cstring"
#include "third_party/libcxx/utility" // needed to provide swap_ranges.
#include "third_party/libcxx/memory"
#include "third_party/libcxx/functional"
#include "third_party/libcxx/iterator"
#include "third_party/libcxx/cstddef"
#include "third_party/libcxx/bit"
#include "third_party/libcxx/version"
#if defined(_LIBCPP_HAS_PARALLEL_ALGORITHMS) && _LIBCPP_STD_VER >= 17
# include "third_party/libcxx/__pstl_algorithm"
#endif
#include "third_party/libcxx/__debug"
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_PUSH_MACROS
#include "third_party/libcxx/__undef_macros"
_LIBCPP_BEGIN_NAMESPACE_STD
/* /*
algorithm synopsis algorithm synopsis
@ -635,30 +663,6 @@ template <class BidirectionalIterator, class Compare>
*/ */
#include "third_party/libcxx/__config"
#include "third_party/libcxx/initializer_list"
#include "third_party/libcxx/type_traits"
#include "third_party/libcxx/cstring"
#include "third_party/libcxx/utility" // needed to provide swap_ranges.
#include "third_party/libcxx/memory"
#include "third_party/libcxx/functional"
#include "third_party/libcxx/iterator"
#include "third_party/libcxx/cstddef"
#include "third_party/libcxx/bit"
#include "third_party/libcxx/version"
#include "third_party/libcxx/__debug"
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_PUSH_MACROS
#include "third_party/libcxx/__undef_macros"
_LIBCPP_BEGIN_NAMESPACE_STD
// I'd like to replace these with _VSTD::equal_to<void>, but can't because: // I'd like to replace these with _VSTD::equal_to<void>, but can't because:
// * That only works with C++14 and later, and // * That only works with C++14 and later, and
// * We haven't included <functional> here. // * We haven't included <functional> here.
@ -5678,8 +5682,4 @@ _LIBCPP_END_NAMESPACE_STD
_LIBCPP_POP_MACROS _LIBCPP_POP_MACROS
#if defined(_LIBCPP_HAS_PARALLEL_ALGORITHMS) && _LIBCPP_STD_VER >= 17
# include "third_party/libcxx/__pstl_algorithm"
#endif
#endif // _LIBCPP_ALGORITHM #endif // _LIBCPP_ALGORITHM

View file

@ -10,6 +10,23 @@
#ifndef _LIBCPP_ARRAY #ifndef _LIBCPP_ARRAY
#define _LIBCPP_ARRAY #define _LIBCPP_ARRAY
#include "third_party/libcxx/__config"
#include "third_party/libcxx/__tuple"
#include "third_party/libcxx/type_traits"
#include "third_party/libcxx/utility"
#include "third_party/libcxx/iterator"
#include "third_party/libcxx/algorithm"
#include "third_party/libcxx/stdexcept"
#include "third_party/libcxx/cstdlib" // for _LIBCPP_UNREACHABLE
#include "third_party/libcxx/version"
#include "third_party/libcxx/__debug"
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
/* /*
array synopsis array synopsis
@ -103,25 +120,6 @@ template <size_t I, class T, size_t N> const T&& get(const array<T, N>&&) noexce
*/ */
#include "third_party/libcxx/__config"
#include "third_party/libcxx/__tuple"
#include "third_party/libcxx/type_traits"
#include "third_party/libcxx/utility"
#include "third_party/libcxx/iterator"
#include "third_party/libcxx/algorithm"
#include "third_party/libcxx/stdexcept"
#include "third_party/libcxx/cstdlib" // for _LIBCPP_UNREACHABLE
#include "third_party/libcxx/version"
#include "third_party/libcxx/__debug"
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, size_t _Size> template <class _Tp, size_t _Size>
struct _LIBCPP_TEMPLATE_VIS array struct _LIBCPP_TEMPLATE_VIS array

View file

@ -11,6 +11,44 @@
#ifndef _LIBCPP_ATOMIC #ifndef _LIBCPP_ATOMIC
#define _LIBCPP_ATOMIC #define _LIBCPP_ATOMIC
#include "third_party/libcxx/__config"
#include "third_party/libcxx/cstddef"
#include "third_party/libcxx/cstdint"
#include "third_party/libcxx/type_traits"
#include "third_party/libcxx/version"
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
#ifdef _LIBCPP_HAS_NO_THREADS
# error <atomic> is not supported on this single threaded system
#endif
#ifdef _LIBCPP_HAS_NO_ATOMIC_HEADER
# error <atomic> is not implemented
#endif
#ifdef kill_dependency
# error C++ standard library is incompatible with <stdatomic.h>
#endif
#define _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m) \
_LIBCPP_DIAGNOSE_WARNING(__m == memory_order_consume || \
__m == memory_order_acquire || \
__m == memory_order_acq_rel, \
"memory order argument to atomic operation is invalid")
#define _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m) \
_LIBCPP_DIAGNOSE_WARNING(__m == memory_order_release || \
__m == memory_order_acq_rel, \
"memory order argument to atomic operation is invalid")
#define _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__m, __f) \
_LIBCPP_DIAGNOSE_WARNING(__f == memory_order_release || \
__f == memory_order_acq_rel, \
"memory order argument to atomic operation is invalid")
_LIBCPP_BEGIN_NAMESPACE_STD
/* /*
atomic synopsis atomic synopsis
@ -547,44 +585,6 @@ void atomic_signal_fence(memory_order m) noexcept;
*/ */
#include "third_party/libcxx/__config"
#include "third_party/libcxx/cstddef"
#include "third_party/libcxx/cstdint"
#include "third_party/libcxx/type_traits"
#include "third_party/libcxx/version"
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
#ifdef _LIBCPP_HAS_NO_THREADS
# error <atomic> is not supported on this single threaded system
#endif
#ifdef _LIBCPP_HAS_NO_ATOMIC_HEADER
# error <atomic> is not implemented
#endif
#ifdef kill_dependency
# error C++ standard library is incompatible with <stdatomic.h>
#endif
#define _LIBCPP_CHECK_STORE_MEMORY_ORDER(__m) \
_LIBCPP_DIAGNOSE_WARNING(__m == memory_order_consume || \
__m == memory_order_acquire || \
__m == memory_order_acq_rel, \
"memory order argument to atomic operation is invalid")
#define _LIBCPP_CHECK_LOAD_MEMORY_ORDER(__m) \
_LIBCPP_DIAGNOSE_WARNING(__m == memory_order_release || \
__m == memory_order_acq_rel, \
"memory order argument to atomic operation is invalid")
#define _LIBCPP_CHECK_EXCHANGE_MEMORY_ORDER(__m, __f) \
_LIBCPP_DIAGNOSE_WARNING(__f == memory_order_release || \
__f == memory_order_acq_rel, \
"memory order argument to atomic operation is invalid")
_LIBCPP_BEGIN_NAMESPACE_STD
// Figure out what the underlying type for `memory_order` would be if it were // Figure out what the underlying type for `memory_order` would be if it were
// declared as an unscoped enum (accounting for -fshort-enums). Use this result // declared as an unscoped enum (accounting for -fshort-enums). Use this result
// to pin the underlying type in C++20. // to pin the underlying type in C++20.

View file

@ -10,6 +10,21 @@
#ifndef _LIBCPP_BIT #ifndef _LIBCPP_BIT
#define _LIBCPP_BIT #define _LIBCPP_BIT
#include "third_party/libcxx/__config"
#include "third_party/libcxx/limits"
#include "third_party/libcxx/type_traits"
#include "third_party/libcxx/version"
#include "third_party/libcxx/__debug"
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_PUSH_MACROS
#include "third_party/libcxx/__undef_macros"
_LIBCPP_BEGIN_NAMESPACE_STD
/* /*
bit synopsis bit synopsis
@ -53,21 +68,6 @@ namespace std {
*/ */
#include "third_party/libcxx/__config"
#include "third_party/libcxx/limits"
#include "third_party/libcxx/type_traits"
#include "third_party/libcxx/version"
#include "third_party/libcxx/__debug"
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_PUSH_MACROS
#include "third_party/libcxx/__undef_macros"
_LIBCPP_BEGIN_NAMESPACE_STD
#ifndef _LIBCPP_COMPILER_MSVC #ifndef _LIBCPP_COMPILER_MSVC
inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR

View file

@ -10,6 +10,25 @@
#ifndef _LIBCPP_BITSET #ifndef _LIBCPP_BITSET
#define _LIBCPP_BITSET #define _LIBCPP_BITSET
#include "third_party/libcxx/__config"
#include "third_party/libcxx/__bit_reference"
#include "third_party/libcxx/cstddef"
#include "third_party/libcxx/climits"
#include "third_party/libcxx/string"
#include "third_party/libcxx/stdexcept"
#include "third_party/libcxx/iosfwd"
#include "third_party/libcxx/__functional_base"
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_PUSH_MACROS
#include "third_party/libcxx/__undef_macros"
_LIBCPP_BEGIN_NAMESPACE_STD
/* /*
bitset synopsis bitset synopsis
@ -112,25 +131,6 @@ template <size_t N> struct hash<std::bitset<N>>;
*/ */
#include "third_party/libcxx/__config"
#include "third_party/libcxx/__bit_reference"
#include "third_party/libcxx/cstddef"
#include "third_party/libcxx/climits"
#include "third_party/libcxx/string"
#include "third_party/libcxx/stdexcept"
#include "third_party/libcxx/iosfwd"
#include "third_party/libcxx/__functional_base"
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_PUSH_MACROS
#include "third_party/libcxx/__undef_macros"
_LIBCPP_BEGIN_NAMESPACE_STD
template <size_t _N_words, size_t _Size> template <size_t _N_words, size_t _Size>
class __bitset; class __bitset;

View file

@ -10,6 +10,9 @@
#ifndef _LIBCPP_CERRNO #ifndef _LIBCPP_CERRNO
#define _LIBCPP_CERRNO #define _LIBCPP_CERRNO
#include "third_party/libcxx/__config"
#include "third_party/libcxx/errno.h"
/* /*
cerrno synopsis cerrno synopsis
@ -22,9 +25,6 @@ Macros:
*/ */
#include "third_party/libcxx/__config"
#include "third_party/libcxx/errno.h"
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif #endif

View file

@ -10,6 +10,24 @@
#ifndef _LIBCPP_CHARCONV #ifndef _LIBCPP_CHARCONV
#define _LIBCPP_CHARCONV #define _LIBCPP_CHARCONV
#include "third_party/libcxx/__errc"
#include "third_party/libcxx/type_traits"
#include "third_party/libcxx/limits"
#include "third_party/libcxx/string.h"
#include "libc/literal.h"
#include "third_party/libcxx/math.h"
#include "third_party/libcxx/__debug"
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_PUSH_MACROS
#include "third_party/libcxx/__undef_macros"
_LIBCPP_BEGIN_NAMESPACE_STD
/* /*
charconv synopsis charconv synopsis
@ -73,24 +91,6 @@ namespace std {
*/ */
#include "third_party/libcxx/__errc"
#include "third_party/libcxx/type_traits"
#include "third_party/libcxx/limits"
#include "third_party/libcxx/string.h"
#include "libc/literal.h"
#include "third_party/libcxx/math.h"
#include "third_party/libcxx/__debug"
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_PUSH_MACROS
#include "third_party/libcxx/__undef_macros"
_LIBCPP_BEGIN_NAMESPACE_STD
namespace __itoa { namespace __itoa {
_LIBCPP_FUNC_VIS char* __u64toa(uint64_t __value, char* __buffer); _LIBCPP_FUNC_VIS char* __u64toa(uint64_t __value, char* __buffer);
_LIBCPP_FUNC_VIS char* __u32toa(uint32_t __value, char* __buffer); _LIBCPP_FUNC_VIS char* __u32toa(uint32_t __value, char* __buffer);

View file

@ -10,6 +10,28 @@
#ifndef _LIBCPP_CHRONO #ifndef _LIBCPP_CHRONO
#define _LIBCPP_CHRONO #define _LIBCPP_CHRONO
#include "third_party/libcxx/__config"
#include "third_party/libcxx/ctime"
#include "third_party/libcxx/type_traits"
#include "third_party/libcxx/ratio"
#include "third_party/libcxx/limits"
#include "third_party/libcxx/version"
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_PUSH_MACROS
#include "third_party/libcxx/__undef_macros"
#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
struct _FilesystemClock;
_LIBCPP_END_NAMESPACE_FILESYSTEM
#endif // !_LIBCPP_CXX03_LANG
_LIBCPP_BEGIN_NAMESPACE_STD
/* /*
chrono synopsis chrono synopsis
@ -823,28 +845,6 @@ constexpr chrono::year operator ""y(unsigned lo
} // std } // std
*/ */
#include "third_party/libcxx/__config"
#include "third_party/libcxx/ctime"
#include "third_party/libcxx/type_traits"
#include "third_party/libcxx/ratio"
#include "third_party/libcxx/limits"
#include "third_party/libcxx/version"
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_PUSH_MACROS
#include "third_party/libcxx/__undef_macros"
#ifndef _LIBCPP_CXX03_LANG
_LIBCPP_BEGIN_NAMESPACE_FILESYSTEM
struct _FilesystemClock;
_LIBCPP_END_NAMESPACE_FILESYSTEM
#endif // !_LIBCPP_CXX03_LANG
_LIBCPP_BEGIN_NAMESPACE_STD
namespace chrono namespace chrono
{ {

View file

@ -10,6 +10,20 @@
#ifndef _LIBCPP_CMATH #ifndef _LIBCPP_CMATH
#define _LIBCPP_CMATH #define _LIBCPP_CMATH
#include "third_party/libcxx/__config"
#include "third_party/libcxx/math.h"
#include "third_party/libcxx/version"
#include "third_party/libcxx/type_traits"
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_PUSH_MACROS
#include "third_party/libcxx/__undef_macros"
_LIBCPP_BEGIN_NAMESPACE_STD
/* /*
cmath synopsis cmath synopsis
@ -300,20 +314,6 @@ long double truncl(long double x);
*/ */
#include "third_party/libcxx/__config"
#include "third_party/libcxx/math.h"
#include "third_party/libcxx/version"
#include "third_party/libcxx/type_traits"
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_PUSH_MACROS
#include "third_party/libcxx/__undef_macros"
_LIBCPP_BEGIN_NAMESPACE_STD
using ::signbit; using ::signbit;
using ::fpclassify; using ::fpclassify;
using ::isfinite; using ::isfinite;

View file

@ -11,6 +11,15 @@
#ifndef _LIBCPP_CODECVT #ifndef _LIBCPP_CODECVT
#define _LIBCPP_CODECVT #define _LIBCPP_CODECVT
#include "third_party/libcxx/__config"
#include "third_party/libcxx/__locale"
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
/* /*
codecvt synopsis codecvt synopsis
@ -55,15 +64,6 @@ class codecvt_utf8_utf16
*/ */
#include "third_party/libcxx/__config"
#include "third_party/libcxx/__locale"
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
enum codecvt_mode enum codecvt_mode
{ {
consume_header = 4, consume_header = 4,

View file

@ -11,6 +11,18 @@
#ifndef _LIBCPP_CONDITION_VARIABLE #ifndef _LIBCPP_CONDITION_VARIABLE
#define _LIBCPP_CONDITION_VARIABLE #define _LIBCPP_CONDITION_VARIABLE
#include "third_party/libcxx/__config"
#include "third_party/libcxx/__mutex_base"
#include "third_party/libcxx/memory"
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
#ifndef _LIBCPP_HAS_NO_THREADS
_LIBCPP_BEGIN_NAMESPACE_STD
/* /*
condition_variable synopsis condition_variable synopsis
@ -107,18 +119,6 @@ public:
*/ */
#include "third_party/libcxx/__config"
#include "third_party/libcxx/__mutex_base"
#include "third_party/libcxx/memory"
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
#ifndef _LIBCPP_HAS_NO_THREADS
_LIBCPP_BEGIN_NAMESPACE_STD
class _LIBCPP_TYPE_VIS condition_variable_any class _LIBCPP_TYPE_VIS condition_variable_any
{ {
condition_variable __cv_; condition_variable __cv_;

View file

@ -10,6 +10,14 @@
#ifndef _LIBCPP_CSTDARG #ifndef _LIBCPP_CSTDARG
#define _LIBCPP_CSTDARG #define _LIBCPP_CSTDARG
#include "third_party/libcxx/__config"
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
/* /*
cstdarg synopsis cstdarg synopsis
@ -31,14 +39,6 @@ Types:
*/ */
#include "third_party/libcxx/__config"
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
using ::va_list; using ::va_list;
_LIBCPP_END_NAMESPACE_STD _LIBCPP_END_NAMESPACE_STD

View file

@ -10,6 +10,16 @@
#ifndef _LIBCPP_CSTDINT #ifndef _LIBCPP_CSTDINT
#define _LIBCPP_CSTDINT #define _LIBCPP_CSTDINT
#include "libc/inttypes.h"
#include "libc/calls/weirdtypes.h"
#include "third_party/libcxx/__config"
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
/* /*
cstdint synopsis cstdint synopsis
@ -140,16 +150,6 @@ Types:
} // std } // std
*/ */
#include "libc/inttypes.h"
#include "libc/calls/weirdtypes.h"
#include "third_party/libcxx/__config"
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
using::int8_t; using::int8_t;
using::int16_t; using::int16_t;
using::int32_t; using::int32_t;

View file

@ -10,6 +10,15 @@
#ifndef _LIBCPP_CSTDIO #ifndef _LIBCPP_CSTDIO
#define _LIBCPP_CSTDIO #define _LIBCPP_CSTDIO
#include "third_party/libcxx/__config"
#include "third_party/libcxx/stdio.h"
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
/* /*
cstdio synopsis cstdio synopsis
@ -95,15 +104,6 @@ void perror(const char* s);
} // std } // std
*/ */
#include "third_party/libcxx/__config"
#include "third_party/libcxx/stdio.h"
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
using ::FILE; using ::FILE;
using ::fpos_t; using ::fpos_t;
using ::size_t; using ::size_t;

View file

@ -10,6 +10,9 @@
#ifndef _LIBCPP_CSTDLIB #ifndef _LIBCPP_CSTDLIB
#define _LIBCPP_CSTDLIB #define _LIBCPP_CSTDLIB
#include "third_party/libcxx/__config"
#include "third_party/libcxx/stdlib.h"
/* /*
cstdlib synopsis cstdlib synopsis
@ -81,9 +84,6 @@ void *aligned_alloc(size_t alignment, size_t size); // C11
*/ */
#include "third_party/libcxx/__config"
#include "third_party/libcxx/stdlib.h"
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header #pragma GCC system_header
#endif #endif

View file

@ -10,6 +10,15 @@
#ifndef _LIBCPP_CSTRING #ifndef _LIBCPP_CSTRING
#define _LIBCPP_CSTRING #define _LIBCPP_CSTRING
#include "third_party/libcxx/__config"
#include "third_party/libcxx/string.h"
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
/* /*
cstring synopsis cstring synopsis
@ -56,15 +65,6 @@ size_t strlen(const char* s);
*/ */
#include "third_party/libcxx/__config"
#include "third_party/libcxx/string.h"
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
using ::size_t; using ::size_t;
using ::memcpy; using ::memcpy;
using ::memmove; using ::memmove;

View file

@ -10,6 +10,16 @@
#ifndef _LIBCPP_CTIME #ifndef _LIBCPP_CTIME
#define _LIBCPP_CTIME #define _LIBCPP_CTIME
#include "third_party/libcxx/__config"
#include "libc/calls/weirdtypes.h"
#include "libc/isystem/time.h"
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
/* /*
ctime synopsis ctime synopsis
@ -45,16 +55,6 @@ int timespec_get( struct timespec *ts, int base); // C++17
*/ */
#include "third_party/libcxx/__config"
#include "libc/calls/weirdtypes.h"
#include "libc/isystem/time.h"
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
using ::clock_t; using ::clock_t;
using ::size_t; using ::size_t;
using ::time_t; using ::time_t;

View file

@ -10,6 +10,17 @@
#ifndef _LIBCPP_CWCHAR #ifndef _LIBCPP_CWCHAR
#define _LIBCPP_CWCHAR #define _LIBCPP_CWCHAR
#include "third_party/libcxx/__config"
#include "third_party/libcxx/cwctype"
#include "third_party/libcxx/wchar.h"
#include "libc/time/struct/tm.h"
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
/* /*
cwchar synopsis cwchar synopsis
@ -102,17 +113,6 @@ size_t wcsrtombs(char* restrict dst, const wchar_t** restrict src, size_t len,
*/ */
#include "third_party/libcxx/__config"
#include "third_party/libcxx/cwctype"
#include "third_party/libcxx/wchar.h"
#include "libc/time/struct/tm.h"
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
using ::mbstate_t; using ::mbstate_t;
using ::size_t; using ::size_t;
using ::tm; using ::tm;

View file

@ -10,6 +10,24 @@
#ifndef _LIBCPP_DEQUE #ifndef _LIBCPP_DEQUE
#define _LIBCPP_DEQUE #define _LIBCPP_DEQUE
#include "third_party/libcxx/__config"
#include "third_party/libcxx/__split_buffer"
#include "third_party/libcxx/type_traits"
#include "third_party/libcxx/initializer_list"
#include "third_party/libcxx/iterator"
#include "third_party/libcxx/algorithm"
#include "third_party/libcxx/stdexcept"
#include "third_party/libcxx/version"
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_PUSH_MACROS
#include "third_party/libcxx/__undef_macros"
_LIBCPP_BEGIN_NAMESPACE_STD
/* /*
deque synopsis deque synopsis
@ -158,25 +176,6 @@ template <class T, class Allocator, class Predicate>
*/ */
#include "third_party/libcxx/__config"
#include "third_party/libcxx/__split_buffer"
#include "third_party/libcxx/type_traits"
#include "third_party/libcxx/initializer_list"
#include "third_party/libcxx/iterator"
#include "third_party/libcxx/algorithm"
#include "third_party/libcxx/stdexcept"
#include "third_party/libcxx/version"
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_PUSH_MACROS
#include "third_party/libcxx/__undef_macros"
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, class _Allocator> class __deque_base; template <class _Tp, class _Allocator> class __deque_base;
template <class _Tp, class _Allocator = allocator<_Tp> > class _LIBCPP_TEMPLATE_VIS deque; template <class _Tp, class _Allocator = allocator<_Tp> > class _LIBCPP_TEMPLATE_VIS deque;

View file

@ -10,6 +10,16 @@
#ifndef _LIBCPP_EXCEPTION #ifndef _LIBCPP_EXCEPTION
#define _LIBCPP_EXCEPTION #define _LIBCPP_EXCEPTION
#include "third_party/libcxx/__config"
#include "third_party/libcxx/cstddef"
#include "third_party/libcxx/cstdlib"
#include "third_party/libcxx/type_traits"
#include "third_party/libcxx/version"
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
/* /*
exception synopsis exception synopsis
@ -76,16 +86,6 @@ template <class E> void rethrow_if_nested(const E& e);
*/ */
#include "third_party/libcxx/__config"
#include "third_party/libcxx/cstddef"
#include "third_party/libcxx/cstdlib"
#include "third_party/libcxx/type_traits"
#include "third_party/libcxx/version"
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
namespace std // purposefully not using versioning namespace namespace std // purposefully not using versioning namespace
{ {

View file

@ -10,6 +10,21 @@
#ifndef _LIBCPP_FUNCTIONAL #ifndef _LIBCPP_FUNCTIONAL
#define _LIBCPP_FUNCTIONAL #define _LIBCPP_FUNCTIONAL
#include "third_party/libcxx/__config"
#include "third_party/libcxx/type_traits"
#include "third_party/libcxx/typeinfo"
#include "third_party/libcxx/exception"
#include "third_party/libcxx/memory"
#include "third_party/libcxx/tuple"
#include "third_party/libcxx/utility"
#include "third_party/libcxx/version"
#include "third_party/libcxx/__functional_base"
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
/* /*
functional synopsis functional synopsis
@ -497,21 +512,6 @@ POLICY: For non-variadic implementations, the number of arguments is limited
*/ */
#include "third_party/libcxx/__config"
#include "third_party/libcxx/type_traits"
#include "third_party/libcxx/typeinfo"
#include "third_party/libcxx/exception"
#include "third_party/libcxx/memory"
#include "third_party/libcxx/tuple"
#include "third_party/libcxx/utility"
#include "third_party/libcxx/version"
#include "third_party/libcxx/__functional_base"
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD _LIBCPP_BEGIN_NAMESPACE_STD
#if _LIBCPP_STD_VER > 11 #if _LIBCPP_STD_VER > 11
@ -2528,7 +2528,7 @@ swap(function<_Rp(_ArgTypes...)>& __x, function<_Rp(_ArgTypes...)>& __y) _NOEXCE
#else // _LIBCPP_CXX03_LANG #else // _LIBCPP_CXX03_LANG
#include "third_party/libcxx/__functional_03" # include "third_party/libcxx/__functional_03"
#endif #endif

View file

@ -10,6 +10,21 @@
#ifndef _LIBCPP_IOS #ifndef _LIBCPP_IOS
#define _LIBCPP_IOS #define _LIBCPP_IOS
#include "third_party/libcxx/__config"
#include "third_party/libcxx/iosfwd"
#include "third_party/libcxx/__locale"
#include "third_party/libcxx/system_error"
#if !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER)
#include "third_party/libcxx/atomic" // for __xindex_
#endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
/* /*
ios synopsis ios synopsis
@ -210,21 +225,6 @@ storage-class-specifier const error_category& iostream_category() noexcept;
*/ */
#include "third_party/libcxx/__config"
#include "third_party/libcxx/iosfwd"
#include "third_party/libcxx/__locale"
#include "third_party/libcxx/system_error"
#if !defined(_LIBCPP_HAS_NO_ATOMIC_HEADER)
#include "third_party/libcxx/atomic" // for __xindex_
#endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
typedef ptrdiff_t streamsize; typedef ptrdiff_t streamsize;
class _LIBCPP_TYPE_VIS ios_base class _LIBCPP_TYPE_VIS ios_base

View file

@ -10,6 +10,15 @@
#ifndef _LIBCPP_IOSFWD #ifndef _LIBCPP_IOSFWD
#define _LIBCPP_IOSFWD #define _LIBCPP_IOSFWD
#include "third_party/libcxx/__config"
#include "third_party/libcxx/wchar.h" // for mbstate_t
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
/* /*
iosfwd synopsis iosfwd synopsis
@ -91,15 +100,6 @@ typedef fpos<char_traits<wchar_t>::state_type> wstreampos;
*/ */
#include "third_party/libcxx/__config"
#include "third_party/libcxx/wchar.h" // for mbstate_t
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
class _LIBCPP_TYPE_VIS ios_base; class _LIBCPP_TYPE_VIS ios_base;
template<class _CharT> struct _LIBCPP_TEMPLATE_VIS char_traits; template<class _CharT> struct _LIBCPP_TEMPLATE_VIS char_traits;

View file

@ -10,6 +10,20 @@
#ifndef _LIBCPP_ISTREAM #ifndef _LIBCPP_ISTREAM
#define _LIBCPP_ISTREAM #define _LIBCPP_ISTREAM
#include "third_party/libcxx/__config"
#include "third_party/libcxx/version"
#include "third_party/libcxx/ostream"
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_PUSH_MACROS
#include "third_party/libcxx/__undef_macros"
_LIBCPP_BEGIN_NAMESPACE_STD
/* /*
istream synopsis istream synopsis
@ -158,20 +172,6 @@ template <class charT, class traits, class T>
*/ */
#include "third_party/libcxx/__config"
#include "third_party/libcxx/version"
#include "third_party/libcxx/ostream"
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_PUSH_MACROS
#include "third_party/libcxx/__undef_macros"
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _CharT, class _Traits> template <class _CharT, class _Traits>
class _LIBCPP_TEMPLATE_VIS basic_istream class _LIBCPP_TEMPLATE_VIS basic_istream
: virtual public basic_ios<_CharT, _Traits> : virtual public basic_ios<_CharT, _Traits>

View file

@ -10,6 +10,22 @@
#ifndef _LIBCPP_ITERATOR #ifndef _LIBCPP_ITERATOR
#define _LIBCPP_ITERATOR #define _LIBCPP_ITERATOR
#include "third_party/libcxx/__config"
#include "third_party/libcxx/iosfwd" // for forward declarations of vector and string.
#include "third_party/libcxx/__functional_base"
#include "third_party/libcxx/type_traits"
#include "third_party/libcxx/cstddef"
#include "third_party/libcxx/initializer_list"
#include "third_party/libcxx/version"
#include "third_party/libcxx/__debug"
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
/* /*
iterator synopsis iterator synopsis
@ -416,25 +432,6 @@ template <class E> constexpr const E* data(initializer_list<E> il) noexcept;
*/ */
#include "third_party/libcxx/__config"
#include "third_party/libcxx/iosfwd" // for forward declarations of vector and string.
#include "third_party/libcxx/__functional_base"
#include "third_party/libcxx/type_traits"
#include "third_party/libcxx/cstddef"
#include "third_party/libcxx/initializer_list"
#include "third_party/libcxx/version"
#ifdef __APPLE__
#include "third_party/libcxx/Availability.h"
#endif
#include "third_party/libcxx/__debug"
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
struct _LIBCPP_TEMPLATE_VIS input_iterator_tag {}; struct _LIBCPP_TEMPLATE_VIS input_iterator_tag {};
struct _LIBCPP_TEMPLATE_VIS output_iterator_tag {}; struct _LIBCPP_TEMPLATE_VIS output_iterator_tag {};
struct _LIBCPP_TEMPLATE_VIS forward_iterator_tag : public input_iterator_tag {}; struct _LIBCPP_TEMPLATE_VIS forward_iterator_tag : public input_iterator_tag {};

View file

@ -7,43 +7,62 @@ THIRD_PARTY_LIBCXX_ARTIFACTS += THIRD_PARTY_LIBCXX_A
THIRD_PARTY_LIBCXX = $(THIRD_PARTY_LIBCXX_A_DEPS) $(THIRD_PARTY_LIBCXX_A) THIRD_PARTY_LIBCXX = $(THIRD_PARTY_LIBCXX_A_DEPS) $(THIRD_PARTY_LIBCXX_A)
THIRD_PARTY_LIBCXX_A = o/$(MODE)/third_party/libcxx/libcxx.a THIRD_PARTY_LIBCXX_A = o/$(MODE)/third_party/libcxx/libcxx.a
# third_party/libcxx/__functional_base_03 \
THIRD_PARTY_LIBCXX_A_HDRS = \ THIRD_PARTY_LIBCXX_A_HDRS = \
third_party/libcxx/__bit_reference \ third_party/libcxx/__bit_reference \
third_party/libcxx/__bsd_locale_fallbacks.h \
third_party/libcxx/__config \ third_party/libcxx/__config \
third_party/libcxx/__debug \ third_party/libcxx/__debug \
third_party/libcxx/__errc \
third_party/libcxx/__functional_base \ third_party/libcxx/__functional_base \
third_party/libcxx/__hash_table \ third_party/libcxx/__hash_table \
third_party/libcxx/__locale \
third_party/libcxx/__mutex_base \ third_party/libcxx/__mutex_base \
third_party/libcxx/__node_handle \ third_party/libcxx/__node_handle \
third_party/libcxx/__nullptr \ third_party/libcxx/__nullptr \
third_party/libcxx/__split_buffer \ third_party/libcxx/__split_buffer \
third_party/libcxx/__sso_allocator \ third_party/libcxx/__sso_allocator \
third_party/libcxx/__std_stream \ third_party/libcxx/__std_stream \
third_party/libcxx/__string \
third_party/libcxx/__threading_support \ third_party/libcxx/__threading_support \
third_party/libcxx/__tree \
third_party/libcxx/__tuple \ third_party/libcxx/__tuple \
third_party/libcxx/__undef_macros \ third_party/libcxx/__undef_macros \
third_party/libcxx/algorithm \ third_party/libcxx/algorithm \
third_party/libcxx/array \ third_party/libcxx/array \
third_party/libcxx/atomic \
third_party/libcxx/atomic_support.hh \ third_party/libcxx/atomic_support.hh \
third_party/libcxx/bit \ third_party/libcxx/bit \
third_party/libcxx/bitset \ third_party/libcxx/bitset \
third_party/libcxx/cassert \ third_party/libcxx/cassert \
third_party/libcxx/cctype \
third_party/libcxx/cerrno \ third_party/libcxx/cerrno \
third_party/libcxx/charconv \
third_party/libcxx/chrono \ third_party/libcxx/chrono \
third_party/libcxx/climits \ third_party/libcxx/climits \
third_party/libcxx/clocale \
third_party/libcxx/cmath \ third_party/libcxx/cmath \
third_party/libcxx/codecvt \ third_party/libcxx/codecvt \
third_party/libcxx/condition_variable \ third_party/libcxx/condition_variable \
third_party/libcxx/config_elast.h \ third_party/libcxx/config_elast.h \
third_party/libcxx/cstdarg \
third_party/libcxx/cstddef \ third_party/libcxx/cstddef \
third_party/libcxx/cstdint \ third_party/libcxx/cstdint \
third_party/libcxx/cstdio \ third_party/libcxx/cstdio \
third_party/libcxx/cstdlib \ third_party/libcxx/cstdlib \
third_party/libcxx/cstring \ third_party/libcxx/cstring \
third_party/libcxx/ctime \
third_party/libcxx/ctype.h \
third_party/libcxx/cwchar \
third_party/libcxx/cwctype \
third_party/libcxx/deque \ third_party/libcxx/deque \
third_party/libcxx/errno.h \
third_party/libcxx/exception \ third_party/libcxx/exception \
third_party/libcxx/exception_fallback.hh \ third_party/libcxx/exception_fallback.hh \
third_party/libcxx/exception_pointer_unimplemented.hh \ third_party/libcxx/exception_pointer_unimplemented.hh \
third_party/libcxx/experimental/__config \
third_party/libcxx/functional \
third_party/libcxx/include/atomic_support.hh \ third_party/libcxx/include/atomic_support.hh \
third_party/libcxx/include/config_elast.hh \ third_party/libcxx/include/config_elast.hh \
third_party/libcxx/initializer_list \ third_party/libcxx/initializer_list \
@ -51,9 +70,14 @@ THIRD_PARTY_LIBCXX_A_HDRS = \
third_party/libcxx/iosfwd \ third_party/libcxx/iosfwd \
third_party/libcxx/iostream \ third_party/libcxx/iostream \
third_party/libcxx/istream \ third_party/libcxx/istream \
third_party/libcxx/iterator \
third_party/libcxx/limits \ third_party/libcxx/limits \
third_party/libcxx/limits.h \
third_party/libcxx/list \ third_party/libcxx/list \
third_party/libcxx/locale \
third_party/libcxx/locale.h \
third_party/libcxx/map \ third_party/libcxx/map \
third_party/libcxx/math.h \
third_party/libcxx/memory \ third_party/libcxx/memory \
third_party/libcxx/mutex \ third_party/libcxx/mutex \
third_party/libcxx/new \ third_party/libcxx/new \
@ -68,12 +92,17 @@ THIRD_PARTY_LIBCXX_A_HDRS = \
third_party/libcxx/refstring.hh \ third_party/libcxx/refstring.hh \
third_party/libcxx/set \ third_party/libcxx/set \
third_party/libcxx/sstream \ third_party/libcxx/sstream \
third_party/libcxx/stack \
third_party/libcxx/stdexcept \ third_party/libcxx/stdexcept \
third_party/libcxx/stdexcept_default.hh \ third_party/libcxx/stdexcept_default.hh \
third_party/libcxx/stdio.h \
third_party/libcxx/stdlib.h \
third_party/libcxx/streambuf \ third_party/libcxx/streambuf \
third_party/libcxx/string \ third_party/libcxx/string \
third_party/libcxx/string.h \
third_party/libcxx/string_view \ third_party/libcxx/string_view \
third_party/libcxx/system_error \ third_party/libcxx/system_error \
third_party/libcxx/thread \
third_party/libcxx/tuple \ third_party/libcxx/tuple \
third_party/libcxx/type_traits \ third_party/libcxx/type_traits \
third_party/libcxx/typeinfo \ third_party/libcxx/typeinfo \
@ -83,7 +112,8 @@ THIRD_PARTY_LIBCXX_A_HDRS = \
third_party/libcxx/variant \ third_party/libcxx/variant \
third_party/libcxx/vector \ third_party/libcxx/vector \
third_party/libcxx/version \ third_party/libcxx/version \
third_party/libcxx/wchar.h third_party/libcxx/wchar.h \
third_party/libcxx/wctype.h
THIRD_PARTY_LIBCXX_A_SRCS_CC = \ THIRD_PARTY_LIBCXX_A_SRCS_CC = \
third_party/libcxx/algorithm.cc \ third_party/libcxx/algorithm.cc \

View file

@ -10,6 +10,19 @@
#ifndef _LIBCPP_LIMITS #ifndef _LIBCPP_LIMITS
#define _LIBCPP_LIMITS #define _LIBCPP_LIMITS
#include "third_party/libcxx/__config"
#include "third_party/libcxx/type_traits"
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_PUSH_MACROS
#include "third_party/libcxx/__undef_macros"
#include "third_party/libcxx/version"
_LIBCPP_BEGIN_NAMESPACE_STD
/* /*
limits synopsis limits synopsis
@ -101,19 +114,6 @@ template<> class numeric_limits<cv long double>;
} // std } // std
*/ */
#include "third_party/libcxx/__config"
#include "third_party/libcxx/type_traits"
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_PUSH_MACROS
#include "third_party/libcxx/__undef_macros"
#include "third_party/libcxx/version"
_LIBCPP_BEGIN_NAMESPACE_STD
enum float_round_style enum float_round_style
{ {

View file

@ -10,6 +10,28 @@
#ifndef _LIBCPP_LIST #ifndef _LIBCPP_LIST
#define _LIBCPP_LIST #define _LIBCPP_LIST
#include "third_party/libcxx/__config"
#include "third_party/libcxx/memory"
#include "third_party/libcxx/limits"
#include "third_party/libcxx/initializer_list"
#include "third_party/libcxx/iterator"
#include "third_party/libcxx/algorithm"
#include "third_party/libcxx/type_traits"
#include "third_party/libcxx/version"
#include "third_party/libcxx/__debug"
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_PUSH_MACROS
#include "third_party/libcxx/__undef_macros"
_LIBCPP_BEGIN_NAMESPACE_STD
/* /*
list synopsis list synopsis
@ -178,28 +200,6 @@ template <class T, class Allocator, class Predicate>
*/ */
#include "third_party/libcxx/__config"
#include "third_party/libcxx/memory"
#include "third_party/libcxx/limits"
#include "third_party/libcxx/initializer_list"
#include "third_party/libcxx/iterator"
#include "third_party/libcxx/algorithm"
#include "third_party/libcxx/type_traits"
#include "third_party/libcxx/version"
#include "third_party/libcxx/__debug"
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_PUSH_MACROS
#include "third_party/libcxx/__undef_macros"
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Tp, class _VoidPtr> struct __list_node; template <class _Tp, class _VoidPtr> struct __list_node;
template <class _Tp, class _VoidPtr> struct __list_node_base; template <class _Tp, class _VoidPtr> struct __list_node_base;

View file

@ -10,6 +10,41 @@
#ifndef _LIBCPP_LOCALE #ifndef _LIBCPP_LOCALE
#define _LIBCPP_LOCALE #define _LIBCPP_LOCALE
#include "third_party/libcxx/__config"
#include "third_party/libcxx/__locale"
#include "third_party/libcxx/__debug"
#include "third_party/libcxx/algorithm"
#include "third_party/libcxx/memory"
#include "third_party/libcxx/ios"
#include "third_party/libcxx/streambuf"
#include "third_party/libcxx/iterator"
#include "third_party/libcxx/limits"
#include "third_party/libcxx/version"
#include "third_party/libcxx/cstdarg"
#include "third_party/libcxx/cstdlib"
#include "third_party/libcxx/ctime"
#include "third_party/libcxx/cstdio"
#ifdef _LIBCPP_HAS_CATOPEN
# include "libc/unicode/locale.h"
# include "third_party/libcxx/nl_types.h"
#endif
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
# include "third_party/libcxx/__bsd_locale_defaults.h"
#else
#include "third_party/libcxx/__bsd_locale_fallbacks.h"
#endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_PUSH_MACROS
#include "third_party/libcxx/__undef_macros"
_LIBCPP_BEGIN_NAMESPACE_STD
/* /*
locale synopsis locale synopsis
@ -177,47 +212,6 @@ template <class charT> class messages_byname;
*/ */
#include "third_party/libcxx/__config"
#include "third_party/libcxx/__locale"
#include "third_party/libcxx/__debug"
#include "third_party/libcxx/algorithm"
#include "third_party/libcxx/memory"
#include "third_party/libcxx/ios"
#include "third_party/libcxx/streambuf"
#include "third_party/libcxx/iterator"
#include "third_party/libcxx/limits"
#include "third_party/libcxx/version"
#ifndef __APPLE__
#include "third_party/libcxx/cstdarg"
#endif
#include "third_party/libcxx/cstdlib"
#include "third_party/libcxx/ctime"
#include "third_party/libcxx/cstdio"
#ifdef _LIBCPP_HAS_CATOPEN
#include "libc/unicode/locale.h"
#include "third_party/libcxx/nl_types.h"
#endif
#ifdef __APPLE__
#include "third_party/libcxx/Availability.h"
#endif
#ifdef _LIBCPP_LOCALE__L_EXTENSIONS
#include "third_party/libcxx/__bsd_locale_defaults.h"
#else
#include "third_party/libcxx/__bsd_locale_fallbacks.h"
#endif
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_PUSH_MACROS
#include "third_party/libcxx/__undef_macros"
_LIBCPP_BEGIN_NAMESPACE_STD
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__COSMOPOLITAN__) #if defined(__APPLE__) || defined(__FreeBSD__) || defined(__COSMOPOLITAN__)
# define _LIBCPP_GET_C_LOCALE 0 # define _LIBCPP_GET_C_LOCALE 0
#elif defined(__CloudABI__) || defined(__NetBSD__) #elif defined(__CloudABI__) || defined(__NetBSD__)

View file

@ -10,6 +10,23 @@
#ifndef _LIBCPP_MAP #ifndef _LIBCPP_MAP
#define _LIBCPP_MAP #define _LIBCPP_MAP
#include "third_party/libcxx/__config"
#include "third_party/libcxx/__tree"
#include "third_party/libcxx/__node_handle"
#include "third_party/libcxx/iterator"
#include "third_party/libcxx/memory"
#include "third_party/libcxx/utility"
#include "third_party/libcxx/functional"
#include "third_party/libcxx/initializer_list"
#include "third_party/libcxx/type_traits"
#include "third_party/libcxx/version"
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
/* /*
map synopsis map synopsis
@ -475,23 +492,6 @@ template <class Key, class T, class Compare, class Allocator, class Predicate>
*/ */
#include "third_party/libcxx/__config"
#include "third_party/libcxx/__tree"
#include "third_party/libcxx/__node_handle"
#include "third_party/libcxx/iterator"
#include "third_party/libcxx/memory"
#include "third_party/libcxx/utility"
#include "third_party/libcxx/functional"
#include "third_party/libcxx/initializer_list"
#include "third_party/libcxx/type_traits"
#include "third_party/libcxx/version"
#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
#pragma GCC system_header
#endif
_LIBCPP_BEGIN_NAMESPACE_STD
template <class _Key, class _CP, class _Compare, template <class _Key, class _CP, class _Compare,
bool = is_empty<_Compare>::value && !__libcpp_is_final<_Compare>::value> bool = is_empty<_Compare>::value && !__libcpp_is_final<_Compare>::value>
class __map_value_compare class __map_value_compare

Some files were not shown because too many files have changed in this diff Show more