Remove more nonstandard stuff from cosmopolitan.h

Fixes #61
This commit is contained in:
Justine Tunney 2021-02-28 23:42:35 -08:00
parent 5e069a64d4
commit d932948fb4
954 changed files with 1095 additions and 1342 deletions

View file

@ -22,7 +22,7 @@
#include "libc/fmt/conv.h"
#include "libc/log/check.h"
#include "libc/log/log.h"
#include "libc/macros.h"
#include "libc/macros.internal.h"
#include "libc/mem/mem.h"
#include "libc/nexgen32e/bsr.h"
#include "libc/runtime/runtime.h"

View file

@ -12,7 +12,7 @@
#include "libc/limits.h"
#include "libc/log/check.h"
#include "libc/log/log.h"
#include "libc/macros.h"
#include "libc/macros.internal.h"
#include "libc/mem/mem.h"
#include "libc/nexgen32e/bsf.h"
#include "libc/nexgen32e/bsr.h"

View file

@ -1,4 +1,4 @@
#include "libc/macros.h"
#include "libc/macros.internal.h"
#include "third_party/chibicc/test/test.h"
int index1d(int xn, int p[xn], int x) {

View file

@ -1,4 +1,4 @@
#include "libc/macros.h"
#include "libc/macros.internal.h"
// Nop ref this to force pull the license into linkage.
.section .yoink

View file

@ -1,5 +1,5 @@
#include "libc/bits/initializer.internal.h"
#include "libc/bits/safemacros.h"
#include "libc/bits/safemacros.internal.h"
#include "libc/bits/weaken.h"
#include "libc/calls/internal.h"
#include "libc/calls/struct/sysinfo.h"
@ -7,7 +7,7 @@
#include "libc/fmt/conv.h"
#include "libc/intrin/asan.internal.h"
#include "libc/limits.h"
#include "libc/macros.h"
#include "libc/macros.internal.h"
#include "libc/mem/mem.h"
#include "libc/nt/systeminfo.h"
#include "libc/runtime/runtime.h"

View file

@ -16,7 +16,7 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/macros.h"
#include "libc/macros.internal.h"
.source __FILE__
// Sneak ahead ctor list b/c runtime weakly links malloc.

View file

@ -16,7 +16,7 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/macros.h"
#include "libc/macros.internal.h"
.initbss 300,_init_duk_hex_dectab
duk_hex_dectab:

View file

@ -16,7 +16,7 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/macros.h"
#include "libc/macros.internal.h"
.source __FILE__
.init.start 201,_init_getopt

View file

@ -16,7 +16,7 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/bits/safemacros.h"
#include "libc/bits/safemacros.internal.h"
#include "libc/fmt/fmt.h"
#include "libc/str/str.h"
#include "third_party/regex/regex.h"

View file

@ -16,7 +16,7 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/macros.h"
#include "libc/macros.internal.h"
// Computes inverse discrete cosine transform.
//

View file

@ -23,7 +23,7 @@
#include "libc/limits.h"
#include "libc/log/gdb.h"
#include "libc/log/log.h"
#include "libc/macros.h"
#include "libc/macros.internal.h"
#include "libc/math.h"
#include "libc/mem/mem.h"
#include "libc/nexgen32e/x86feature.h"

View file

@ -17,7 +17,7 @@
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/assert.h"
#include "libc/macros.h"
#include "libc/macros.internal.h"
#include "libc/math.h"
#include "libc/mem/mem.h"
#include "libc/str/str.h"

View file

@ -123,7 +123,7 @@
#include "libc/fmt/conv.h"
#include "libc/fmt/fmt.h"
#include "libc/limits.h"
#include "libc/macros.h"
#include "libc/macros.internal.h"
#include "libc/math.h"
#include "libc/mem/mem.h"
#include "libc/nexgen32e/nexgen32e.h"

View file

@ -16,7 +16,7 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/macros.h"
#include "libc/macros.internal.h"
.align 16
stbi__YCbCr_to_RGB_row$sse2:

View file

@ -19,7 +19,7 @@
#include "libc/limits.h"
#include "libc/log/check.h"
#include "libc/log/log.h"
#include "libc/macros.h"
#include "libc/macros.internal.h"
#include "libc/str/str.h"
#include "third_party/stb/internal.h"

View file

@ -19,7 +19,7 @@
#include "libc/assert.h"
#include "libc/bits/bits.h"
#include "libc/dce.h"
#include "libc/macros.h"
#include "libc/macros.internal.h"
#include "libc/nexgen32e/bsr.h"
#include "libc/runtime/runtime.h"
#include "libc/str/str.h"

View file

@ -16,7 +16,7 @@
See the License for the specific language governing permissions and
limitations under the License.
*/
#include "libc/macros.h"
#include "libc/macros.internal.h"
// Phash tables for instruction length decoding.
// @see build/rle.py for more context here

View file

@ -9,7 +9,7 @@
#include "libc/dce.h"
#include "libc/nexgen32e/x86feature.h"
#include "third_party/zlib/internal.h"
#include "third_party/zlib/zutil.h"
#include "third_party/zlib/zutil.internal.h"
asm(".ident\t\"\\n\\n\
zlib (zlib License)\\n\

View file

@ -1,7 +1,7 @@
#ifndef THIRD_PARTY_ZLIB_CHUNKCOPY_H
#define THIRD_PARTY_ZLIB_CHUNKCOPY_H
#include "libc/bits/emmintrin.internal.h"
#include "third_party/zlib/zutil.h"
#include "third_party/zlib/zutil.internal.h"
asm(".ident\t\"\\n\\n\
Chromium (BSD-3 License)\\n\

View file

@ -9,9 +9,9 @@
#include "libc/dce.h"
#include "libc/nexgen32e/x86feature.h"
#include "libc/str/str.h"
#include "third_party/zlib/deflate.h"
#include "third_party/zlib/deflate.internal.h"
#include "third_party/zlib/internal.h"
#include "third_party/zlib/zutil.h"
#include "third_party/zlib/zutil.internal.h"
asm(".ident\t\"\\n\\n\
zlib (zlib License)\\n\

View file

@ -6,9 +6,9 @@
Use of this source code is governed by the BSD-style licenses that can
be found in the third_party/zlib/LICENSE file.
*/
#include "third_party/zlib/deflate.h"
#include "third_party/zlib/deflate.internal.h"
#include "third_party/zlib/internal.h"
#include "third_party/zlib/zutil.h"
#include "third_party/zlib/zutil.internal.h"
asm(".ident\t\"\\n\\n\
zlib (zlib License)\\n\

View file

@ -11,7 +11,7 @@
#include "libc/bits/wmmintrin.internal.h"
#include "libc/runtime/runtime.h"
#include "libc/str/str.h"
#include "third_party/zlib/deflate.h"
#include "third_party/zlib/deflate.internal.h"
#include "third_party/zlib/internal.h"
#ifndef __llvm__

View file

@ -7,13 +7,13 @@
*/
#include "libc/bits/bits.h"
#include "libc/dce.h"
#include "libc/macros.h"
#include "libc/macros.internal.h"
#include "libc/mem/mem.h"
#include "libc/nexgen32e/x86feature.h"
#include "libc/str/str.h"
#include "third_party/zlib/deflate.h"
#include "third_party/zlib/deflate.internal.h"
#include "third_party/zlib/internal.h"
#include "third_party/zlib/zutil.h"
#include "third_party/zlib/zutil.internal.h"
asm(".ident\t\"\\n\\n\
inflate 1.2.11 (zlib License)\\n\

View file

@ -1,6 +1,6 @@
#ifndef DEFLATE_H
#define DEFLATE_H
#include "third_party/zlib/zutil.h"
#include "third_party/zlib/zutil.internal.h"
/* define NO_GZIP when compiling if you want to disable gzip header and
trailer creation by deflate(). NO_GZIP would be used to avoid linking
@ -40,12 +40,12 @@
#ifdef GZIP
#define GZIP_STATE 57 /* gzip header -> BUSY_STATE | EXTRA_STATE */
#endif
#define EXTRA_STATE 69 /* gzip extra block -> NAME_STATE */
#define NAME_STATE 73 /* gzip file name -> COMMENT_STATE */
#define COMMENT_STATE 91 /* gzip comment -> HCRC_STATE */
#define HCRC_STATE 103 /* gzip header CRC -> BUSY_STATE */
#define BUSY_STATE 113 /* deflate -> FINISH_STATE */
#define FINISH_STATE 666 /* stream complete */
#define EXTRA_STATE 69 /* gzip extra block -> NAME_STATE */
#define NAME_STATE 73 /* gzip file name -> COMMENT_STATE */
#define COMMENT_STATE 91 /* gzip comment -> HCRC_STATE */
#define HCRC_STATE 103 /* gzip header CRC -> BUSY_STATE */
#define BUSY_STATE 113 /* deflate -> FINISH_STATE */
#define FINISH_STATE 666 /* stream complete */
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_
@ -64,8 +64,8 @@ typedef struct ct_data_s {
#define Freq fc.freq
#define Code fc.code
#define Dad dl.dad
#define Len dl.len
#define Dad dl.dad
#define Len dl.len
typedef struct static_tree_desc_s static_tree_desc;

View file

@ -17,7 +17,7 @@
PERFORMANCE OF THIS SOFTWARE.
*/
#include "third_party/zlib/zlib.h"
#include "libc/macros.h"
#include "libc/macros.internal.h"
deflateInit:
mov $Z_DEFLATED,%edx

View file

@ -7,9 +7,9 @@
*/
#include "libc/bits/emmintrin.internal.h"
#include "libc/str/str.h"
#include "third_party/zlib/deflate.h"
#include "third_party/zlib/deflate.internal.h"
#include "third_party/zlib/internal.h"
#include "third_party/zlib/zutil.h"
#include "third_party/zlib/zutil.internal.h"
asm(".ident\t\"\\n\\n\
zlib » sse2 fill window (zlib License)\\n\

View file

@ -6,11 +6,11 @@
be found in the third_party/zlib/LICENSE file.
*/
#include "libc/str/str.h"
#include "third_party/zlib/inffast.h"
#include "third_party/zlib/inflate.h"
#include "third_party/zlib/inftrees.h"
#include "third_party/zlib/inffast.internal.h"
#include "third_party/zlib/inflate.internal.h"
#include "third_party/zlib/inftrees.internal.h"
#include "third_party/zlib/internal.h"
#include "third_party/zlib/zutil.h"
#include "third_party/zlib/zutil.internal.h"
asm(".ident\t\"\\n\\n\
zlib (zlib License)\\n\

View file

@ -5,10 +5,10 @@
Use of this source code is governed by the BSD-style licenses that can
be found in the third_party/zlib/LICENSE file.
*/
#include "third_party/zlib/inffast.h"
#include "third_party/zlib/inflate.h"
#include "third_party/zlib/inftrees.h"
#include "third_party/zlib/zutil.h"
#include "third_party/zlib/inffast.internal.h"
#include "third_party/zlib/inflate.internal.h"
#include "third_party/zlib/inftrees.internal.h"
#include "third_party/zlib/zutil.internal.h"
asm(".ident\t\"\\n\\n\
zlib (zlib License)\\n\

View file

@ -1,6 +1,6 @@
#ifndef COSMOPOLITAN_THIRD_PARTY_ZLIB_INFFAST_H_
#define COSMOPOLITAN_THIRD_PARTY_ZLIB_INFFAST_H_
#include "third_party/zlib/inffast.h"
#include "third_party/zlib/inffast.internal.h"
#include "third_party/zlib/zlib.h"
/* INFLATE_FAST_MIN_INPUT: the minimum number of input bytes needed so that

View file

@ -6,12 +6,12 @@
be found in the third_party/zlib/LICENSE file.
*/
#include "libc/bits/bits.h"
#include "third_party/zlib/chunkcopy.h"
#include "third_party/zlib/inffast.h"
#include "third_party/zlib/inflate.h"
#include "third_party/zlib/inftrees.h"
#include "third_party/zlib/chunkcopy.internal.h"
#include "third_party/zlib/inffast.internal.h"
#include "third_party/zlib/inflate.internal.h"
#include "third_party/zlib/inftrees.internal.h"
#include "third_party/zlib/zlib.h"
#include "third_party/zlib/zutil.h"
#include "third_party/zlib/zutil.internal.h"
asm(".ident\t\"\\n\\n\
zlib (zlib License)\\n\

View file

@ -1,11 +1,11 @@
#include "third_party/zlib/inftrees.h"
#include "third_party/zlib/inftrees.internal.h"
/**
* @fileoverview tables for decoding fixed codes
* @note generated by makefixed()
*/
const struct zcode kZlibLenfix[512] = {
hidden const struct zcode kZlibLenfix[512] = {
{96, 7, 0}, {0, 8, 80}, {0, 8, 16}, {20, 8, 115}, {18, 7, 31},
{0, 8, 112}, {0, 8, 48}, {0, 9, 192}, {16, 7, 10}, {0, 8, 96},
{0, 8, 32}, {0, 9, 160}, {0, 8, 0}, {0, 8, 128}, {0, 8, 64},
@ -111,7 +111,7 @@ const struct zcode kZlibLenfix[512] = {
{0, 8, 79}, {0, 9, 255},
};
const struct zcode kZlibDistfix[32] = {
hidden const struct zcode kZlibDistfix[32] = {
{16, 5, 1}, {23, 5, 257}, {19, 5, 17}, {27, 5, 4097}, {17, 5, 5},
{25, 5, 1025}, {21, 5, 65}, {29, 5, 16385}, {16, 5, 3}, {24, 5, 513},
{20, 5, 33}, {28, 5, 8193}, {18, 5, 9}, {26, 5, 2049}, {22, 5, 129},

View file

@ -6,12 +6,12 @@
be found in the third_party/zlib/LICENSE file.
*/
#include "libc/str/str.h"
#include "third_party/zlib/chunkcopy.h"
#include "third_party/zlib/inffast.h"
#include "third_party/zlib/inflate.h"
#include "third_party/zlib/inftrees.h"
#include "third_party/zlib/chunkcopy.internal.h"
#include "third_party/zlib/inffast.internal.h"
#include "third_party/zlib/inflate.internal.h"
#include "third_party/zlib/inftrees.internal.h"
#include "third_party/zlib/internal.h"
#include "third_party/zlib/zutil.h"
#include "third_party/zlib/zutil.internal.h"
asm(".ident\t\"\\n\\n\
zlib (zlib License)\\n\

View file

@ -1,6 +1,6 @@
#ifndef COSMOPOLITAN_THIRD_PARTY_ZLIB_INFLATE_H_
#define COSMOPOLITAN_THIRD_PARTY_ZLIB_INFLATE_H_
#include "third_party/zlib/inftrees.h"
#include "third_party/zlib/inftrees.internal.h"
#include "third_party/zlib/zlib.h"
#if !(__ASSEMBLER__ + __LINKER__ + 0)
COSMOPOLITAN_C_START_

View file

@ -16,8 +16,8 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "third_party/zlib/zutil.h"
#include "libc/macros.h"
#include "third_party/zlib/zutil.internal.h"
#include "libc/macros.internal.h"
inflateInit:
mov $DEF_WBITS,%esi

View file

@ -5,8 +5,8 @@
Use of this source code is governed by the BSD-style licenses that can
be found in the third_party/zlib/LICENSE file.
*/
#include "third_party/zlib/inftrees.h"
#include "third_party/zlib/zutil.h"
#include "third_party/zlib/inftrees.internal.h"
#include "third_party/zlib/zutil.internal.h"
asm(".ident\t\"\\n\\n\
inflate 1.2.11 (zlib License)\\n\

View file

@ -1,6 +1,6 @@
#ifndef COSMOPOLITAN_THIRD_PARTY_ZLIB_INTERNAL_H_
#define COSMOPOLITAN_THIRD_PARTY_ZLIB_INTERNAL_H_
#include "third_party/zlib/deflate.h"
#include "third_party/zlib/deflate.internal.h"
#define Z_CRC32_SSE42_MINIMUM_LENGTH 64
#define Z_CRC32_SSE42_CHUNKSIZE_MASK 15

View file

@ -16,8 +16,8 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "third_party/zlib/deflate.h"
#include "libc/macros.h"
#include "third_party/zlib/deflate.internal.h"
#include "libc/macros.internal.h"
.initbss 300,_init_kZlibDistCode
kZlibDistCode:

View file

@ -16,8 +16,8 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "third_party/zlib/zutil.h"
#include "libc/macros.h"
#include "third_party/zlib/zutil.internal.h"
#include "libc/macros.internal.h"
.initbss 300,_init_kZlibLengthCode
kZlibLengthCode:

View file

@ -1,6 +1,6 @@
#include "third_party/zlib/internal.h"
const ct_data kZlibStaticDtree[D_CODES] = {
hidden const ct_data kZlibStaticDtree[D_CODES] = {
{{0}, {5}}, {{16}, {5}}, {{8}, {5}}, {{24}, {5}}, {{4}, {5}},
{{20}, {5}}, {{12}, {5}}, {{28}, {5}}, {{2}, {5}}, {{18}, {5}},
{{10}, {5}}, {{26}, {5}}, {{6}, {5}}, {{22}, {5}}, {{14}, {5}},

View file

@ -1,6 +1,6 @@
#include "third_party/zlib/internal.h"
const ct_data kZlibStaticLtree[L_CODES + 2] = {
hidden const ct_data kZlibStaticLtree[L_CODES + 2] = {
{{12}, {8}}, {{140}, {8}}, {{76}, {8}}, {{204}, {8}}, {{44}, {8}},
{{172}, {8}}, {{108}, {8}}, {{236}, {8}}, {{28}, {8}}, {{156}, {8}},
{{92}, {8}}, {{220}, {8}}, {{60}, {8}}, {{188}, {8}}, {{124}, {8}},

View file

@ -1,12 +1,12 @@
/* header created automatically with -DGEN_TREES_H */
#include "third_party/zlib/internal.h"
const int kZlibBaseLength[LENGTH_CODES] = {
hidden const int kZlibBaseLength[LENGTH_CODES] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 20, 24,
28, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 0,
};
const int kZlibBaseDist[D_CODES] = {
hidden const int kZlibBaseDist[D_CODES] = {
0, 1, 2, 3, 4, 6, 8, 12, 16, 24,
32, 48, 64, 96, 128, 192, 256, 384, 512, 768,
1024, 1536, 2048, 3072, 4096, 6144, 8192, 12288, 16384, 24576,

View file

@ -7,7 +7,7 @@
*/
#include "libc/stdio/stdio.h"
#include "libc/str/str.h"
#include "third_party/zlib/deflate.h"
#include "third_party/zlib/deflate.internal.h"
#include "third_party/zlib/internal.h"
asm(".ident\t\"\\n\\n\
@ -822,7 +822,9 @@ void _tr_stored_block(struct DeflateState *s, charf *buf, uint64_t stored_len,
/**
* Flushes bits in bit buffer to pending output (leaves at most 7 bits)
*/
void _tr_flush_bits(struct DeflateState *s) { bi_flush(s); }
void _tr_flush_bits(struct DeflateState *s) {
bi_flush(s);
}
/**
* Sends one empty static block to give enough lookahead for inflate.

View file

@ -18,7 +18,7 @@
*/
#include "libc/bits/weaken.h"
#include "libc/mem/mem.h"
#include "third_party/zlib/zutil.h"
#include "third_party/zlib/zutil.internal.h"
void *zcalloc(void *opaque, unsigned items, unsigned size) {
return weaken(malloc)(items * size);

View file

@ -6,7 +6,7 @@
be found in the third_party/zlib/LICENSE file.
*/
#include "libc/mem/mem.h"
#include "third_party/zlib/zutil.h"
#include "third_party/zlib/zutil.internal.h"
asm(".ident\t\"\\n\\n\
zlib (zlib License)\\n\
@ -26,7 +26,9 @@ const char *const z_errmsg[10] = {
(const char *)"",
};
const char *zlibVersion() { return ZLIB_VERSION; }
const char *zlibVersion() {
return ZLIB_VERSION;
}
uLong zlibCompileFlags() {
uLong flags;
@ -125,4 +127,6 @@ void z_error(char *m) {
* Exported to allow conversion of error code to string for compress()
* and uncompress()
*/
const char *zError(int err) { return ERR_MSG(err); }
const char *zError(int err) {
return ERR_MSG(err);
}

View file

@ -12,7 +12,7 @@
/* The three kinds of block type */
#define STORED_BLOCK 0
#define STATIC_TREES 1
#define DYN_TREES 2
#define DYN_TREES 2
/* The minimum and maximum match lengths */
#define MIN_MATCH 3
@ -32,7 +32,7 @@ COSMOPOLITAN_C_START_
define "local" for the non-static meaning of "static", for readability
(compile with -Dlocal if your debugger can't find static symbols) */
extern const char *const z_errmsg[10]; /* indexed by 2-zlib_error */
extern const char *const z_errmsg[10] hidden; /* indexed by 2-zlib_error */
/* (size given to avoid silly warnings with Visual C++) */
#define ERR_MSG(err) z_errmsg[Z_NEED_DICT - (err)]