Remove trailing whitespaces from source files

This commit is contained in:
OpenCode 2026-03-20 16:30:57 +07:00 committed by Benjamin Oldenburg
parent 6c5aac0da6
commit a27bd8a7c3
57 changed files with 450 additions and 450 deletions

View File

@ -308,11 +308,11 @@ libtcc.so: override LDFLAGS += -fPIC
# OSX dynamic libtcc library
libtcc.dylib: $(LIBTCC_OBJ)
$S$(CC) -dynamiclib $(DYLIBVER) -install_name @rpath/$@ -o $@ $^ $(LDFLAGS)
$S$(CC) -dynamiclib $(DYLIBVER) -install_name @rpath/$@ -o $@ $^ $(LDFLAGS)
# OSX libtcc.dylib (without rpath/ prefix)
libtcc.osx: $(LIBTCC_OBJ)
$S$(CC) -shared -install_name libtcc.dylib -o libtcc.dylib $^ $(LDFLAGS)
$S$(CC) -shared -install_name libtcc.dylib -o libtcc.dylib $^ $(LDFLAGS)
# windows dynamic libtcc library
libtcc.dll : $(LIBTCC_OBJ)

View File

@ -1,6 +1,6 @@
/*
* TMS320C67xx code generator for TCC
*
*
* Copyright (c) 2001, 2002 Fabrice Bellard
*
* This library is free software; you can redistribute it and/or
@ -152,7 +152,7 @@ ST_DATA const int reg_classes[NB_REGS] = {
// although tcc thinks it is passing parameters on the stack,
// the C67 really passes up to the first 10 params in special
// regs or regs pairs (for 64 bit params). So keep track of
// the stack offsets so we can translate to the appropriate
// the stack offsets so we can translate to the appropriate
// reg (pair)
#define NoCallArgsPassedOnStack 10
@ -233,7 +233,7 @@ void gsym_addr(int t, int a)
}
}
// these are regs that tcc doesn't really know about,
// these are regs that tcc doesn't really know about,
// but assign them unique values so the mapping routines
// can distinguish them
@ -285,7 +285,7 @@ int C67_map_regn(int r)
return 0;
}
// mapping from tcc reg number to
// mapping from tcc reg number to
// C67 register to condition code field
//
// valid condition code regs are:
@ -330,15 +330,15 @@ int C67_map_regs(int r)
else if (r >= TREG_C67_A4 && r <= TREG_C67_B13) // these form a pattern of alt pairs
return (r & 2) >> 1;
else if (r == C67_A0)
return 0; // set to A side
return 0; // set to A side
else if (r == C67_B2)
return 1; // set to B side
return 1; // set to B side
else if (r == C67_B3)
return 1; // set to B side
else if (r == C67_SP)
return 0x1; // set to SP (B15) B side
return 0x1; // set to SP (B15) B side
else if (r == C67_FP)
return 0x0; // set to FP (A15) A side
return 0x0; // set to FP (A15) A side
else
ALWAYS_ASSERT(FALSE);
@ -407,7 +407,7 @@ void C67_asm(const char *s, int a, int b, int c)
(5 << 9) | //mode 5 = pos offset, base reg + off reg
(0 << 8) | //r (LDDW bit 0)
(0 << 7) | //y D1/D2 A side
(3 << 4) | //ldst 3=STB, 5=STH 5, 7=STW, 6=LDW 4=LDH 2=LDB 0=LDHU 1=LDBU
(3 << 4) | //ldst 3=STB, 5=STH 5, 7=STW, 6=LDW 4=LDH 2=LDB 0=LDHU 1=LDBU
(1 << 2) | //opcode
(C67_map_regs(a) << 1) | //side of src
(0 << 0)); //parallel
@ -429,7 +429,7 @@ void C67_asm(const char *s, int a, int b, int c)
(5 << 9) | //mode 5 = pos offset, base reg + off reg
(0 << 8) | //r (LDDW bit 0)
(0 << 7) | //y D1/D2 A side
(3 << 4) | //ldst 3=STB, 5=STH 5, 7=STW, 6=LDW 4=LDH 2=LDB 0=LDHU 1=LDBU
(3 << 4) | //ldst 3=STB, 5=STH 5, 7=STW, 6=LDW 4=LDH 2=LDB 0=LDHU 1=LDBU
(1 << 2) | //opcode
(C67_map_regs(a) << 1) | //side of src
(0 << 0)); //parallel
@ -451,7 +451,7 @@ void C67_asm(const char *s, int a, int b, int c)
(5 << 9) | //mode 5 = pos offset, base reg + off reg
(0 << 8) | //r (LDDW bit 0)
(0 << 7) | //y D1/D2 A side
(7 << 4) | //ldst 3=STB, 5=STH 5, 7=STW, 6=LDW 4=LDH 2=LDB 0=LDHU 1=LDBU
(7 << 4) | //ldst 3=STB, 5=STH 5, 7=STW, 6=LDW 4=LDH 2=LDB 0=LDHU 1=LDBU
(1 << 2) | //opcode
(C67_map_regs(a) << 1) | //side of src
(0 << 0)); //parallel
@ -462,7 +462,7 @@ void C67_asm(const char *s, int a, int b, int c)
(1 << 9) | //mode 1 = pos cst offset
(0 << 8) | //r (LDDW bit 0)
(C67_map_regs(b) << 7) | //y D1/D2 base reg side
(7 << 4) | //ldst 3=STB, 5=STH 5, 7=STW, 6=LDW 4=LDH 2=LDB 0=LDHU 1=LDBU
(7 << 4) | //ldst 3=STB, 5=STH 5, 7=STW, 6=LDW 4=LDH 2=LDB 0=LDHU 1=LDBU
(1 << 2) | //opcode
(C67_map_regs(a) << 1) | //side of src
(0 << 0)); //parallel
@ -473,7 +473,7 @@ void C67_asm(const char *s, int a, int b, int c)
(1 << 9) | //mode 1 = pos cst offset
(0 << 8) | //r (LDDW bit 0)
(C67_map_regs(b) << 7) | //y D1/D2 base reg side
(5 << 4) | //ldst 3=STB, 5=STH 5, 7=STW, 6=LDW 4=LDH 2=LDB 0=LDHU 1=LDBU
(5 << 4) | //ldst 3=STB, 5=STH 5, 7=STW, 6=LDW 4=LDH 2=LDB 0=LDHU 1=LDBU
(1 << 2) | //opcode
(C67_map_regs(a) << 1) | //side of src
(0 << 0)); //parallel
@ -484,7 +484,7 @@ void C67_asm(const char *s, int a, int b, int c)
(1 << 9) | //mode 1 = pos cst offset
(0 << 8) | //r (LDDW bit 0)
(C67_map_regs(b) << 7) | //y D1/D2 base reg side
(3 << 4) | //ldst 3=STB, 5=STH 5, 7=STW, 6=LDW 4=LDH 2=LDB 0=LDHU 1=LDBU
(3 << 4) | //ldst 3=STB, 5=STH 5, 7=STW, 6=LDW 4=LDH 2=LDB 0=LDHU 1=LDBU
(1 << 2) | //opcode
(C67_map_regs(a) << 1) | //side of src
(0 << 0)); //parallel
@ -496,7 +496,7 @@ void C67_asm(const char *s, int a, int b, int c)
(1 << 9) | //mode 1 = pos cst offset
(0 << 8) | //r (LDDW bit 0)
(C67_map_regs(b) << 7) | //y D1/D2 base reg side
(7 << 4) | //ldst 3=STB, 5=STH 5, 7=STW, 6=LDW 4=LDH 2=LDB 0=LDHU 1=LDBU
(7 << 4) | //ldst 3=STB, 5=STH 5, 7=STW, 6=LDW 4=LDH 2=LDB 0=LDHU 1=LDBU
(1 << 2) | //opcode
(C67_map_regs(a) << 1) | //side of src
(0 << 0)); //parallel
@ -628,7 +628,7 @@ void C67_asm(const char *s, int a, int b, int c)
(1 << 9) | //mode 1 = pos cst offset
(0 << 8) | //r (LDDW bit 0)
(C67_map_regs(a) << 7) | //y D1/D2 src side
(2 << 4) | //ldst 3=STB, 5=STH 5, 7=STW, 6=LDW 4=LDH 2=LDB 0=LDHU 1=LDBU
(2 << 4) | //ldst 3=STB, 5=STH 5, 7=STW, 6=LDW 4=LDH 2=LDB 0=LDHU 1=LDBU
(1 << 2) | //opcode
(C67_map_regs(b) << 1) | //side of dst
(0 << 0)); //parallel
@ -639,7 +639,7 @@ void C67_asm(const char *s, int a, int b, int c)
(1 << 9) | //mode 1 = pos cst offset
(0 << 8) | //r (LDDW bit 0)
(C67_map_regs(a) << 7) | //y D1/D2 src side
(0 << 4) | //ldst 3=STB, 5=STH 5, 7=STW, 6=LDW 4=LDH 2=LDB 0=LDHU 1=LDBU
(0 << 4) | //ldst 3=STB, 5=STH 5, 7=STW, 6=LDW 4=LDH 2=LDB 0=LDHU 1=LDBU
(1 << 2) | //opcode
(C67_map_regs(b) << 1) | //side of dst
(0 << 0)); //parallel
@ -661,7 +661,7 @@ void C67_asm(const char *s, int a, int b, int c)
(1 << 9) | //mode 1 = pos cst offset
(0 << 8) | //r (LDDW bit 0)
(C67_map_regs(a) << 7) | //y D1/D2 src side
(6 << 4) | //ldst 3=STB, 5=STH 5, 7=STW, 6=LDW 4=LDH 2=LDB 0=LDHU 1=LDBU
(6 << 4) | //ldst 3=STB, 5=STH 5, 7=STW, 6=LDW 4=LDH 2=LDB 0=LDHU 1=LDBU
(1 << 2) | //opcode
(C67_map_regs(b) << 1) | //side of dst
(0 << 0)); //parallel
@ -864,7 +864,7 @@ void C67_asm(const char *s, int a, int b, int c)
C67_g((0 << 29) | //creg
(0 << 28) | //inv
(C67_map_regn(c) << 23) | //dst
(C67_map_regn(b) << 18) | //src2
(C67_map_regn(b) << 18) | //src2
(0 << 13) | //src1 NA
(xpath << 12) | //x cross path if opposite sides
(0x4a << 5) | //opcode
@ -877,7 +877,7 @@ void C67_asm(const char *s, int a, int b, int c)
C67_g((0 << 29) | //creg
(0 << 28) | //inv
(C67_map_regn(c) << 23) | //dst
(C67_map_regn(b) << 18) | //src2
(C67_map_regn(b) << 18) | //src2
(0 << 13) | //src1 NA
(xpath << 12) | //x cross path if opposite sides
(0x49 << 5) | //opcode
@ -890,7 +890,7 @@ void C67_asm(const char *s, int a, int b, int c)
C67_g((0 << 29) | //creg
(0 << 28) | //inv
(C67_map_regn(c) << 23) | //dst
(C67_map_regn(b) << 18) | //src2
(C67_map_regn(b) << 18) | //src2
(0 << 13) | //src1 NA
(xpath << 12) | //x cross path if opposite sides
(0x39 << 5) | //opcode
@ -945,7 +945,7 @@ void C67_asm(const char *s, int a, int b, int c)
(0 << 28) | //inv
(C67_map_regn(c) << 23) | //dst
(C67_map_regn(b) << 18) | //src2 (possible x path)
(C67_map_regn(a) << 13) | //src1
(C67_map_regn(a) << 13) | //src1
(xpath << 12) | //x cross path if opposite sides
(0x3 << 5) | //opcode
(0x6 << 2) | //opcode fixed
@ -960,7 +960,7 @@ void C67_asm(const char *s, int a, int b, int c)
(0 << 28) | //inv
(C67_map_regn(c) << 23) | //dst
(C67_map_regn(b) << 18) | //src2 (possible x path)
(C67_map_regn(a) << 13) | //src1
(C67_map_regn(a) << 13) | //src1
(xpath << 12) | //x cross path if opposite sides
(0x7 << 5) | //opcode
(0x6 << 2) | //opcode fixed
@ -975,7 +975,7 @@ void C67_asm(const char *s, int a, int b, int c)
(0 << 28) | //inv
(C67_map_regn(c) << 23) | //dst
(C67_map_regn(b) << 18) | //src2 (possible x path)
(C67_map_regn(a) << 13) | //src1
(C67_map_regn(a) << 13) | //src1
(xpath << 12) | //x cross path if opposite sides
(0x7f << 5) | //opcode
(0x6 << 2) | //opcode fixed
@ -990,7 +990,7 @@ void C67_asm(const char *s, int a, int b, int c)
(0 << 28) | //inv
(C67_map_regn(c) << 23) | //dst
(C67_map_regn(b) << 18) | //src2 (possible x path)
(C67_map_regn(a) << 13) | //src1
(C67_map_regn(a) << 13) | //src1
(xpath << 12) | //x cross path if opposite sides
(0x7b << 5) | //opcode
(0x6 << 2) | //opcode fixed
@ -1005,7 +1005,7 @@ void C67_asm(const char *s, int a, int b, int c)
(0 << 28) | //inv
(C67_map_regn(c) << 23) | //dst
(C67_map_regn(b) << 18) | //src2 (possible x path)
(C67_map_regn(a) << 13) | //src1
(C67_map_regn(a) << 13) | //src1
(xpath << 12) | //x cross path if opposite sides
(0x6f << 5) | //opcode
(0x6 << 2) | //opcode fixed
@ -1020,7 +1020,7 @@ void C67_asm(const char *s, int a, int b, int c)
(0 << 28) | //inv
(C67_map_regn(c) << 23) | //dst
(C67_map_regn(b) << 18) | //src2 (possible x path)
(C67_map_regn(a) << 13) | //src1
(C67_map_regn(a) << 13) | //src1
(xpath << 12) | //x cross path if opposite sides
(0x10 << 5) | //opcode
(0x6 << 2) | //opcode fixed
@ -1035,7 +1035,7 @@ void C67_asm(const char *s, int a, int b, int c)
(0 << 28) | //inv
(C67_map_regn(c) << 23) | //dst
(C67_map_regn(b) << 18) | //src2 (possible x path)
(C67_map_regn(a) << 13) | //src1
(C67_map_regn(a) << 13) | //src1
(xpath << 12) | //x cross path if opposite sides
(0x18 << 5) | //opcode
(0x6 << 2) | //opcode fixed
@ -1050,7 +1050,7 @@ void C67_asm(const char *s, int a, int b, int c)
(0 << 28) | //inv
(C67_map_regn(c) << 23) | //dst
(C67_map_regn(b) << 18) | //src2 (possible x path)
(C67_map_regn(a) << 13) | //src1
(C67_map_regn(a) << 13) | //src1
(xpath << 12) | //x cross path if opposite sides
(0x11 << 5) | //opcode
(0x6 << 2) | //opcode fixed
@ -1065,7 +1065,7 @@ void C67_asm(const char *s, int a, int b, int c)
(0 << 28) | //inv
(C67_map_regn(c) << 23) | //dst
(C67_map_regn(b) << 18) | //src2 (possible x path)
(C67_map_regn(a) << 13) | //src1
(C67_map_regn(a) << 13) | //src1
(xpath << 12) | //x cross path if opposite sides
(0x19 << 5) | //opcode
(0x6 << 2) | //opcode fixed
@ -1080,7 +1080,7 @@ void C67_asm(const char *s, int a, int b, int c)
(0 << 28) | //inv
(C67_map_regn(c) << 23) | //dst
(C67_map_regn(b) << 18) | //src2 (possible x path)
(C67_map_regn(a) << 13) | //src1
(C67_map_regn(a) << 13) | //src1
(xpath << 12) | //x cross path if opposite sides
(0x1c << 7) | //opcode
(0x0 << 2) | //opcode fixed
@ -1095,7 +1095,7 @@ void C67_asm(const char *s, int a, int b, int c)
(0 << 28) | //inv
(C67_map_regn(c) << 23) | //dst
(C67_map_regn(b) << 18) | //src2 (possible x path)
(C67_map_regn(a) << 13) | //src1
(C67_map_regn(a) << 13) | //src1
(xpath << 12) | //x cross path if opposite sides
(0x0e << 7) | //opcode
(0x0 << 2) | //opcode fixed
@ -1125,7 +1125,7 @@ void C67_asm(const char *s, int a, int b, int c)
(0 << 28) | //inv
(C67_map_regn(c) << 23) | //dst
(C67_map_regn(b) << 18) | //src2
(C67_map_regn(a) << 13) | //src1
(C67_map_regn(a) << 13) | //src1
(xpath << 12) | //x cross path if opposite sides
(0x37 << 6) | //opcode
(0x8 << 2) | //opcode fixed
@ -1140,7 +1140,7 @@ void C67_asm(const char *s, int a, int b, int c)
(0 << 28) | //inv
(C67_map_regn(c) << 23) | //dst
(C67_map_regn(b) << 18) | //src2
(C67_map_regn(a) << 13) | //src1
(C67_map_regn(a) << 13) | //src1
(xpath << 12) | //x cross path if opposite sides
(0x27 << 6) | //opcode
(0x8 << 2) | //opcode fixed
@ -1155,7 +1155,7 @@ void C67_asm(const char *s, int a, int b, int c)
(0 << 28) | //inv
(C67_map_regn(c) << 23) | //dst
(C67_map_regn(b) << 18) | //src2
(C67_map_regn(a) << 13) | //src1
(C67_map_regn(a) << 13) | //src1
(xpath << 12) | //x cross path if opposite sides
(0x33 << 6) | //opcode
(0x8 << 2) | //opcode fixed
@ -1584,7 +1584,7 @@ void load(int r, SValue * sv)
size = 4;
}
// check if fc is a positive reference on the stack,
// check if fc is a positive reference on the stack,
// if it is tcc is referencing what it thinks is a parameter
// on the stack, so check if it is really in a register.
@ -1942,7 +1942,7 @@ void gfunc_call(int nb_args)
// ending with B12:B13.
//
// When a call is made, if the caller has its parameters
// in regs A4-B13 these must be saved before/as the call
// in regs A4-B13 these must be saved before/as the call
// parameters are loaded and restored upon return (or if/when needed).
/* generate function prolog of type 't' */
@ -2012,7 +2012,7 @@ void gfunc_prolog(Sym *func_sym)
TotalBytesPushedOnStack = -loc;
func_sub_sp_offset = ind; // remember where we put the stack instruction
func_sub_sp_offset = ind; // remember where we put the stack instruction
C67_ADDK(0, C67_SP); // ADDK.L2 loc,SP (just put zero temporarily)
C67_PUSH(C67_A0);
@ -2028,11 +2028,11 @@ void gfunc_epilog(void)
C67_NOP(4); // NOP wait for load
C67_IREG_B_REG(0, C67_CREG_ZERO, C67_B3); // B.S2 B3
C67_POP(C67_FP);
C67_ADDK(local, C67_SP); // ADDK.L2 loc,SP
C67_ADDK(local, C67_SP); // ADDK.L2 loc,SP
C67_Adjust_ADDK((int *) (cur_text_section->data +
func_sub_sp_offset),
-local + TotalBytesPushedOnStack);
C67_NOP(3); // NOP
C67_NOP(3); // NOP
}
}

30
coff.h
View File

@ -31,9 +31,9 @@ struct filehdr {
#define F_LITTLE 0x100 /* byte ordering of an AR32WR (vax) */
#define F_BIG 0x200 /* byte ordering of an AR32W (3B, maxi) */
#define F_PATCH 0x400 /* contains "patch" list in optional header */
#define F_NODF 0x400
#define F_NODF 0x400
#define F_VERSION (F_GSP10 | F_GSP20)
#define F_VERSION (F_GSP10 | F_GSP20)
#define F_BYTE_ORDER (F_LITTLE | F_BIG)
#define FILHDR struct filehdr
@ -49,7 +49,7 @@ struct filehdr {
#define ISARCHIVE(x) ((((unsigned short)(x))==(unsigned short)ARTYPE))
#define BADMAGIC(x) (((unsigned short)(x) & 0x8080) && !ISMAGIC(x))
/*------------------------------------------------------------------------*/
/* OPTIONAL FILE HEADER */
/*------------------------------------------------------------------------*/
@ -68,7 +68,7 @@ typedef struct aouthdr {
/*----------------------------------------------------------------------*/
/* When a UNIX aout header is to be built in the optional header, */
/* the following magic numbers can appear in that header: */
/* the following magic numbers can appear in that header: */
/* */
/* AOUT1MAGIC : default : readonly sharable text segment */
/* AOUT2MAGIC: : writable text segment */
@ -78,7 +78,7 @@ typedef struct aouthdr {
#define AOUT2MAGIC 0407
#define PAGEMAGIC 0413
/*------------------------------------------------------------------------*/
/* COMMON ARCHIVE FILE STRUCTURES */
/* */
@ -125,7 +125,7 @@ struct ar_hdr /* archive file member header - printable ascii */
char ar_fmag[2]; /* ARFMAG - string to end header */
};
/*------------------------------------------------------------------------*/
/* SECTION HEADER */
/*------------------------------------------------------------------------*/
@ -164,7 +164,7 @@ struct scnhdr {
#define STYP_NOLOAD 0x02 /* "noload" : allocated, relocated, not loaded */
#define STYP_GROUP 0x04 /* "grouped" : formed of input sections */
#define STYP_PAD 0x08 /* "padding" : not allocated, not relocated, loaded */
#define STYP_COPY 0x10 /* "copy" : used for C init tables -
#define STYP_COPY 0x10 /* "copy" : used for C init tables -
not allocated, relocated,
loaded; reloc & lineno
entries processed normally */
@ -176,7 +176,7 @@ struct scnhdr {
#define ALIGN_MASK 0x0F00 /* part of s_flags that is used for align vals */
#define ALIGNSIZE(x) (1 << ((x & ALIGN_MASK) >> 8))
/*------------------------------------------------------------------------*/
/* RELOCATION ENTRIES */
/*------------------------------------------------------------------------*/
@ -216,7 +216,7 @@ struct reloc
#define R_PARTMS9 051 /* DSP: 9 bit page of 16 bit address */
#define R_REL13 052 /* DSP: 13 bits, direct */
/*------------------------------------------------------------------------*/
/* LINE NUMBER ENTRIES */
/*------------------------------------------------------------------------*/
@ -234,7 +234,7 @@ struct lineno
#define LINENO struct lineno
#define LINESZ 6 /* sizeof(LINENO) */
/*------------------------------------------------------------------------*/
/* STORAGE CLASSES */
/*------------------------------------------------------------------------*/
@ -267,7 +267,7 @@ struct lineno
#define C_ALIAS 105 /* duplicate tag */
#define C_HIDDEN 106 /* special storage class for external */
/* symbols in dmert public libraries */
/*------------------------------------------------------------------------*/
/* SYMBOL TABLE ENTRIES */
/*------------------------------------------------------------------------*/
@ -312,7 +312,7 @@ struct syment
#define N_TV (unsigned short)-3 /* needs transfer vector (preload) */
#define P_TV (unsigned short)-4 /* needs transfer vector (postload) */
/*------------------------------------------------------------------------*/
/* The fundamental type of a symbol packed into the low */
/* 4 bits of the word. */
@ -358,11 +358,11 @@ struct syment
#define N_BTSHFT_COFF 4
#define N_TSHIFT_COFF 2
#define BTYPE_COFF(x) ((x) & N_BTMASK_COFF)
#define BTYPE_COFF(x) ((x) & N_BTMASK_COFF)
#define ISINT(x) (((x) >= T_CHAR && (x) <= T_LONG) || \
((x) >= T_UCHAR && (x) <= T_ULONG) || (x) == T_ENUM)
#define ISFLT_COFF(x) ((x) == T_DOUBLE || (x) == T_FLOAT)
#define ISPTR_COFF(x) (((x) & N_TMASK_COFF) == (DT_PTR << N_BTSHFT_COFF))
#define ISPTR_COFF(x) (((x) & N_TMASK_COFF) == (DT_PTR << N_BTSHFT_COFF))
#define ISFCN_COFF(x) (((x) & N_TMASK_COFF) == (DT_FCN << N_BTSHFT_COFF))
#define ISARY_COFF(x) (((x) & N_TMASK_COFF) == (DT_ARY << N_BTSHFT_COFF))
#define ISTAG_COFF(x) ((x)==C_STRTAG || (x)==C_UNTAG || (x)==C_ENTAG)
@ -370,7 +370,7 @@ struct syment
#define INCREF_COFF(x) ((((x)&~N_BTMASK_COFF)<<N_TSHIFT_COFF)|(DT_PTR<<N_BTSHFT_COFF)|(x&N_BTMASK_COFF))
#define DECREF_COFF(x) ((((x)>>N_TSHIFT_COFF)&~N_BTMASK_COFF)|((x)&N_BTMASK_COFF))
/*------------------------------------------------------------------------*/
/* AUXILIARY SYMBOL ENTRY */
/*------------------------------------------------------------------------*/

View File

@ -60,7 +60,7 @@ ALT(DEF_ASM_OP0L(stosb, 0xaa, 0, OPC_BWLX))
ALT(DEF_ASM_OP0L(sstob, 0xaa, 0, OPC_BWLX))
/* bits */
ALT(DEF_ASM_OP2(bsfw, 0x0fbc, 0, OPC_MODRM | OPC_WLX, OPT_REGW | OPT_EA, OPT_REGW))
ALT(DEF_ASM_OP2(bsrw, 0x0fbd, 0, OPC_MODRM | OPC_WLX, OPT_REGW | OPT_EA, OPT_REGW))
@ -94,7 +94,7 @@ ALT(DEF_ASM_OP2(lzcntw, 0xf30fbd, 0, OPC_MODRM | OPC_WLX, OPT_REGW | OPT_EA, OPT
DEF_ASM_OP0(repz, 0xf3)
DEF_ASM_OP0(repne, 0xf2)
DEF_ASM_OP0(repnz, 0xf2)
DEF_ASM_OP0(invd, 0x0f08)
DEF_ASM_OP0(wbinvd, 0x0f09)
DEF_ASM_OP0(cpuid, 0x0fa2)
@ -236,7 +236,7 @@ ALT(DEF_ASM_OP1(jo, 0x70, 0, OPC_TEST, OPT_DISP8))
DEF_ASM_OP1(loopz, 0xe1, 0, 0, OPT_DISP8)
DEF_ASM_OP1(loop, 0xe2, 0, 0, OPT_DISP8)
DEF_ASM_OP1(jecxz, 0xe3, 0, 0, OPT_DISP8)
/* float */
/* specific fcomp handling */
ALT(DEF_ASM_OP0L(fcomp, 0xd8d9, 0, 0))
@ -298,7 +298,7 @@ ALT(DEF_ASM_OP1(fldl, 0xdd, 0, OPC_MODRM, OPT_EA))
DEF_ASM_OP1(fildll, 0xdf, 5, OPC_MODRM,OPT_EA)
DEF_ASM_OP1(fldt, 0xdb, 5, OPC_MODRM, OPT_EA)
DEF_ASM_OP1(fbld, 0xdf, 4, OPC_MODRM, OPT_EA)
/* fp store */
DEF_ASM_OP1(fst, 0xddd0, 0, OPC_REG, OPT_ST)
DEF_ASM_OP1(fstl, 0xddd0, 0, OPC_REG, OPT_ST)
@ -375,7 +375,7 @@ ALT(DEF_ASM_OP2(cmpxchgb, 0x0fb0, 0, OPC_MODRM | OPC_BWLX, OPT_REG, OPT_REG | OP
/* pentium */
DEF_ASM_OP1(cmpxchg8b, 0x0fc7, 1, OPC_MODRM, OPT_EA )
/* pentium pro */
ALT(DEF_ASM_OP2(cmovo, 0x0f40, 0, OPC_MODRM | OPC_TEST | OPC_WLX, OPT_REGW | OPT_EA, OPT_REGW))
DEF_ASM_OP2(fcmovb, 0xdac0, 0, OPC_REG, OPT_ST, OPT_ST0 )

View File

@ -1,6 +1,6 @@
/*
* X86 code generator for TCC
*
*
* Copyright (c) 2001-2004 Fabrice Bellard
*
* This library is free software; you can redistribute it and/or
@ -849,7 +849,7 @@ ST_FUNC void gen_opi(int op)
r = vtop[-1].r;
fr = vtop[0].r;
o((opc << 3) | 0x01);
o(0xc0 + r + fr * 8);
o(0xc0 + r + fr * 8);
}
vtop--;
if (op >= TOK_ULT && op <= TOK_GT)
@ -1024,7 +1024,7 @@ ST_FUNC void gen_opf(int op)
load(TREG_ST0, vtop);
swapped = !swapped;
}
switch(op) {
default:
case '+':
@ -1084,7 +1084,7 @@ ST_FUNC void gen_cvt_itof(int t)
o(0x242cdf); /* fildll (%esp) */
o(0x08c483); /* add $8, %esp */
vtop->r2 = VT_CONST;
} else if ((vtop->type.t & (VT_BTYPE | VT_UNSIGNED)) ==
} else if ((vtop->type.t & (VT_BTYPE | VT_UNSIGNED)) ==
(VT_INT | VT_UNSIGNED)) {
/* unsigned int to float/double/long double */
o(0x6a); /* push $0 */

View File

@ -1,6 +1,6 @@
/*
* CIL code generator for TCC
*
*
* Copyright (c) 2002 Fabrice Bellard
*
* This library is free software; you can redistribute it and/or
@ -114,7 +114,7 @@ static void init_outfile(void)
{
if (!il_outfile) {
il_outfile = stdout;
fprintf(il_outfile,
fprintf(il_outfile,
".assembly extern mscorlib\n"
"{\n"
".ver 1:0:2411:0\n"
@ -151,7 +151,7 @@ static void out_opi(int op, int c)
}
/* XXX: not complete */
static void il_type_to_str(char *buf, int buf_size,
static void il_type_to_str(char *buf, int buf_size,
int t, const char *varstr)
{
int bt;
@ -303,12 +303,12 @@ void load(int r, SValue *sv)
out_op(IL_OP_LDIND_U2);
else
out_op(IL_OP_LDIND_I4);
}
}
} else {
if (v == VT_CONST) {
/* XXX: handle globals */
if (fc >= -1 && fc <= 8) {
out_op(IL_OP_LDC_I4_M1 + fc + 1);
out_op(IL_OP_LDC_I4_M1 + fc + 1);
} else {
out_opi(IL_OP_LDC_I4, fc);
}
@ -432,10 +432,10 @@ void gfunc_prolog(int t)
/* XXX: cannot do better now */
fprintf(il_outfile, " .maxstack %d\n", NB_REGS);
fprintf(il_outfile, " .locals (int32, int32, int32, int32, int32, int32, int32, int32)\n");
if (!strcmp(funcname, "main"))
fprintf(il_outfile, " .entrypoint\n");
sym = sym_find((unsigned)t >> VT_STRUCT_SHIFT);
func_call = sym->r;

View File

@ -1,6 +1,6 @@
/*
* CIL opcode definition
*
*
* Copyright (c) 2002 Fabrice Bellard
*
* This program is free software; you can redistribute it and/or modify

View File

@ -1,6 +1,6 @@
/*
* Tiny C Memory and bounds checker
*
*
* Copyright (c) 2002 Fabrice Bellard
*
* This library is free software; you can redistribute it and/or
@ -51,7 +51,7 @@
#ifdef __attribute__
/* an __attribute__ macro is defined in the system headers */
#undef __attribute__
#undef __attribute__
#endif
#define FASTCALL __attribute__((regparm(3)))
@ -392,11 +392,11 @@ static pthread_key_t no_checking_key;
#elif HAVE_TLS_VAR
static __thread int no_checking = 0;
#define NO_CHECKING_GET() no_checking
#define NO_CHECKING_SET(v) no_checking = v
#define NO_CHECKING_SET(v) no_checking = v
#else
static _Atomic int no_checking = 0;
#define NO_CHECKING_GET() no_checking
#define NO_CHECKING_SET(v) no_checking = v
#define NO_CHECKING_SET(v) no_checking = v
#endif
static char exec[100];
@ -633,7 +633,7 @@ BOUND_PTR_INDIR(16)
}
/* called when entering a function to add all the local regions */
void FASTCALL __bound_local_new(void *p1)
void FASTCALL __bound_local_new(void *p1)
{
size_t addr, fp, *p = p1;
@ -663,7 +663,7 @@ void FASTCALL __bound_local_new(void *p1)
}
/* called when leaving a function to delete all the local regions */
void FASTCALL __bound_local_delete(void *p1)
void FASTCALL __bound_local_delete(void *p1)
{
size_t addr, fp, *p = p1;
@ -1040,7 +1040,7 @@ void __bound_init(size_t *p, int mode)
strcat (exec, ":");
fclose (fp);
}
/* check if dlopen is used (is threre a better way?) */
/* check if dlopen is used (is threre a better way?) */
found = 0;
fp = fopen ("/proc/self/maps", "r");
if (fp) {
@ -1310,7 +1310,7 @@ static void *bound_thread_create(void *bdata)
void *retval;
#if HAVE_TLS_FUNC
int *p = (int *) BOUND_MALLOC(sizeof(int));
if (!p) bound_alloc_error("bound_thread_create malloc");
*p = 0;
pthread_setspecific(no_checking_key, p);
@ -1332,7 +1332,7 @@ int pthread_create(pthread_t *thread, const pthread_attr_t *attr,
bound_thread_create_type *data;
sigset_t mask;
sigset_t old_mask;
use_sem = 1;
dprintf (stderr, "%s, %s()\n", __FILE__, __FUNCTION__);
sigfillset(&mask);
@ -1470,7 +1470,7 @@ void *__bound_malloc(size_t size, const void *caller)
#endif
{
void *ptr;
#if MALLOC_REDIR
/* This will catch the first dlsym call from __bound_init */
if (malloc_redir == NULL) {
@ -1492,7 +1492,7 @@ void *__bound_malloc(size_t size, const void *caller)
ptr = BOUND_MALLOC (size + 1);
dprintf(stderr, "%s, %s(): %p, 0x%lx\n",
__FILE__, __FUNCTION__, ptr, (unsigned long)size);
if (inited && NO_CHECKING_GET() == 0) {
WAIT_SEM ();
INCR_COUNT(bound_malloc_count);
@ -2079,12 +2079,12 @@ static Tree * splay (size_t addr, Tree *t)
{
Tree N, *l, *r, *y;
int comp;
INCR_COUNT_SPLAY(bound_splay);
if (t == NULL) return t;
N.left = N.right = NULL;
l = r = &N;
for (;;) {
comp = compare(addr, t->start, t->size);
if (comp < 0) {
@ -2132,12 +2132,12 @@ static Tree * splay_end (size_t addr, Tree *t)
{
Tree N, *l, *r, *y;
int comp;
INCR_COUNT_SPLAY(bound_splay_end);
if (t == NULL) return t;
N.left = N.right = NULL;
l = r = &N;
for (;;) {
comp = compare_end(addr, t->start + t->size);
if (comp < 0) {

View File

@ -19,7 +19,7 @@
*/
static const unsigned char table_1_32[] = {
0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8,
0, 1, 28, 2, 29, 14, 24, 3, 30, 22, 20, 15, 25, 17, 4, 8,
31, 27, 13, 23, 21, 19, 16, 7, 26, 12, 18, 6, 11, 5, 10, 9
};
static const unsigned char table_2_32[32] = {
@ -66,7 +66,7 @@ static const unsigned char table_2_64[] = {
x = x - ((x >> 1) & 0x55555555); \
x = (x & 0x33333333) + ((x >> 2) & 0x33333333); \
x = (x + (x >> 4)) & 0xf0f0f0f; \
return ((x * 0x01010101) >> 24) & m;
return ((x * 0x01010101) >> 24) & m;
#define POPCOUNTL(x, m) \
x = x - ((x >> 1) & 0x5555555555555555ull); \
x = (x & 0x3333333333333333ull) + ((x >> 2) & 0x3333333333333333ull); \

View File

@ -1,5 +1,5 @@
/* TCC runtime library.
Parts of this code are (c) 2002 Fabrice Bellard
/* TCC runtime library.
Parts of this code are (c) 2002 Fabrice Bellard
Copyright (C) 1987, 1988, 1992, 1994, 1995 Free Software Foundation, Inc.
@ -25,7 +25,7 @@ General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
Boston, MA 02111-1307, USA.
*/
#define W_TYPE_SIZE 32
@ -368,10 +368,10 @@ long long __divdi3(long long u, long long v)
int c = 0;
DWunion uu, vv;
DWtype w;
uu.ll = u;
vv.ll = v;
if (uu.s.high < 0) {
c = ~c;
uu.ll = __negdi2 (uu.ll);
@ -391,17 +391,17 @@ long long __moddi3(long long u, long long v)
int c = 0;
DWunion uu, vv;
DWtype w;
uu.ll = u;
vv.ll = v;
if (uu.s.high < 0) {
c = ~c;
uu.ll = __negdi2 (uu.ll);
}
if (vv.s.high < 0)
vv.ll = __negdi2 (vv.ll);
__udivmoddi4 (uu.ll, vv.ll, (UDWtype *) &w);
if (c)
w = __negdi2 (w);
@ -416,7 +416,7 @@ unsigned long long __udivdi3(unsigned long long u, unsigned long long v)
unsigned long long __umoddi3(unsigned long long u, unsigned long long v)
{
UDWtype w;
__udivmoddi4 (u, v, &w);
return w;
}
@ -483,7 +483,7 @@ long long __ashldi3(long long a, int b)
/* XXX: fix tcc's code generator to do this instead */
float __floatundisf(unsigned long long a)
{
DWunion uu;
DWunion uu;
XFtype r;
uu.ll = a;
@ -498,7 +498,7 @@ float __floatundisf(unsigned long long a)
double __floatundidf(unsigned long long a)
{
DWunion uu;
DWunion uu;
XFtype r;
uu.ll = a;
@ -513,7 +513,7 @@ double __floatundidf(unsigned long long a)
long double __floatundixf(unsigned long long a)
{
DWunion uu;
DWunion uu;
XFtype r;
uu.ll = a;

View File

@ -61,7 +61,7 @@ static FILE *open_tcov_file (char *cov_filename)
fd = open (cov_filename, O_RDWR | O_CREAT, 0666);
if (fd < 0)
return NULL;
#ifndef _WIN32
while (fcntl (fd, F_SETLKW, &lock) && errno == EINTR)
continue;
@ -221,13 +221,13 @@ static void merge_test_coverage (tcov_file *file, FILE *fp,
unsigned int runs;
char *p;
char str[10000];
*pruns = 1;
if (fp == NULL)
return;
if (fgets(str, sizeof(str), fp) &&
(p = strrchr (str, ':')) &&
(sscanf (p + 1, "%u", &runs) == 1))
(sscanf (p + 1, "%u", &runs) == 1))
*pruns = runs + 1;
while (file) {
int i;
@ -339,7 +339,7 @@ void __store_test_coverage (unsigned char * p)
nfile->filename, funcs, 100.0 * (double) blocks_run / blocks);
for (i = 0; i < nfile->n_func; i++) {
func = &nfile->func[i];
while (curline < func->first_line &&
fgets(str, sizeof(str), src))
fprintf (fp, " -:%5u:%s", curline++, str);
@ -399,7 +399,7 @@ void __store_test_coverage (unsigned char * p)
fprintf (fp, " #####:%5u:%s",
curline, str);
else if (has_zero)
fprintf (fp, "%8llu*:%5u:%s",
fprintf (fp, "%8llu*:%5u:%s",
count, curline, str);
else
fprintf (fp, "%9llu:%5u:%s",

View File

@ -99,9 +99,9 @@ the @code{main()} of a.c.
@item @samp{tcc a.c -run b.c arg1}
Compile @file{a.c} and @file{b.c}, link them together and execute them. arg1 is given
as first argument to the @code{main()} of the resulting program.
@ignore
Because multiple C files are specified, @option{--} are necessary to clearly
as first argument to the @code{main()} of the resulting program.
@ignore
Because multiple C files are specified, @option{--} are necessary to clearly
separate the program arguments from the TCC options.
@end ignore
@ -136,14 +136,14 @@ need to add @code{#!/usr/local/bin/tcc -run} at the start of your C source:
#!/usr/local/bin/tcc -run
#include <stdio.h>
int main()
int main()
@{
printf("Hello World\n");
return 0;
@}
@end example
TCC can read C source code from @emph{standard input} when @option{-} is used in
TCC can read C source code from @emph{standard input} when @option{-} is used in
place of @option{infile}. Example:
@example
@ -304,7 +304,7 @@ Abort compilation if a warning is issued. Can be given an option to enable
the specified warning and turn it into an error, for example
@option{-Werror=unsupported}.
@item -Wall
@item -Wall
Activate some useful warnings (@option{-Wimplicit-function-declaration},
@option{-Wdiscard-qualifiers}).
@ -566,7 +566,7 @@ function name.
int tab[10] = @{ 1, 2, [5] = 5, [9] = 9@};
@end example
@item Compound initializers are supported:
@example
int *p = (int [])@{ 1, 2, 3 @};
@ -580,7 +580,7 @@ works for structures and strings.
@end example
@noindent
is the same as writing
is the same as writing
@example
double d = 4771840.0;
@end example
@ -596,12 +596,12 @@ TCC implements some GNU C extensions:
@itemize
@item array designators can be used without '=':
@item array designators can be used without '=':
@example
int a[10] = @{ [0] 1, [5] 2, 3, 4 @};
@end example
@item Structure field designators can be a label:
@item Structure field designators can be a label:
@example
struct @{ int x, y; @} st = @{ x: 1, y: 1@};
@end example
@ -673,7 +673,7 @@ Here are some examples:
align variable @code{a} to 8 bytes and put it in section @code{.mysection}.
@example
int my_add(int a, int b) __attribute__ ((section(".mycodesection")))
int my_add(int a, int b) __attribute__ ((section(".mycodesection")))
@{
return a + b;
@}
@ -690,17 +690,17 @@ generate function @code{my_add} in section @code{.mycodesection}.
dprintf("one arg %d\n", 1);
@end example
@item @code{__FUNCTION__} is interpreted as C99 @code{__func__}
@item @code{__FUNCTION__} is interpreted as C99 @code{__func__}
(so it has not exactly the same semantics as string literal GNUC
where it is a string literal).
@item The @code{__alignof__} keyword can be used as @code{sizeof}
@item The @code{__alignof__} keyword can be used as @code{sizeof}
to get the alignment of a type or an expression.
@item The @code{typeof(x)} returns the type of @code{x}.
@item The @code{typeof(x)} returns the type of @code{x}.
@code{x} is an expression or a type.
@item Computed gotos: @code{&&label} returns a pointer of type
@item Computed gotos: @code{&&label} returns a pointer of type
@code{void *} on the goto label @code{label}. @code{goto *expr} can be
used to jump on the pointer resulting from @code{expr}.
@ -734,7 +734,7 @@ TCC includes its own x86 inline assembler with a @code{gas}-like (GNU
assembler) syntax. No intermediate files are generated. GCC 3.x named
operands are supported.
@item @code{__builtin_types_compatible_p()} and @code{__builtin_constant_p()}
@item @code{__builtin_types_compatible_p()} and @code{__builtin_constant_p()}
are supported.
@item @code{#pragma pack} is supported for win32 compatibility.
@ -797,7 +797,7 @@ same as C.
@item +, -
@end enumerate
@item A value is either an absolute number or a label plus an offset.
@item A value is either an absolute number or a label plus an offset.
All operators accept absolute values except '+' and '-'. '+' or '-' can be
used to add an offset to a label. '-' supports two labels only if they
are the same or if they are both defined and in the same section.
@ -810,7 +810,7 @@ are the same or if they are both defined and in the same section.
@item All labels are considered as local, except undefined ones.
@item Numeric labels can be used as local @code{gas}-like labels.
@item Numeric labels can be used as local @code{gas}-like labels.
They can be defined several times in the same source. Use 'b'
(backward) or 'f' (forward) as suffix to reference them:
@ -1067,7 +1067,7 @@ For more information about the ideas behind this method, see
@chapter The @code{libtcc} library
The @code{libtcc} library enables you to use TCC as a backend for
dynamic code generation.
dynamic code generation.
Read the @file{libtcc.h} to have an overview of the API. Read
@file{libtcc_test.c} to have a very simple example.
@ -1107,10 +1107,10 @@ except:
@itemize
@item For initialized arrays with unknown size, a first pass
@item For initialized arrays with unknown size, a first pass
is done to count the number of elements.
@item For architectures where arguments are evaluated in
@item For architectures where arguments are evaluated in
reverse order, a first pass is done to reverse the argument order.
@end itemize
@ -1322,7 +1322,7 @@ stack.
@item VT_CMP
indicates that the value is actually stored in the CPU flags (i.e. the
value is the consequence of a test). The value is either 0 or 1. The
actual CPU flags used is indicated in @code{SValue.c.i}.
actual CPU flags used is indicated in @code{SValue.c.i}.
If any code is generated which destroys the CPU flags, this value MUST be
put in a normal register.
@ -1342,7 +1342,7 @@ taken.
@item VT_LVAL
is a flag indicating that the value is actually an lvalue (left value of
an assignment). It means that the value stored is actually a pointer to
the wanted value.
the wanted value.
Understanding the use @code{VT_LVAL} is very important if you want to
understand how TCC works.

2
tcc.c
View File

@ -1,6 +1,6 @@
/*
* TCC - Tiny C Compiler
*
*
* Copyright (c) 2001-2004 Fabrice Bellard
*
* This library is free software; you can redistribute it and/or

View File

@ -1,6 +1,6 @@
/*
* GAS like assembler for TCC
*
*
* Copyright (c) 2001-2004 Fabrice Bellard
*
* This library is free software; you can redistribute it and/or
@ -220,7 +220,7 @@ static void asm_expr_unary(TCCState *s1, ExprValue *pe)
break;
}
}
static void asm_expr_prod(TCCState *s1, ExprValue *pe)
{
int op;
@ -229,7 +229,7 @@ static void asm_expr_prod(TCCState *s1, ExprValue *pe)
asm_expr_unary(s1, pe);
for(;;) {
op = tok;
if (op != '*' && op != '/' && op != '%' &&
if (op != '*' && op != '/' && op != '%' &&
op != TOK_SHL && op != TOK_SAR)
break;
next();
@ -240,14 +240,14 @@ static void asm_expr_prod(TCCState *s1, ExprValue *pe)
case '*':
pe->v *= e2.v;
break;
case '/':
case '/':
if (e2.v == 0) {
div_error:
tcc_error("division by zero");
}
pe->v /= e2.v;
break;
case '%':
case '%':
if (e2.v == 0)
goto div_error;
pe->v %= e2.v;
@ -281,7 +281,7 @@ static void asm_expr_logic(TCCState *s1, ExprValue *pe)
case '&':
pe->v &= e2.v;
break;
case '|':
case '|':
pe->v |= e2.v;
break;
default:
@ -316,7 +316,7 @@ static inline void asm_expr_sum(TCCState *s1, ExprValue *pe)
because we store only one symbol in the expression */
if (!e2.sym) {
/* OK */
} else if (pe->sym == e2.sym) {
} else if (pe->sym == e2.sym) {
/* OK */
pe->sym = NULL; /* same symbols can be subtracted to NULL */
} else {
@ -713,7 +713,7 @@ static void asm_parse_directive(TCCState *s1, int global)
case TOK_ASMDIR_weak:
case TOK_ASMDIR_hidden:
tok1 = tok;
do {
do {
Sym *sym;
next();
if (tok < TOK_IDENT)
@ -759,7 +759,7 @@ static void asm_parse_directive(TCCState *s1, int global)
case TOK_ASMDIR_text:
case TOK_ASMDIR_data:
case TOK_ASMDIR_bss:
{
{
char sname[64];
tok1 = tok;
n = 0;
@ -810,7 +810,7 @@ static void asm_parse_directive(TCCState *s1, int global)
}
break;
case TOK_ASMDIR_size:
{
{
Sym *sym;
next();
@ -829,7 +829,7 @@ static void asm_parse_directive(TCCState *s1, int global)
}
break;
case TOK_ASMDIR_type:
{
{
Sym *sym;
const char *newtype;
int st_type;
@ -924,7 +924,7 @@ static void asm_parse_directive(TCCState *s1, int global)
}
break;
case TOK_ASMDIR_previous:
{
{
Section *sec;
next();
if (!last_text_section)
@ -1120,7 +1120,7 @@ static void tcc_assemble_inline(TCCState *s1, const char *str, int len, int glob
/* find a constraint by its number or id (gcc 3 extended
syntax). return -1 if not found. Return in *pp in char after the
constraint */
ST_FUNC int find_constraint(ASMOperand *operands, int nb_operands,
ST_FUNC int find_constraint(ASMOperand *operands, int nb_operands,
const char *name, const char **pp)
{
int index;
@ -1158,7 +1158,7 @@ ST_FUNC int find_constraint(ASMOperand *operands, int nb_operands,
return index;
}
static void subst_asm_operands(ASMOperand *operands, int nb_operands,
static void subst_asm_operands(ASMOperand *operands, int nb_operands,
CString *out_str, const char *str)
{
int c, index, modifier;
@ -1362,12 +1362,12 @@ ST_FUNC void asm_instr(void)
token after the assembler parsing */
if (tok != ';')
expect("';'");
/* save all values in the memory */
save_regs(0);
/* compute constraints */
asm_compute_constraints(operands, nb_operands, nb_outputs,
asm_compute_constraints(operands, nb_operands, nb_outputs,
clobber_regs, &out_reg);
/* substitute the operands in the asm string. No substitution is
@ -1387,8 +1387,8 @@ ST_FUNC void asm_instr(void)
#endif
/* generate loads */
asm_gen_code(operands, nb_operands, nb_outputs, 0,
clobber_regs, out_reg);
asm_gen_code(operands, nb_operands, nb_outputs, 0,
clobber_regs, out_reg);
/* We don't allow switching section within inline asm to
bleed out to surrounding code. */
@ -1405,9 +1405,9 @@ ST_FUNC void asm_instr(void)
next();
/* store the output values if needed */
asm_gen_code(operands, nb_operands, nb_outputs, 1,
asm_gen_code(operands, nb_operands, nb_outputs, 1,
clobber_regs, out_reg);
/* free everything */
for(i=0;i<nb_operands;i++) {
vpop();
@ -1429,7 +1429,7 @@ ST_FUNC void asm_global_instr(void)
token after the assembler parsing */
if (tok != ';')
expect("';'");
#ifdef ASM_DEBUG
printf("asm_global: \"%s\"\n", (char *)astr->data);
#endif
@ -1438,7 +1438,7 @@ ST_FUNC void asm_global_instr(void)
/* assemble the string with tcc internal assembler */
tcc_assemble_inline(tcc_state, astr->data, astr->size - 1, 1);
cur_text_section->data_offset = ind;
/* restore the current C token */

View File

@ -1,6 +1,6 @@
/*
* COFF file handling for TCC
*
*
* Copyright (c) 2003, 2004 TK
* Copyright (c) 2004 Fabrice Bellard
*
@ -609,7 +609,7 @@ ST_FUNC int tcc_output_coff(TCCState *s1, FILE *f)
// put a .ef
strcpy(csym._n._n_name, ".ef");
csym.n_value = EndAddress[k]; // physical address
csym.n_value = EndAddress[k]; // physical address
csym.n_scnum = CoffTextSectionNo;
csym.n_type = 0;
csym.n_sclass = C_FCN;

View File

@ -1139,7 +1139,7 @@ ST_FUNC Sym *get_sym_ref(CType *type, Section *sec, unsigned long offset, unsign
/* push a reference to a section offset by adding a dummy symbol */
static void vpush_ref(CType *type, Section *sec, unsigned long offset, unsigned long size)
{
vpushsym(type, get_sym_ref(type, sec, offset, size));
vpushsym(type, get_sym_ref(type, sec, offset, size));
}
/* define a new external reference to a symbol 'v' of type 'u' */
@ -1470,7 +1470,7 @@ ST_FUNC int get_reg_ex(int rc, int rc2)
{
int r;
SValue *p;
for(r=0;r<NB_REGS;r++) {
if (reg_classes[r] & rc2) {
int n;
@ -1508,7 +1508,7 @@ ST_FUNC int get_reg(int rc)
}
notfound: ;
}
/* no register left : free the first one on the stack (VERY
IMPORTANT to start from the bottom to ensure that we don't
spill registers used in gen_opi()) */
@ -1888,7 +1888,7 @@ ST_FUNC int gv(int rc)
}
r = gv(rc);
} else {
if (is_float(vtop->type.t) &&
if (is_float(vtop->type.t) &&
(vtop->r & (VT_VALMASK | VT_LVAL)) == VT_CONST) {
/* CPUs usually cannot use float constants, so we store them
generically in data segment */
@ -1904,7 +1904,7 @@ ST_FUNC int gv(int rc)
vtop->r |= VT_LVAL;
}
#ifdef CONFIG_TCC_BCHECK
if (vtop->r & VT_MUSTBOUND)
if (vtop->r & VT_MUSTBOUND)
gbound();
#endif
@ -2428,7 +2428,7 @@ static void gen_opic(int op)
vtop--;
} else {
/* if commutative ops, put c2 as constant */
if (c1 && (op == '+' || op == '&' || op == '^' ||
if (c1 && (op == '+' || op == '&' || op == '^' ||
op == '|' || op == '*' || op == TOK_EQ || op == TOK_NE)) {
vswap();
c2 = c1; //c = c1, c1 = c2, c2 = c;
@ -2579,7 +2579,7 @@ static void gen_opif(int op)
case '+': f1 += f2; break;
case '-': f1 -= f2; break;
case '*': f1 *= f2; break;
case '/':
case '/':
if (f2 == 0.0) {
union { float f; unsigned u; } x1, x2, y;
/* If not in initializer we need to potentially generate
@ -3050,7 +3050,7 @@ redo:
t2 = vtop[0].type.t;
bt1 = t1 & VT_BTYPE;
bt2 = t2 & VT_BTYPE;
if (bt1 == VT_FUNC || bt2 == VT_FUNC) {
if (bt2 == VT_FUNC) {
mk_pointer(&vtop->type);
@ -3180,7 +3180,7 @@ op_err:
/* generic itof for unsigned long long case */
static void gen_cvt_itof1(int t)
{
if ((vtop->type.t & (VT_BTYPE | VT_UNSIGNED)) ==
if ((vtop->type.t & (VT_BTYPE | VT_UNSIGNED)) ==
(VT_LLONG | VT_UNSIGNED)) {
if (t == VT_FLOAT)
@ -3572,7 +3572,7 @@ ST_FUNC void mk_pointer(CType *type)
}
/* return true if type1 and type2 are exactly the same (including
qualifiers).
qualifiers).
*/
static int is_compatible_types(CType *type1, CType *type2)
{
@ -3867,7 +3867,7 @@ ST_FUNC void inc(int post, int c)
vrotb(3);
}
/* add constant */
vpushi(c - TOK_MID);
vpushi(c - TOK_MID);
gen_op('+');
vstore(); /* store value */
if (post)
@ -3913,7 +3913,7 @@ static void parse_attribute(AttributeDef *ad)
int t, n;
char *astr;
AttributeDef ad_tmp;
redo:
if (tok != TOK_ATTRIBUTE1 && tok != TOK_ATTRIBUTE2)
return;
@ -3995,7 +3995,7 @@ redo:
if (tok == '(') {
next();
n = expr_const();
if (n <= 0 || (n & (n - 1)) != 0)
if (n <= 0 || (n & (n - 1)) != 0)
tcc_error("alignment must be a positive power of two");
skip(')');
} else {
@ -4058,7 +4058,7 @@ redo:
case TOK_REGPARM2:
skip('(');
n = expr_const();
if (n > 3)
if (n > 3)
n = 3;
else if (n < 0)
n = 0;
@ -4116,9 +4116,9 @@ skip_param:
if (tok == '(') {
int parenthesis = 0;
do {
if (tok == '(')
if (tok == '(')
parenthesis++;
else if (tok == ')')
else if (tok == ')')
parenthesis--;
next();
} while (parenthesis && tok != -1);
@ -4626,7 +4626,7 @@ do_decl:
if ((type1.t & VT_BTYPE) == VT_FUNC ||
(type1.t & VT_BTYPE) == VT_VOID ||
(type1.t & VT_STORAGE))
tcc_error("invalid type for '%s'",
tcc_error("invalid type for '%s'",
get_tok_str(v, NULL));
}
if (tok == ':') {
@ -4634,18 +4634,18 @@ do_decl:
bit_size = expr_const();
/* XXX: handle v = 0 case for messages */
if (bit_size < 0)
tcc_error("negative width in bit-field '%s'",
tcc_error("negative width in bit-field '%s'",
get_tok_str(v, NULL));
if (v && bit_size == 0)
tcc_error("zero width for bit-field '%s'",
tcc_error("zero width for bit-field '%s'",
get_tok_str(v, NULL));
parse_attribute(&ad1);
}
size = type_size(&type1, &align);
if (bit_size >= 0) {
bt = type1.t & VT_BTYPE;
if (bt != VT_INT &&
bt != VT_BYTE &&
if (bt != VT_INT &&
bt != VT_BYTE &&
bt != VT_SHORT &&
bt != VT_BOOL &&
bt != VT_LLONG)
@ -4726,7 +4726,7 @@ static void parse_btype_qualify(CType *type, int qualifiers)
}
/* return 0 if no type declaration. otherwise, return the basic type
and skip it.
and skip it.
*/
static int parse_btype(CType *type, AttributeDef *ad, int ignore_label)
{
@ -5107,9 +5107,9 @@ static int post_type(CType *type, AttributeDef *ad, int storage, int td)
skip(')');
/* NOTE: const is ignored in returned type as it has a special
meaning in gcc / C++ */
type->t &= ~VT_CONSTANT;
type->t &= ~VT_CONSTANT;
/* some ancient pre-K&R C allows a function to return an array
and the array brackets to be put after the arguments, such
and the array brackets to be put after the arguments, such
that "int c()[]" means something like "int[] c()" */
if (tok == '[') {
next();
@ -5220,7 +5220,7 @@ check:
if (n != -1)
vpop();
nocode_wanted = saved_nocode_wanted;
/* we push an anonymous symbol which will contain the array
element type */
s = sym_push(SYM_FIELD, type, 0, n);
@ -5618,7 +5618,7 @@ ST_FUNC void unary(void)
goto push_tokc;
#endif
case TOK_CINT:
case TOK_CCHAR:
case TOK_CCHAR:
t = VT_INT;
push_tokc:
type.t = t;
@ -6151,7 +6151,7 @@ special_math_val:
}
break;
}
/* post operations */
while (1) {
if (tok == TOK_INC || tok == TOK_DEC) {
@ -6159,8 +6159,8 @@ special_math_val:
next();
} else if (tok == '.' || tok == TOK_ARROW) {
int qualifiers, cumofs;
/* field */
if (tok == TOK_ARROW)
/* field */
if (tok == TOK_ARROW)
indir();
qualifiers = vtop->type.t & (VT_CONSTANT | VT_VOLATILE);
test_lvalue();
@ -6722,7 +6722,7 @@ static void expr_cond(void)
static void expr_eq(void)
{
int t;
expr_cond();
if ((t = tok) == '=' || TOK_ASSIGN(t)) {
test_lvalue();
@ -8014,7 +8014,7 @@ static void decl_initializer(init_params *p, CType *type, unsigned long c, int f
/* only parse strings here if correct type (otherwise: handle
them as ((w)char *) expressions */
if ((tok == TOK_LSTR &&
if ((tok == TOK_LSTR &&
#ifdef TCC_TARGET_PE
(t1->t & VT_BTYPE) == VT_SHORT && (t1->t & VT_UNSIGNED)
#else
@ -8191,7 +8191,7 @@ static void decl_initializer(init_params *p, CType *type, unsigned long c, int f
are parsed. If 'v' is zero, then a reference to the new object
is put in the value stack. If 'has_init' is 2, a special parsing
is done to handle string constants. */
static void decl_initializer_alloc(CType *type, AttributeDef *ad, int r,
static void decl_initializer_alloc(CType *type, AttributeDef *ad, int r,
int has_init, int v, int scope)
{
int size, align, addr;

View File

@ -1,8 +1,8 @@
/* Simple libc header for TCC
*
/* Simple libc header for TCC
*
* Add any function you want from the libc there. This file is here
* only for your convenience so that you do not need to put the whole
* glibc include files on your floppy disk
* glibc include files on your floppy disk
*/
#ifndef _TCCLIB_H
#define _TCCLIB_H

View File

@ -450,19 +450,19 @@ struct macho {
Section *stub_helper, *la_symbol_ptr;
struct dyld_info_command *dyldinfo;
int helpsym, lasym, dyld_private, dyld_stub_binder;
int n_lazy_bind;
int n_lazy_bind;
struct s_lazy_bind {
int section;
int bind_offset;
int la_symbol_offset;
ElfW_Rel rel;
} *s_lazy_bind;
int n_rebase;
int n_rebase;
struct s_rebase {
int section;
ElfW_Rel rel;
} *s_rebase;
int n_bind;
int n_bind;
struct bind {
int section;
ElfW_Rel rel;
@ -565,7 +565,7 @@ static void tcc_macho_add_destructor(TCCState *s1)
text_section->sh_num, "__mh_execute_header");
s = find_section(s1, ".fini_array");
if (s->data_offset == 0)
return;
return;
init_sym = put_elf_sym(s1->symtab, text_section->data_offset, 0,
ELFW(ST_INFO)(STB_LOCAL, STT_FUNC), 0,
text_section->sh_num, "___GLOBAL_init_65535");
@ -585,7 +585,7 @@ static void tcc_macho_add_destructor(TCCState *s1)
ptr[0] = 0x48; // lea destructor(%rip),%rax
ptr[1] = 0x8d;
ptr[2] = 0x05;
put_elf_reloca(s1->symtab, text_section,
put_elf_reloca(s1->symtab, text_section,
text_section->data_offset - 23,
R_X86_64_PC32, sym_index, -4);
ptr[7] = 0x48; // mov %rax,%rdi
@ -617,7 +617,7 @@ static void tcc_macho_add_destructor(TCCState *s1)
int sym_index = ELFW(R_SYM)(rel->r_info);
ptr = section_ptr_add(text_section, 24);
put_elf_reloc(s1->symtab, text_section,
put_elf_reloc(s1->symtab, text_section,
text_section->data_offset - 24,
R_AARCH64_ADR_PREL_PG_HI21, sym_index);
write32le(ptr, 0x90000000); // adrp x0, destructor@page
@ -626,7 +626,7 @@ static void tcc_macho_add_destructor(TCCState *s1)
R_AARCH64_LDST8_ABS_LO12_NC, sym_index);
write32le(ptr + 4, 0x91000000); // add x0,x0,destructor@pageoff
write32le(ptr + 8, 0xd2800001); // mov x1, #0
put_elf_reloc(s1->symtab, text_section,
put_elf_reloc(s1->symtab, text_section,
text_section->data_offset - 12,
R_AARCH64_ADR_PREL_PG_HI21, mh_execute_header);
write32le(ptr + 12, 0x90000002); // adrp x2, mh_execute_header@page
@ -828,7 +828,7 @@ static void check_relocs(TCCState *s1, struct macho *mo)
write32le(jmp + 16, 0xf9400210); // ldr x16,[x16,dyld_stub_binder@pageoff]
write32le(jmp + 20, 0xd61f0200); // br x16
#endif
goti = NULL;
mo->nr_plt = mo->n_got = 0;
for (i = 1; i < s1->nb_sections; i++) {

View File

@ -1504,7 +1504,7 @@ static int pe_check_symbols(struct pe_info *pe)
#ifdef TCC_TARGET_X86_64
write32le(p + 2, (DWORD)-4);
#endif
put_elf_reloc(symtab_section, text_section,
put_elf_reloc(symtab_section, text_section,
offset + 2, R_XXX_THUNKFIX, is->iat_index);
#endif
}

40
tccpp.c
View File

@ -1,6 +1,6 @@
/*
* TCC - Tiny C Compiler
*
*
* Copyright (c) 2001-2004 Fabrice Bellard
*
* This library is free software; you can redistribute it and/or
@ -61,7 +61,7 @@ static struct TinyAlloc *tokstr_alloc;
static TokenString *macro_stack;
static const char tcc_keywords[] =
static const char tcc_keywords[] =
#define DEF(id, str) str "\0"
#include "tcctok.h"
#undef DEF
@ -465,7 +465,7 @@ static TokenSym *tok_alloc_new(TokenSym **pts, const char *str, int len)
TokenSym *ts, **ptable;
int i;
if (tok_ident >= SYM_FIRST_ANOM)
if (tok_ident >= SYM_FIRST_ANOM)
tcc_error("memory full (symbols)");
/* expand token table if needed */
@ -500,7 +500,7 @@ ST_FUNC TokenSym *tok_alloc(const char *str, int len)
TokenSym *ts, **pts;
int i;
unsigned int h;
h = TOK_HASH_INIT;
for(i=0;i<len;i++)
h = TOK_HASH_FUNC(h, ((unsigned char *)str)[i]);
@ -928,7 +928,7 @@ redo_start:
file->buf_ptr = p;
next_nomacro();
p = file->buf_ptr;
if (a == 0 &&
if (a == 0 &&
(tok == TOK_ELSE || tok == TOK_ELIF || tok == TOK_ENDIF))
goto the_end;
if (tok == TOK_IF || tok == TOK_IFDEF || tok == TOK_IFNDEF)
@ -1459,7 +1459,7 @@ static int expr_preprocess(TCCState *s1)
int c, t;
int t0 = tok;
TokenString *str;
str = tok_str_alloc();
pp_expr = 1;
while (1) {
@ -1475,7 +1475,7 @@ static int expr_preprocess(TCCState *s1)
parse_flags &= ~PARSE_FLAG_PREPROCESS; /* no macro subst */
next();
t = tok;
if (t == '(')
if (t == '(')
next();
parse_flags |= PARSE_FLAG_PREPROCESS;
if (tok < TOK_IDENT)
@ -2094,7 +2094,7 @@ static void parse_escape_string(CString *outstr, const uint8_t *buf, int is_long
break;
case '\'':
case '\"':
case '\\':
case '\\':
case '?':
break;
default:
@ -2331,7 +2331,7 @@ static void parse_number(const char *p)
*q = '\0';
if (b == 16)
shift = 4;
else
else
shift = 1;
bn_zero(bn);
q = token_buf;
@ -2388,7 +2388,7 @@ static void parse_number(const char *p)
ch = *p++;
}
exp_val = exp_val * s;
/* now we can generate the number */
/* XXX: should patch directly float number */
#ifdef TCC_USING_DOUBLE_FOR_LDOUBLE
@ -2686,7 +2686,7 @@ maybe_newline:
case '#':
/* XXX: simplify */
PEEKC(c, p);
if ((tok_flags & TOK_FLAG_BOL) &&
if ((tok_flags & TOK_FLAG_BOL) &&
(parse_flags & PARSE_FLAG_PREPROCESS)) {
tok_flags &= ~TOK_FLAG_BOL;
file->buf_ptr = p;
@ -2710,7 +2710,7 @@ maybe_newline:
}
}
break;
/* dollar is allowed to start identifiers when not parsing asm */
case '$':
if (!(isidnum_table['$' - CH_EOF] & IS_ID)
@ -2723,14 +2723,14 @@ maybe_newline:
case 'm': case 'n': case 'o': case 'p':
case 'q': case 'r': case 's': case 't':
case 'u': case 'v': case 'w': case 'x':
case 'y': case 'z':
case 'y': case 'z':
case 'A': case 'B': case 'C': case 'D':
case 'E': case 'F': case 'G': case 'H':
case 'I': case 'J': case 'K':
case 'I': case 'J': case 'K':
case 'M': case 'N': case 'O': case 'P':
case 'Q': case 'R': case 'S': case 'T':
case 'U': case 'V': case 'W': case 'X':
case 'Y': case 'Z':
case 'Y': case 'Z':
case '_':
parse_ident_fast:
p1 = p;
@ -2887,7 +2887,7 @@ maybe_newline:
tok = TOK_GT;
}
break;
case '&':
PEEKC(c, p);
if (c == '&') {
@ -2900,7 +2900,7 @@ maybe_newline:
tok = '&';
}
break;
case '|':
PEEKC(c, p);
if (c == '|') {
@ -2926,7 +2926,7 @@ maybe_newline:
tok = '+';
}
break;
case '-':
PEEKC(c, p);
if (c == '-') {
@ -2948,7 +2948,7 @@ maybe_newline:
PARSE2('*', '*', '=', TOK_A_MUL)
PARSE2('%', '%', '=', TOK_A_MOD)
PARSE2('^', '^', '=', TOK_A_XOR)
/* comments or operator */
case '/':
PEEKC(c, p);
@ -2968,7 +2968,7 @@ maybe_newline:
tok = '/';
}
break;
/* simple tokens */
case '@': /* only used in assembler */
#ifdef TCC_TARGET_ARM /* comment on arm asm */

View File

@ -996,7 +996,7 @@ static addr_t rt_printline_dwarf (rt_context *rc, addr_t wanted_pc, bt_info *bi)
: dwarf_read_8(ln, end);
#endif
}
else
else
dwarf_ignore_type(ln, end);
}
}
@ -1028,7 +1028,7 @@ static addr_t rt_printline_dwarf (rt_context *rc, addr_t wanted_pc, bt_info *bi)
if (i < FILE_TABLE_SIZE)
filename_table[i].dir_entry = value;
}
else
else
dwarf_ignore_type(ln, end);
}
}

View File

@ -41,7 +41,7 @@ static int run_callback(const char *src, callback_type callback) {
TCCState *s;
int result;
void *ptr;
s = tcc_new();
if (!s)
return -1;
@ -54,14 +54,14 @@ static int run_callback(const char *src, callback_type callback) {
return -1;
if (tcc_relocate(s) == -1)
return -1;
ptr = tcc_get_symbol(s, "f");
if (!ptr)
return -1;
result = callback(ptr);
tcc_delete(s);
return result;
}
@ -89,7 +89,7 @@ RET_PRIMITIVE_TEST(longdouble, LONG_DOUBLE, LONG_DOUBLE_LITERAL(378943892.0))
/*
* ret_2float_test:
*
*
* On x86-64, a struct with 2 floats should be packed into a single
* SSE register (VT_DOUBLE is used for this purpose).
*/
@ -117,7 +117,7 @@ static int ret_2float_test(void) {
/*
* ret_2double_test:
*
*
* On x86-64, a struct with 2 doubles should be passed in two SSE
* registers.
*/
@ -281,7 +281,7 @@ static int reg_pack_test(void) {
" reg_pack_test_type r = {a.x*5, a.y*3};\n"
" return r;\n"
"}\n";
return run_callback(src, reg_pack_test_callback);
}
@ -307,7 +307,7 @@ static int reg_pack_longlong_test(void) {
" reg_pack_longlong_test_type r = {a.x*5, a.y*3};\n"
" return r;\n"
"}\n";
return run_callback(src, reg_pack_longlong_test_callback);
}
@ -365,13 +365,13 @@ static int sret_test(void) {
" sret_test_type r = {x.a*35, x.b*19, x.c*21};\n"
" return r;\n"
"}\n";
return run_callback(src, sret_test_callback);
}
/*
* one_member_union_test:
*
*
* In the x86-64 ABI a union should always be passed on the stack. However
* it appears that a single member union is treated by GCC as its member.
*/
@ -399,7 +399,7 @@ static int one_member_union_test(void) {
/*
* two_member_union_test:
*
*
* In the x86-64 ABI a union should always be passed on the stack.
*/
typedef union two_member_union_test_type_u {int x; long y;} two_member_union_test_type;
@ -430,7 +430,7 @@ static int two_member_union_test(void) {
typedef struct many_struct_test_type_s {long long a, b, c;} many_struct_test_type;
typedef many_struct_test_type (*many_struct_test_function_type) (many_struct_test_type,many_struct_test_type,many_struct_test_type,many_struct_test_type,many_struct_test_type,many_struct_test_type);
static int many_struct_test_callback(void *ptr) {
many_struct_test_function_type f = (many_struct_test_function_type)ptr;
many_struct_test_type v = {1, 2, 3};
@ -457,7 +457,7 @@ static int many_struct_test(void) {
typedef struct many_struct_test_2_type_s {int a, b;} many_struct_test_2_type;
typedef many_struct_test_2_type (*many_struct_test_2_function_type) (many_struct_test_2_type,many_struct_test_2_type,many_struct_test_2_type,many_struct_test_2_type,many_struct_test_2_type,many_struct_test_2_type);
static int many_struct_test_2_callback(void *ptr) {
many_struct_test_2_function_type f = (many_struct_test_2_function_type)ptr;
many_struct_test_2_type v = {1,2};
@ -628,7 +628,7 @@ static int arg_align_test_callback(void *ptr) {
}
static int arg_align_test(void) {
const char *src =
const char *src =
"long double f(long double a, int b, long double c, int d, long double e) {\n"
" return a + c + e;\n"
"}\n";
@ -651,7 +651,7 @@ int main(int argc, char **argv) {
int i;
const char *testname = NULL;
int retval = EXIT_SUCCESS;
/* if tcclib.h and libtcc1.a are not installed, where can we find them */
for (i = 1; i < argc; ++i) {
if (!memcmp(argv[i], "run_test=", 9))

View File

@ -43,7 +43,7 @@ mov 0x10000, %eax
mov 0x10000, %ax
mov 0x10000, %al
mov %al, 0x10000
mov $1, %edx
mov $1, %dx
mov $1, %cl
@ -67,7 +67,7 @@ movl $0x11334455,(%rbx)
#endif
mov %eax, 0x12(,%edx,2)
#ifdef __i386__
mov %cr3, %edx
mov %ecx, %cr3
@ -110,10 +110,10 @@ notl %r15d
movzbl 0x1000, %eax
movzbw 0x1000, %ax
movzwl 0x1000, %eax
movzb 0x1000, %eax
movzb 0x1000, %ax
mov $0x12345678,%eax
#ifdef __x86_64__
@ -130,7 +130,7 @@ notl %r15d
mov $0x123456789abcdef0,%rcx
mov $0x123456789abcdef0,%r11
#endif
#ifdef __i386__
pushl %eax
push %eax
@ -145,7 +145,7 @@ notl %r15d
push $100
push 0x42(%eax)
pop 0x43(%esi)
#ifdef __i386__
popl %eax
pop %eax
@ -156,31 +156,31 @@ notl %r15d
#endif
popw %ax
pop %fs
xchg %eax, %ecx
xchg %edx, %eax
xchg %bx, 0x10000
xchg 0x10000, %ebx
xchg 0x10000, %dl
in $100, %al
in $100, %ax
in $100, %al
in $100, %ax
in $100, %eax
in %dx, %al
in %dx, %ax
in %dx, %ax
in %dx, %eax
inb %dx
inw %dx
inw %dx
inl %dx
out %al, $100
out %ax, $100
out %eax, $100
out %al, $100
out %ax, $100
out %eax, $100
/* NOTE: gas is bugged here, so size must be added */
outb %al, %dx
outw %ax, %dx
outl %eax, %dx
outb %al, %dx
outw %ax, %dx
outl %eax, %dx
leal 0x1000(%ebx), %ecx
lea 0x1000(%ebx), %ecx
@ -242,10 +242,10 @@ movb $15, %r12b
add %eax, (%ebx)
add (%ebx), %eax
or %dx, (%ebx)
or (%ebx), %si
add %cl, (%ebx)
add (%ebx), %dl
@ -253,7 +253,7 @@ add (%ebx), %dl
incl 0x10000
incb 0x10000
dec %dx
test $1, %al
test $1, %cl
@ -285,7 +285,7 @@ add (%ebx), %dl
imul $10, %eax
imul $0x1100000, %eax
imul $1, %eax
idivw 0x1000
div %ecx
div %bl
@ -381,7 +381,7 @@ L3:
loop L3
jecxz L3
seto %al
setc %al
setcb %al
@ -509,7 +509,7 @@ L3:
frstor 0x1000
ffree %st(7)
ffreep %st(6)
ftst
fxam
fld1
@ -675,7 +675,7 @@ int $0x10
repz cmpsb
repne movsb
repnz outsb
invd
wbinvd
cpuid
@ -721,13 +721,13 @@ int $0x10
movd 0x1000, %mm2
movd %mm4, %ecx
movd %mm5, 0x1000
movq 0x1000, %mm2
movq %mm4, 0x1000
pand 0x1000, %mm3
pand %mm4, %mm5
psllw $1, %mm6
psllw 0x1000, %mm7
psllw %mm2, %mm7
@ -827,10 +827,10 @@ int $0x10
str 0x1000
str %ecx
str %dx
verr 0x1000
verw 0x1000
#ifdef __i386__
push %ds
pushw %ds
@ -947,7 +947,7 @@ overrideme:
movq %rdx, %xmm2
movq %r13, %xmm3
/* movq mem64->xmm is encoded as f30f7e by GAS, but as
660f6e by tcc (which really is a movd and would need
660f6e by tcc (which really is a movd and would need
a REX.W prefix to be movq). */
movq (%rsi), %xmm3
movq %mm1, %rdx

View File

@ -79,7 +79,7 @@ int test6(void)
{
int i, sum = 0;
int *tab4;
tab4 = malloc(20 * sizeof(int));
free(tab4);
for(i=0;i<21;i++) {
@ -294,4 +294,4 @@ int main(int argc, char **argv)
/*
* without bound 0.77 s
* with bounds 4.73
*/
*/

View File

@ -114,7 +114,7 @@ unsigned long strlen(const char *s)
static void pr_num(int num)
{
char val[20], *p = &val[20];
*--p = '\0';
do {
int a = num, b = 0;

View File

@ -77,8 +77,8 @@
as funclike macro invocation of KO. E.g. X93 and X94 expand to 'KO',
but X95 must not consume the (a,b) arguments outside the M_IF()
invocation to reduce the 'KO' macro to an invocation. Instead
X95 should reduce via M_IF(KO)(a,b) to 'a'.
X95 should reduce via M_IF(KO)(a,b) to 'a'.
The other lines here are variations on this scheme, with X1 to
X6 coming from the bug report at
http://lists.nongnu.org/archive/html/tinycc-devel/2017-07/msg00017.html */

View File

@ -251,7 +251,7 @@ void macro_test(void)
glue(a <, <= 2);
printf("a=%d\n", a);
}
/* macro function with argument outside the macro string */
#define MF_s MF_hello
#define MF_hello(msg) printf("%s\n",msg)
@ -260,7 +260,7 @@ void macro_test(void)
MF_s("hi");
MF_t("hi");
/* test macro substitution inside args (should not eat stream) */
printf("qq=%d\n", qq(qq)(2));
@ -321,7 +321,7 @@ void recursive_macro_test(void)
printf("%d\n", ELFW(ST_INFO)(STB_WEAK, ELFW(ST_TYPE)(123)));
#define WRAP(x) x
#define print_num(x) print_num(__FILE__,__LINE__,x)
print_num(123);
WRAP(print_num(123));
@ -565,7 +565,7 @@ void goto_test()
/* This needs to parse as label, not as start of decl. */
typedef_and_label:
s_loop:
if (i >= 10)
if (i >= 10)
goto s_end;
printf("%d", i);
i++;
@ -828,10 +828,10 @@ void expr_test()
printf("%d\n", ~12);
printf("%d\n", -12);
printf("%d\n", +12);
printf("%d %d %d %d\n",
isid('a'),
isid('g'),
isid('T'),
printf("%d %d %d %d\n",
isid('a'),
isid('g'),
isid('T'),
isid('('));
}
@ -1115,7 +1115,7 @@ void struct_test()
sizeof(altest6), __alignof__(altest6));
printf("altest7 sizeof=%d alignof=%d\n",
sizeof(altest7), __alignof__(altest7));
/* empty structures (GCC extension) */
printf("sizeof(struct empty) = %d\n", sizeof(struct empty));
printf("alignof(struct empty) = %d\n", __alignof__(struct empty));
@ -1140,17 +1140,17 @@ void char_short_test()
var1 = 0x01020304;
var2 = 0xfffefdfc;
printf("s8=%d %d\n",
printf("s8=%d %d\n",
*(signed char *)&var1, *(signed char *)&var2);
printf("u8=%d %d\n",
printf("u8=%d %d\n",
*(unsigned char *)&var1, *(unsigned char *)&var2);
printf("s16=%d %d\n",
printf("s16=%d %d\n",
*(short *)&var1, *(short *)&var2);
printf("u16=%d %d\n",
printf("u16=%d %d\n",
*(unsigned short *)&var1, *(unsigned short *)&var2);
printf("s32=%d %d\n",
printf("s32=%d %d\n",
*(int *)&var1, *(int *)&var2);
printf("u32=%d %d\n",
printf("u32=%d %d\n",
*(unsigned int *)&var1, *(unsigned int *)&var2);
*(signed char *)&var1 = 0x08;
printf("var1=%x\n", var1);
@ -1297,7 +1297,7 @@ void bool_test()
static int v1 = 34 ? : -1; /* constant case */
static int v2 = 0 ? : -1; /* constant case */
int a = 30;
printf("%d %d\n", v1, v2);
printf("%d %d\n", a - 30 ? : a * 2, a + 1 ? : a * 2);
}
@ -1460,8 +1460,8 @@ static int tentative_ar[];
static int tentative_ar[] = {1,2,3};
//int cinit1; /* a global variable can be defined several times without error ! */
int cinit1;
int cinit1;
int cinit1;
int cinit1;
int cinit1 = 0;
int *cinit2 = (int []){3, 2, 1};
@ -1499,7 +1499,7 @@ void compound_literal_test(void)
for(i=0;i<3;i++) {
p = (int []){1, 2, 4 + i};
printf("%d %d %d\n",
printf("%d %d %d\n",
p[0],
p[1],
p[2]);
@ -1539,7 +1539,7 @@ char invalid_function_def()[] {return 0;}
void num(int n)
{
char *tab, *p;
tab = (char*)malloc(20);
tab = (char*)malloc(20);
p = tab;
while (1) {
*p = 48 + (n % 10);
@ -1580,7 +1580,7 @@ void struct_assign_test(void)
struct structa1 lsta1, lsta2;
int i;
} s = {{1,2}, {3,4}}, *ps;
ps = &s;
ps->i = 4;
@ -1640,9 +1640,9 @@ void cast_test()
printf("%d\n", a);
a = (scast = 65536) + 1;
printf("%d\n", a);
printf("sizeof(c) = %d, sizeof((int)c) = %d\n", sizeof(c), sizeof((int)c));
/* test cast from unsigned to signed short to int */
b = 0xf000;
d = (short)b;
@ -1650,7 +1650,7 @@ void cast_test()
b = 0xf0f0;
d = (char)b;
printf("((unsigned)(char)0x%08x) = 0x%08x\n", b, d);
/* test implicit int casting for array accesses */
c = 0;
tab[1] = 2;
@ -1697,7 +1697,7 @@ char sinit8[] = "hello" "trala";
struct structinit1 sinit9 = { 1, 2, 3 };
struct structinit1 sinit10 = { .f2 = 2, 3, .f1 = 1 };
struct structinit1 sinit11 = { .f2 = 2, 3, .f1 = 1,
struct structinit1 sinit11 = { .f2 = 2, 3, .f1 = 1,
#ifdef ALL_ISOC99
.farray[0] = 10,
.farray[1] = 11,
@ -1822,34 +1822,34 @@ void init_test(void)
struct bf_SS bfaa_finit[3] = { [1].bit = 1 };
struct bf_SS bfaa_fvinit[] = { [2].bit = 1 };
struct b2_SS bf_finit2 = {0xFFF000FFF000FLL, 0x123};
printf("sinit1=%d\n", sinit1);
printf("sinit2=%d\n", sinit2);
printf("sinit3=%d %d %d %d\n",
printf("sinit3=%d %d %d %d\n",
sizeof(sinit3),
sinit3[0],
sinit3[1],
sinit3[2]
);
printf("sinit6=%d\n", sizeof(sinit6));
printf("sinit7=%d %d %d %d\n",
printf("sinit7=%d %d %d %d\n",
sizeof(sinit7),
sinit7[0],
sinit7[1],
sinit7[2]
);
printf("sinit8=%s\n", sinit8);
printf("sinit9=%d %d %d\n",
printf("sinit9=%d %d %d\n",
sinit9.f1,
sinit9.f2,
sinit9.f3
);
printf("sinit10=%d %d %d\n",
printf("sinit10=%d %d %d\n",
sinit10.f1,
sinit10.f2,
sinit10.f3
);
printf("sinit11=%d %d %d %d %d %d\n",
printf("sinit11=%d %d %d %d %d %d\n",
sinit11.f1,
sinit11.f2,
sinit11.f3,
@ -1860,7 +1860,7 @@ void init_test(void)
for(i=0;i<3;i++)
for(j=0;j<2;j++)
printf("[%d][%d] = %d %d %d\n",
printf("[%d][%d] = %d %d %d\n",
i, j, sinit4[i][j], sinit5[i][j], linit4[i][j]);
printf("linit1=%d\n", linit1);
printf("linit2=%d\n", linit2);
@ -1869,7 +1869,7 @@ void init_test(void)
printf("sinit12=%s\n", sinit12);
printf("sinit13=%d %s %s %s\n",
sizeof(sinit13),
sizeof(sinit13),
sinit13[0],
sinit13[1],
sinit13[2]);
@ -1883,7 +1883,7 @@ void init_test(void)
printf("\n");
for(i=0;i<10;i++) printf(" %d", linit15[i]);
printf("\n");
printf("%d %d %d %d\n",
printf("%d %d %d %d\n",
linit16.a1,
linit16.a2,
linit16.a3,
@ -2102,13 +2102,13 @@ void bitfield_test(void)
printf("%d %d\n", sa, ca);
st1.f1 = 7;
if (st1.f1 == -1)
if (st1.f1 == -1)
printf("st1.f1 == -1\n");
else
else
printf("st1.f1 != -1\n");
if (st1.f2 == -1)
if (st1.f2 == -1)
printf("st1.f2 == -1\n");
else
else
printf("st1.f2 != -1\n");
struct sbf2 {
@ -2428,7 +2428,7 @@ void lloptest(long long a, long long b)
a + b,
a - b,
a * b);
if (b != 0) {
printf("arith1: " LONG_LONG_FORMAT " " LONG_LONG_FORMAT "\n",
a / b,
@ -2449,7 +2449,7 @@ void lloptest(long long a, long long b)
a > b,
a >= b,
a <= b);
printf("utest: %d %d %d %d %d %d\n",
ua == ub,
ua != ub,
@ -2525,7 +2525,7 @@ long long llfunc1(int a)
}
struct S {
int id;
int id;
char item;
};
@ -2556,7 +2556,7 @@ void longlong_test(void)
b = ua;
printf(LONG_LONG_FORMAT " " LONG_LONG_FORMAT "\n", a, b);
printf(LONG_LONG_FORMAT " " LONG_LONG_FORMAT " " LONG_LONG_FORMAT " " XLONG_LONG_FORMAT "\n",
(long long)1,
(long long)1,
(long long)-2,
1LL,
0x1234567812345679ULL);
@ -2682,7 +2682,7 @@ void vprintf1(const char *fmt, ...)
va_start(aq, fmt);
va_copy(ap, aq);
p = fmt;
for(;;) {
c = *p;
@ -2927,15 +2927,15 @@ int cmpfn();
printf("cmpfn=%lx\n", (long)cmpfn);
}
void old_style_function_test(void)
{
/* recent clang versions (at least 15.0) raise an error:
incompatible pointer to integer conversion passing 'void *'
For the purpose of this test, pass 1 instead.
*/
old_style_f(1, 2, 3.0);
decl_func1(NULL);
decl_func2(NULL);
void old_style_function_test(void)
{
/* recent clang versions (at least 15.0) raise an error:
incompatible pointer to integer conversion passing 'void *'
For the purpose of this test, pass 1 instead.
*/
old_style_f(1, 2, 3.0);
decl_func1(NULL);
decl_func2(NULL);
}
void alloca_test()
@ -2962,10 +2962,10 @@ void c99_vla_test_1(int size1, int size2)
int tab1[size][2], tab2[10][2];
void *tab1_ptr, *tab2_ptr, *bad_ptr;
/* "size" should have been 'captured' at tab1 declaration,
/* "size" should have been 'captured' at tab1 declaration,
so modifying it should have no effect on VLA behaviour. */
size = size-1;
printf("Test C99 VLA 1 (sizeof): ");
printf("%s\n", (sizeof tab1 == size1 * size2 * 2 * sizeof(int)) ? "PASSED" : "FAILED");
tab1_ptr = tab1;
@ -3118,7 +3118,7 @@ void sizeof_test(void)
t <<= 16;
t <<= 16;
t++;
/* This checks that sizeof really can be used to manipulate
/* This checks that sizeof really can be used to manipulate
uintptr_t objects, without truncation. */
t2 = t & -sizeof(uintptr_t);
printf ("%lu %lu\n", t, t2);
@ -3184,15 +3184,15 @@ void statement_expr_test(void)
/* Basic stmt expr test */
a = 0;
for(i=0;i<10;i++) {
a += 1 +
( { int b, j;
b = 0;
for(j=0;j<5;j++)
b += j; b;
a += 1 +
( { int b, j;
b = 0;
for(j=0;j<5;j++)
b += j; b;
} );
}
printf("a=%d\n", a);
/* Test that symbols aren't freed prematurely.
With SYM_DEBUG valgrind will show a read from a freed
symbol, and tcc will show an (invalid) warning on the initialization
@ -4004,8 +4004,8 @@ void builtin_test(void)
}
}
#if defined _WIN32 || defined __APPLE__
void weak_test(void) {}
#if defined _WIN32 || defined __APPLE__
void weak_test(void) {}
#else
extern int __attribute__((weak)) weak_f1(void);
extern int __attribute__((weak)) weak_f2(void);
@ -4053,7 +4053,7 @@ void __attribute__((weak)) weak_test(void)
printf("weak_fpa=%d\n",&weak_fpa ? weak_fpa() : 123);
printf("weak_fpb=%d\n",&weak_fpb ? weak_fpb() : 123);
printf("weak_fpc=%d\n",&weak_fpc ? weak_fpc() : 123);
printf("weak_asm_f1=%d\n", weak_asm_f1 != NULL);
printf("weak_asm_f2=%d\n", weak_asm_f2 != NULL);
printf("weak_asm_f3=%d\n", weak_asm_f3 != NULL);
@ -4394,12 +4394,12 @@ void whitespace_test(void)
#if 1
pri\
ntf("whitspace:\n");
ntf("whitspace:\n");
#endif
pf("N=%d\n", 2);
#ifdef CORRECT_CR_HANDLING
pri\
pri\
ntf("aaa=%d\n", 3);
#endif
@ -4411,7 +4411,7 @@ ntf("min=%d\n", 4);
printf("len1=%d\n", strlen("
"));
#ifdef CORRECT_CR_HANDLING
str = "
str = "
";
printf("len1=%d str[0]=%d\n", strlen(str), str[0]);
#endif

View File

@ -1,6 +1,6 @@
#include <stdio.h>
int main()
int main()
{
int a;
a = 42;

View File

@ -1,6 +1,6 @@
#include <stdio.h>
int main()
int main()
{
printf("Hello\n");
printf("Hello\n"); /* this is a comment */ printf("Hello\n");

View File

@ -1,6 +1,6 @@
#include <stdio.h>
int main()
int main()
{
printf("Hello world\n");

View File

@ -1,6 +1,6 @@
#include <stdio.h>
int main()
int main()
{
int Count;

View File

@ -1,6 +1,6 @@
#include <stdio.h>
int main()
int main()
{
int Count;
int Array[10];

View File

@ -87,11 +87,11 @@ static void stack (void)
else if (g_counter == 5)
longjmp (buf1, 101);
else {
setjmp (buf2);
setjmp (buf2);
longjmp (buf1, 101);
}
}
way_point1--;
if (counter == 0) {

View File

@ -7,13 +7,13 @@ static const char str[] = "abcdefghijklmnopqrstuvwxyz";
void tst_branch(void)
{
printf("tst_branch --");
goto *&&a;
goto *&&a;
printf (" dummy");
a: ;
printf(" --\n");
}
void tst_void_ptr(void *pv, int i)
void tst_void_ptr(void *pv, int i)
{
i ? *pv : *pv; // dr106
}

View File

@ -69,7 +69,7 @@ int main()
OP1(func,v,e1,e2) && OP2(func,v,e1,e2) && \
OP4(func,v,e1,e2) && OP8(func,v,e1,e2) \
? "SUCCESS" : "FAIL");
int main()
{
atomic_char c;

View File

@ -48,12 +48,12 @@ int main(int argc, char **argv)
{
test();
return 1;
}
}
#elif defined test_128_exit
int main(int argc, char **argv)
{
test();
exit(2);
}
}
#endif

View File

@ -20,7 +20,7 @@ int main() {
int atomic_var = 100;
int expected = 100;
bool success = __atomic_compare_exchange_n(
&atomic_var, &expected, 200,
&atomic_var, &expected, 200,
false, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST
);
assert(success);

View File

@ -1,6 +1,6 @@
#include <stdio.h>
int factorial(int i)
int factorial(int i)
{
if (i < 2)
return i;

View File

@ -4,7 +4,7 @@
/* By Terry R. McConnell (12/2/97) */
/* Compile: cc -o hanoi hanoi.c */
/* This program does no error checking. But then, if it's right,
/* This program does no error checking. But then, if it's right,
it's right ... right ? */
@ -19,7 +19,7 @@
spike the Universe will come to an end in a large thunderclap.
This paraphrases the original legend due to DeParville, La Nature, Paris 1884,
Part I, 285-286. For this and further information see: Mathematical
Part I, 285-286. For this and further information see: Mathematical
Recreations & Essays, W.W. Rouse Ball, MacMillan, NewYork, 11th Ed. 1967,
303-305.
*
@ -40,7 +40,7 @@
/* These are the three towers. For example if the state of A is 0,1,3,4, that
* means that there are three discs on A of sizes 1, 3, and 4. (Think of right
* as being the "down" direction.) */
int A[N], B[N], C[N];
int A[N], B[N], C[N];
void Hanoi(int,int*,int*,int*);
@ -93,7 +93,7 @@ void Hanoi(int n,int *source, int *dest, int *spare)
Hanoi(n-1,source,spare,dest);
Move(source,dest);
Hanoi(n-1,spare,dest,source);
Hanoi(n-1,spare,dest,source);
return;
}

View File

@ -1,9 +1,9 @@
/* example from http://barnyard.syr.edu/quickies/led.c */
/* led.c: print out number as if on 7 line led display. I.e., write integer
given on command line like this:
_ _ _
| _| _| |_| |_
given on command line like this:
_ _ _
| _| _| |_| |_
| |_ _| | _| etc.
We assume the terminal behaves like a classical teletype. So the top
@ -35,7 +35,7 @@ cursor to a previous line.
#define NO_MAIN
/* Print the top line of the digit d into buffer.
/* Print the top line of the digit d into buffer.
Does not null terminate buffer. */
void topline(int d, char *p){
@ -61,7 +61,7 @@ void topline(int d, char *p){
*p++=' ';
}
/* Print the middle line of the digit d into the buffer.
/* Print the middle line of the digit d into the buffer.
Does not null terminate. */
void midline(int d, char *p){
@ -79,7 +79,7 @@ void midline(int d, char *p){
*p++='|';
break;
default:
*p++=' ';
*p++=' ';
}
switch(d){
@ -134,7 +134,7 @@ void botline(int d, char *p){
*p++='|';
break;
default:
*p++=' ';
*p++=' ';
}
switch(d){

View File

@ -19,6 +19,6 @@ int main()
fred(3);
return 0;
}
}
/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/

View File

@ -22,7 +22,7 @@ void joe()
printf("uh-oh\n");
}
outer:
outer:
printf("done\n");
}
@ -36,7 +36,7 @@ void henry()
{
int b;
inner:
inner:
b = 1234;
printf("b = %d\n", b);
}

View File

@ -132,10 +132,10 @@ void f() { _Generic((int (*(*)(float,char))(double,int)){0}, int:0); }
#elif defined test_array_to_str
void f() { _Generic((int(*)[3]){0}, int:0); }
#elif defined test_duplicate_def_1
static enum myenum { L = -1 } L;
static enum myenum { L = -1 } L;
#elif defined test_duplicate_def_2
void foo(void) {
static enum myenum { L = -1 } L;
static enum myenum { L = -1 } L;
}
#elif defined test_abstract_decls
int bar(const char *()); // abstract declarator here is okay

View File

@ -12,7 +12,7 @@ static void kb_wait_1(void)
would wreak havoc to the cond-expression because there's no
jump-around emitted, the whole statement expression really
needs to not generate code (perhaps except useless forward jumps). */
(1 ?
(1 ?
printf("timeout=%ld\n", timeout) :
({
int i = 1;

View File

@ -309,7 +309,7 @@ void test_init_ranges(void) {
printf ("%d\n", c);
}
/* Following is from GCC gcc.c-torture/execute/20050613-1.c. */
struct SEA { int i; int j; int k; int l; };
@ -387,7 +387,7 @@ test_init_bf(void)
printf ("%s: %d %d %d\n", __FUNCTION__, arr[0].a, arr[0].b, arr[0].c);
}
int main()
{
print(ce);

View File

@ -18,13 +18,13 @@ void smash(char *p, int n) {
int test1(int n) {
int i;
char *array_ptrs[LOOP_COUNT];
for (i = 0; i < LOOP_COUNT; ++i) {
char test[n];
smash(test, n);
array_ptrs[i] = test;
}
return (array_ptrs[0]-array_ptrs[LOOP_COUNT-1] < n) ? 0 : 1;
}

View File

@ -9,7 +9,7 @@ int fib(n)
return fib(n-1) + fib(n-2);
}
int main(int argc, char **argv)
int main(int argc, char **argv)
{
int n;
if (argc < 2) {
@ -17,7 +17,7 @@ int main(int argc, char **argv)
"Compute nth Fibonacci number\n");
return 1;
}
n = atoi(argv[1]);
printf("fib(%d) = %d\n", n, fib(n));
return 0;

View File

@ -56,7 +56,7 @@ extern void __cdecl _assert(const char *, const char *, unsigned);
#if (__STDC_VERSION__ >= 201112L) && !defined(static_assert)
/* C11, section 7.2: The macro static_assert expands to _Static_assert. */
#define static_assert(exp, str) _Static_assert(exp, str)
#define static_assert(exp, str) _Static_assert(exp, str)
#endif
#endif

View File

@ -137,7 +137,7 @@ extern "C" {
__CRT_INLINE void __inbytestring(unsigned short Port,unsigned char *Buffer,unsigned long Count)
{
__asm__ __volatile__ (
"cld ; rep ; insb "
"cld ; rep ; insb "
: "=D" (Buffer), "=c" (Count)
: "d"(Port), "0"(Buffer), "1" (Count)
);
@ -145,7 +145,7 @@ extern "C" {
__CRT_INLINE void __inwordstring(unsigned short Port,unsigned short *Buffer,unsigned long Count)
{
__asm__ __volatile__ (
"cld ; rep ; insw "
"cld ; rep ; insw "
: "=D" (Buffer), "=c" (Count)
: "d"(Port), "0"(Buffer), "1" (Count)
);
@ -153,7 +153,7 @@ extern "C" {
__CRT_INLINE void __indwordstring(unsigned short Port,unsigned long *Buffer,unsigned long Count)
{
__asm__ __volatile__ (
"cld ; rep ; insl "
"cld ; rep ; insl "
: "=D" (Buffer), "=c" (Count)
: "d"(Port), "0"(Buffer), "1" (Count)
);
@ -162,7 +162,7 @@ extern "C" {
__CRT_INLINE void __outbytestring(unsigned short Port,unsigned char *Buffer,unsigned long Count)
{
__asm__ __volatile__ (
"cld ; rep ; outsb "
"cld ; rep ; outsb "
: "=S" (Buffer), "=c" (Count)
: "d"(Port), "0"(Buffer), "1" (Count)
);
@ -170,7 +170,7 @@ extern "C" {
__CRT_INLINE void __outwordstring(unsigned short Port,unsigned short *Buffer,unsigned long Count)
{
__asm__ __volatile__ (
"cld ; rep ; outsw "
"cld ; rep ; outsw "
: "=S" (Buffer), "=c" (Count)
: "d"(Port), "0"(Buffer), "1" (Count)
);
@ -178,7 +178,7 @@ extern "C" {
__CRT_INLINE void __outdwordstring(unsigned short Port,unsigned long *Buffer,unsigned long Count)
{
__asm__ __volatile__ (
"cld ; rep ; outsl "
"cld ; rep ; outsl "
: "=S" (Buffer), "=c" (Count)
: "d"(Port), "0"(Buffer), "1" (Count)
);
@ -188,14 +188,14 @@ extern "C" {
{
unsigned __int64 value;
__asm__ __volatile__ (
"mov %%cr0, %[value]"
"mov %%cr0, %[value]"
: [value] "=q" (value));
return value;
}
/* Register sizes are different between 32/64 bit mode. So we have to do this for _WIN64 and _WIN32
separately. */
#ifdef _WIN64
__CRT_INLINE void __writecr0(unsigned __int64 Data)
{
@ -205,12 +205,12 @@ extern "C" {
: [Data] "q" (Data)
: "memory");
}
__CRT_INLINE unsigned __int64 __readcr2(void)
{
unsigned __int64 value;
__asm__ __volatile__ (
"mov %%cr2, %[value]"
"mov %%cr2, %[value]"
: [value] "=q" (value));
return value;
}
@ -223,12 +223,12 @@ extern "C" {
: [Data] "q" (Data)
: "memory");
}
__CRT_INLINE unsigned __int64 __readcr3(void)
{
unsigned __int64 value;
__asm__ __volatile__ (
"mov %%cr3, %[value]"
"mov %%cr3, %[value]"
: [value] "=q" (value));
return value;
}
@ -241,12 +241,12 @@ extern "C" {
: [Data] "q" (Data)
: "memory");
}
__CRT_INLINE unsigned __int64 __readcr4(void)
{
unsigned __int64 value;
__asm__ __volatile__ (
"mov %%cr4, %[value]"
"mov %%cr4, %[value]"
: [value] "=q" (value));
return value;
}
@ -259,12 +259,12 @@ extern "C" {
: [Data] "q" (Data)
: "memory");
}
__CRT_INLINE unsigned __int64 __readcr8(void)
{
unsigned __int64 value;
__asm__ __volatile__ (
"mov %%cr8, %[value]"
"mov %%cr8, %[value]"
: [value] "=q" (value));
return value;
}
@ -277,7 +277,7 @@ extern "C" {
: [Data] "q" (Data)
: "memory");
}
#elif defined(_WIN32)
__CRT_INLINE void __writecr0(unsigned Data)
@ -288,12 +288,12 @@ extern "C" {
: [Data] "q" (Data)
: "memory");
}
__CRT_INLINE unsigned long __readcr2(void)
{
unsigned long value;
__asm__ __volatile__ (
"mov %%cr2, %[value]"
"mov %%cr2, %[value]"
: [value] "=q" (value));
return value;
}
@ -306,12 +306,12 @@ extern "C" {
: [Data] "q" (Data)
: "memory");
}
__CRT_INLINE unsigned long __readcr3(void)
{
unsigned long value;
__asm__ __volatile__ (
"mov %%cr3, %[value]"
"mov %%cr3, %[value]"
: [value] "=q" (value));
return value;
}
@ -324,12 +324,12 @@ extern "C" {
: [Data] "q" (Data)
: "memory");
}
__CRT_INLINE unsigned long __readcr4(void)
{
unsigned long value;
__asm__ __volatile__ (
"mov %%cr4, %[value]"
"mov %%cr4, %[value]"
: [value] "=q" (value));
return value;
}
@ -342,11 +342,11 @@ extern "C" {
: [Data] "q" (Data)
: "memory");
}
__CRT_INLINE unsigned long __readcr8(void)
{
unsigned long value; __asm__ __volatile__ (
"mov %%cr8, %[value]"
"mov %%cr8, %[value]"
: [value] "=q" (value));
return value;
}
@ -359,7 +359,7 @@ extern "C" {
: [Data] "q" (Data)
: "memory");
}
#endif
__CRT_INLINE unsigned __int64 __readmsr(unsigned long msr)
@ -380,12 +380,12 @@ extern "C" {
:
: "c" (msr), "a" (val1), "d" (val2));
}
__CRT_INLINE unsigned __int64 __rdtsc(void)
{
unsigned __int64 val1, val2;
__asm__ __volatile__ (
"rdtsc"
"rdtsc"
: "=a" (val1), "=d" (val2));
return val1 | (val2 << 32);
}

View File

@ -3,7 +3,7 @@
* This file is part of the w64 mingw-runtime package.
* No warranty is given; refer to the file DISCLAIMER within this package.
*/
/*
/*
* dir.h
*
* This file OBSOLESCENT and only provided for backward compatibility.

View File

@ -51,12 +51,12 @@ typedef struct
unsigned short __status_word;
unsigned short __unused1;
unsigned short __tag_word;
unsigned short __unused2;
unsigned short __unused2;
unsigned int __ip_offset; /* instruction pointer offset */
unsigned short __ip_selector;
unsigned short __ip_selector;
unsigned short __opcode;
unsigned int __data_offset;
unsigned short __data_selector;
unsigned short __data_selector;
unsigned short __unused3;
unsigned int __mxcsr; /* contents of the MXCSR register */
} fenv_t;
@ -64,7 +64,7 @@ typedef struct
/*The C99 standard (7.6.9) allows us to define implementation-specific macros for
different fp environments */
/* The default Intel x87 floating point environment (64-bit mantissa) */
#define FE_PC64_ENV ((const fenv_t *)-1)

View File

@ -25,7 +25,7 @@ typedef struct {
#if !defined(__cplusplus) || defined(__STDC_FORMAT_MACROS)
/* 7.8.1 Macros for format specifiers
*
*
* MS runtime does not yet understand C9x standard "ll"
* length specifier. It appears to treat "ll" as "l".
* The non-standard I64 length specifier causes warning in GCC,
@ -245,7 +245,7 @@ typedef struct {
#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
/*
* no length modifier for char types prior to C9x
* MS runtime scanf appears to treat "hh" as "h"
* MS runtime scanf appears to treat "hh" as "h"
*/
/* signed char */

View File

@ -231,8 +231,8 @@ extern "C" {
/*
We can't __CRT_INLINE float or double, because we want to ensure truncation
to semantic type before classification.
(A normal long double value might become subnormal when
to semantic type before classification.
(A normal long double value might become subnormal when
converted to double, and zero when converted to float.)
*/
@ -310,7 +310,7 @@ extern "C" {
extern long double __cdecl scalblnl (long double, long);
/* 7.12.7.1 */
/* Implementations adapted from Cephes versions */
/* Implementations adapted from Cephes versions */
extern double __cdecl cbrt (double);
extern float __cdecl cbrtf (float);
extern long double __cdecl cbrtl (long double);
@ -336,14 +336,14 @@ extern "C" {
extern float __cdecl erff (float);
/* TODO
extern long double __cdecl erfl (long double);
*/
*/
/* 7.12.8.2 The erfc functions */
extern double __cdecl erfc (double);
extern float __cdecl erfcf (float);
/* TODO
extern long double __cdecl erfcl (long double);
*/
*/
/* 7.12.8.3 The lgamma functions */
extern double __cdecl lgamma (double);
@ -412,7 +412,7 @@ extern "C" {
extern long double __cdecl fmodl (long double, long double);
/* 7.12.10.2 */
/* 7.12.10.2 */
extern double __cdecl remainder (double, double);
extern float __cdecl remainderf (float, float);
extern long double __cdecl remainderl (long double, long double);
@ -467,7 +467,7 @@ extern "C" {
extern long double __cdecl fminl (long double, long double);
/* 7.12.13.1 */
/* return x * y + z as a ternary op */
/* return x * y + z as a ternary op */
extern double __cdecl fma (double, double, double);
extern float __cdecl fmaf (float, float, float);
extern long double __cdecl fmal (long double, long double, long double);
@ -482,11 +482,11 @@ extern "C" {
#pragma pack(pop)
/* 7.12.14 */
/*
/*
* With these functions, comparisons involving quiet NaNs set the FP
* condition code to "unordered". The IEEE floating-point spec
* dictates that the result of floating-point comparisons should be
* false whenever a NaN is involved, with the exception of the != op,
* false whenever a NaN is involved, with the exception of the != op,
* which always returns true: yes, (NaN != NaN) is true).
*/

View File

@ -583,13 +583,13 @@ extern "C" {
enum SYSGEOCLASS {
GEOCLASS_NATION = 16,GEOCLASS_REGION = 14
};
typedef enum _NORM_FORM {
NormalizationOther = 0,
NormalizationC = 0x1,
NormalizationD = 0x2,
NormalizationKC = 0x5,
NormalizationKD = 0x6
NormalizationKD = 0x6
} NORM_FORM;
typedef WINBOOL (CALLBACK *LANGUAGEGROUP_ENUMPROCA)(LGRPID,LPSTR,LPSTR,DWORD,LONG_PTR);

View File

@ -5147,7 +5147,7 @@ extern "C" {
#endif
#endif
#ifdef UNICODE
#ifdef UNICODE
#define GetMonitorInfo GetMonitorInfoW
#else
#define GetMonitorInfo GetMonitorInfoA

View File

@ -108,7 +108,7 @@ ALT(DEF_ASM_OP2(lzcntw, 0xf30fbd, 0, OPC_MODRM | OPC_WLX, OPT_REGW | OPT_EA, OPT
DEF_ASM_OP0(ud2, 0x0f0b)
/* NOTE: we took the same order as gas opcode definition order */
/* Right now we can't express the fact that 0xa1/0xa3 can't use $eax and a
/* Right now we can't express the fact that 0xa1/0xa3 can't use $eax and a
32 bit moffset as operands.
ALT(DEF_ASM_OP2(movb, 0xa0, 0, OPC_BWLX, OPT_ADDR, OPT_EAX))
ALT(DEF_ASM_OP2(movb, 0xa2, 0, OPC_BWLX, OPT_EAX, OPT_ADDR)) */

View File

@ -701,7 +701,7 @@ static void gen_bounds_epilog(void)
bounds_ptr = section_ptr_add(lbounds_section, sizeof(addr_t));
*bounds_ptr = 0;
sym_data = get_sym_ref(&char_pointer_type, lbounds_section,
sym_data = get_sym_ref(&char_pointer_type, lbounds_section,
func_bound_offset, PTR_SIZE);
/* generate bound local allocation */
@ -826,7 +826,7 @@ void gfunc_call(int nb_args)
struct_size = args_size;
for(i = 0; i < nb_args; i++) {
SValue *sv;
--arg;
sv = &vtop[-i];
bt = (sv->type.t & VT_BTYPE);
@ -901,7 +901,7 @@ void gfunc_call(int nb_args)
vtop->type.t = size > 4 ? VT_LLONG : size > 2 ? VT_INT
: size > 1 ? VT_SHORT : VT_BYTE;
}
r = gv(RC_INT);
if (arg >= REGN) {
gen_offs_sp(0x89, r, arg*8);
@ -922,7 +922,7 @@ void gfunc_call(int nb_args)
o(0xda894c); /* mov %r11, %rdx */
}
}
gcall_or_jmp(0);
if ((vtop->r & VT_SYM) && vtop->sym->v == TOK_alloca) {
@ -1097,10 +1097,10 @@ static X86_64_Mode classify_x86_64_inner(CType *ty)
{
X86_64_Mode mode;
Sym *f;
switch (ty->t & VT_BTYPE) {
case VT_VOID: return x86_64_mode_none;
case VT_INT:
case VT_BYTE:
case VT_SHORT:
@ -1109,19 +1109,19 @@ static X86_64_Mode classify_x86_64_inner(CType *ty)
case VT_PTR:
case VT_FUNC:
return x86_64_mode_integer;
case VT_FLOAT:
case VT_DOUBLE: return x86_64_mode_sse;
case VT_LDOUBLE: return x86_64_mode_x87;
case VT_STRUCT:
f = ty->ref;
mode = x86_64_mode_none;
for (f = f->next; f; f = f->next)
mode = classify_x86_64_merge(mode, classify_x86_64_inner(&f->type));
return mode;
}
assert(0);
@ -1132,7 +1132,7 @@ static X86_64_Mode classify_x86_64_arg(CType *ty, CType *ret, int *psize, int *p
{
X86_64_Mode mode;
int size, align, ret_t = 0;
if (ty->t & (VT_BITFIELD|VT_ARRAY)) {
*psize = 8;
*palign = 8;
@ -1168,7 +1168,7 @@ static X86_64_Mode classify_x86_64_arg(CType *ty, CType *ret, int *psize, int *p
ret_t |= VT_UNSIGNED;
}
break;
case x86_64_mode_x87:
*reg_count = 1;
ret_t = VT_LDOUBLE;
@ -1187,12 +1187,12 @@ static X86_64_Mode classify_x86_64_arg(CType *ty, CType *ret, int *psize, int *p
}
}
}
if (ret) {
ret->ref = NULL;
ret->t = ret_t;
}
return mode;
}
@ -1477,13 +1477,13 @@ void gfunc_prolog(Sym *func_sym)
stack_arg:
seen_stack_size = ((seen_stack_size + align - 1) & -align) + size;
break;
case x86_64_mode_integer:
if (seen_reg_num + reg_count > REGN)
goto stack_arg;
seen_reg_num += reg_count;
break;
case x86_64_mode_sse:
if (seen_sse_num + reg_count > 8)
goto stack_arg;
@ -1561,14 +1561,14 @@ void gfunc_prolog(Sym *func_sym)
addr += size;
}
break;
case x86_64_mode_memory:
case x86_64_mode_x87:
addr = (addr + align - 1) & -align;
param_addr = addr;
addr += size;
break;
case x86_64_mode_integer: {
if (reg_param_index + reg_count <= REGN) {
/* save arguments passed by register */
@ -1962,7 +1962,7 @@ void gen_opf(int op)
vswap();
}
assert(!(vtop[-1].r & VT_LVAL));
if ((vtop->type.t & VT_BTYPE) == VT_DOUBLE)
o(0x66);
if (op == TOK_EQ || op == TOK_NE)
@ -1999,7 +1999,7 @@ void gen_opf(int op)
ft = vtop->type.t;
fc = vtop->c.i;
assert((ft & VT_BTYPE) != VT_LDOUBLE);
r = vtop->r;
/* if saved lvalue, then we must reload it */
if ((vtop->r & VT_VALMASK) == VT_LLOCAL) {
@ -2013,7 +2013,7 @@ void gen_opf(int op)
fc = 0;
vtop->r = r = r | VT_LVAL;
}
assert(!(vtop[-1].r & VT_LVAL));
if (swapped) {
assert(vtop->r & VT_LVAL);
@ -2022,7 +2022,7 @@ void gen_opf(int op)
fc = vtop->c.i; /* bcheck may have saved previous vtop[-1] */
r = vtop->r;
}
if ((ft & VT_BTYPE) == VT_DOUBLE) {
o(0xf2);
} else {
@ -2030,7 +2030,7 @@ void gen_opf(int op)
}
o(0x0f);
o(0x58 + a);
if (vtop->r & VT_LVAL) {
gen_modrm(vtop[-1].r, r, vtop->sym, fc);
} else {
@ -2093,7 +2093,7 @@ void gen_cvt_ftof(int t)
ft = vtop->type.t;
bt = ft & VT_BTYPE;
tbt = t & VT_BTYPE;
if (bt == VT_FLOAT) {
gv(RC_FLOAT);
if (tbt == VT_DOUBLE) {