Add Visual Studio processor identification
Unified · Split
| @@ -135,7 +135,7 @@ BOOL WINAPI DllMain (HINSTANCE hDll, DWORD dwReason, LPVOID lpReserved) · 134 unmodified lines | |||
| 135 | 135 | ||
| 136 | /********************************************************/ | 136 | /********************************************************/ |
| 137 | /* copy a string and truncate it. */ | 137 | /* copy a string and truncate it. */ |
| 138 | PUB_FUNC char *pstrcpy(char *buf, int buf_size, const char *s) | 138 | ST_FUNC char *pstrcpy(char *buf, int buf_size, const char *s) |
| 139 | { | 139 | { |
| 140 | char *q, *q_end; | 140 | char *q, *q_end; |
| 141 | int c; | 141 | int c; |
| @@ -155,7 +155,7 @@ PUB_FUNC char *pstrcpy(char *buf, int buf_size, const char *s) · 13 unmodified lines | |||
| 155 | } | 155 | } |
| 156 | 156 | ||
| 157 | /* strcat and truncate. */ | 157 | /* strcat and truncate. */ |
| 158 | PUB_FUNC char *pstrcat(char *buf, int buf_size, const char *s) | 158 | ST_FUNC char *pstrcat(char *buf, int buf_size, const char *s) |
| 159 | { | 159 | { |
| 160 | int len; | 160 | int len; |
| 161 | len = strlen(buf); | 161 | len = strlen(buf); |
| @@ -164,7 +164,7 @@ PUB_FUNC char *pstrcat(char *buf, int buf_size, const char *s) · 2 unmodified lines | |||
| 164 | return buf; | 164 | return buf; |
| 165 | } | 165 | } |
| 166 | 166 | ||
| 167 | PUB_FUNC char *pstrncpy(char *out, const char *in, size_t num) | 167 | ST_FUNC char *pstrncpy(char *out, const char *in, size_t num) |
| 168 | { | 168 | { |
| 169 | memcpy(out, in, num); | 169 | memcpy(out, in, num); |
| 170 | out[num] = '\0'; | 170 | out[num] = '\0'; |
| @@ -1544,7 +1544,7 @@ typedef struct stat file_info_t; · 1373 unmodified lines | |||
| 1544 | typedef BY_HANDLE_FILE_INFORMATION file_info_t; | 1544 | typedef BY_HANDLE_FILE_INFORMATION file_info_t; |
| 1545 | #endif | 1545 | #endif |
| 1546 | 1546 | ||
| 1547 | int get_file_info(const char *fname, file_info_t *out_info) | 1547 | static int get_file_info(const char *fname, file_info_t *out_info) |
| 1548 | { | 1548 | { |
| 1549 | #ifndef _WIN32 | 1549 | #ifndef _WIN32 |
| 1550 | return stat(fname, out_info); | 1550 | return stat(fname, out_info); |
| @@ -1561,7 +1561,7 @@ int get_file_info(const char *fname, file_info_t *out_info) · 10 unmodified lines | |||
| 1561 | #endif | 1561 | #endif |
| 1562 | } | 1562 | } |
| 1563 | 1563 | ||
| 1564 | int is_dir(file_info_t *info) | 1564 | static int is_dir(file_info_t *info) |
| 1565 | { | 1565 | { |
| 1566 | #ifndef _WIN32 | 1566 | #ifndef _WIN32 |
| 1567 | return S_ISDIR(info->st_mode); | 1567 | return S_ISDIR(info->st_mode); |
| @@ -1571,7 +1571,7 @@ int is_dir(file_info_t *info) · 3 unmodified lines | |||
| 1571 | #endif | 1571 | #endif |
| 1572 | } | 1572 | } |
| 1573 | 1573 | ||
| 1574 | int is_same_file(const file_info_t *fi1, const file_info_t *fi2) | 1574 | static int is_same_file(const file_info_t *fi1, const file_info_t *fi2) |
| 1575 | { | 1575 | { |
| 1576 | #ifndef _WIN32 | 1576 | #ifndef _WIN32 |
| 1577 | return fi1->st_dev == fi2->st_dev && | 1577 | return fi1->st_dev == fi2->st_dev && |
| @@ -1167,9 +1167,9 @@ ST_DATA struct TCCState *tcc_state; · 1166 unmodified lines | |||
| 1167 | #define AFF_PREPROCESS 0x0004 /* preprocess file */ | 1167 | #define AFF_PREPROCESS 0x0004 /* preprocess file */ |
| 1168 | 1168 | ||
| 1169 | /* public functions currently used by the tcc main function */ | 1169 | /* public functions currently used by the tcc main function */ |
| 1170 | PUB_FUNC char *pstrcpy(char *buf, int buf_size, const char *s); | 1170 | ST_FUNC char *pstrcpy(char *buf, int buf_size, const char *s); |
| 1171 | PUB_FUNC char *pstrcat(char *buf, int buf_size, const char *s); | 1171 | ST_FUNC char *pstrcat(char *buf, int buf_size, const char *s); |
| 1172 | PUB_FUNC char *pstrncpy(char *out, const char *in, size_t num); | 1172 | ST_FUNC char *pstrncpy(char *out, const char *in, size_t num); |
| 1173 | PUB_FUNC char *tcc_basename(const char *name); | 1173 | PUB_FUNC char *tcc_basename(const char *name); |
| 1174 | PUB_FUNC char *tcc_fileextension (const char *name); | 1174 | PUB_FUNC char *tcc_fileextension (const char *name); |
| 1175 | 1175 | ||
| @@ -1729,7 +1729,7 @@ static void tcc_output_binary(TCCState *s1, FILE *f, · 1728 unmodified lines | |||
| 1729 | #define EXTRA_RELITEMS 14 | 1729 | #define EXTRA_RELITEMS 14 |
| 1730 | 1730 | ||
| 1731 | /* move the relocation value from .dynsym to .got */ | 1731 | /* move the relocation value from .dynsym to .got */ |
| 1732 | void patch_dynsym_undef(TCCState *s1, Section *s) | 1732 | static void patch_dynsym_undef(TCCState *s1, Section *s) |
| 1733 | { | 1733 | { |
| 1734 | uint32_t *gotd = (void *)s1->got->data; | 1734 | uint32_t *gotd = (void *)s1->got->data; |
| 1735 | ElfW(Sym) *sym; | 1735 | ElfW(Sym) *sym; |
| @@ -1748,7 +1748,7 @@ void patch_dynsym_undef(TCCState *s1, Section *s) · 12 unmodified lines | |||
| 1748 | #define EXTRA_RELITEMS 9 | 1748 | #define EXTRA_RELITEMS 9 |
| 1749 | 1749 | ||
| 1750 | /* zero plt offsets of weak symbols in .dynsym */ | 1750 | /* zero plt offsets of weak symbols in .dynsym */ |
| 1751 | void patch_dynsym_undef(TCCState *s1, Section *s) | 1751 | static void patch_dynsym_undef(TCCState *s1, Section *s) |
| 1752 | { | 1752 | { |
| 1753 | ElfW(Sym) *sym; | 1753 | ElfW(Sym) *sym; |
| 1754 | 1754 | ||
| @@ -2048,7 +2048,7 @@ static void parse_escape_string(CString *outstr, const uint8_t *buf, int is_long · 2047 unmodified lines | |||
| 2048 | cstr_wccat(outstr, '\0'); | 2048 | cstr_wccat(outstr, '\0'); |
| 2049 | } | 2049 | } |
| 2050 | 2050 | ||
| 2051 | void parse_string(const char *s, int len) | 2051 | static void parse_string(const char *s, int len) |
| 2052 | { | 2052 | { |
| 2053 | uint8_t buf[1000], *p = buf; | 2053 | uint8_t buf[1000], *p = buf; |
| 2054 | int is_long, sep; | 2054 | int is_long, sep; |
| @@ -3208,7 +3208,7 @@ static int macro_subst_tok( · 1153 unmodified lines | |||
| 3208 | return 0; | 3208 | return 0; |
| 3209 | } | 3209 | } |
| 3210 | 3210 | ||
| 3211 | int paste_tokens(int t1, CValue *v1, int t2, CValue *v2) | 3211 | static int paste_tokens(int t1, CValue *v1, int t2, CValue *v2) |
| 3212 | { | 3212 | { |
| 3213 | CString cstr; | 3213 | CString cstr; |
| 3214 | int n; | 3214 | int n; |
| @@ -156,7 +156,7 @@ static unsigned long func_sub_sp_offset; · 155 unmodified lines | |||
| 156 | static int func_ret_sub; | 156 | static int func_ret_sub; |
| 157 | 157 | ||
| 158 | /* XXX: make it faster ? */ | 158 | /* XXX: make it faster ? */ |
| 159 | void g(int c) | 159 | ST_FUNC void g(int c) |
| 160 | { | 160 | { |
| 161 | int ind1; | 161 | int ind1; |
| 162 | ind1 = ind + 1; | 162 | ind1 = ind + 1; |
| @@ -166,7 +166,7 @@ void g(int c) · 3 unmodified lines | |||
| 166 | ind = ind1; | 166 | ind = ind1; |
| 167 | } | 167 | } |
| 168 | 168 | ||
| 169 | void o(unsigned int c) | 169 | ST_FUNC void o(unsigned int c) |
| 170 | { | 170 | { |
| 171 | while (c) { | 171 | while (c) { |
| 172 | g(c); | 172 | g(c); |
| @@ -174,13 +174,13 @@ void o(unsigned int c) · 1 unmodified line | |||
| 174 | } | 174 | } |
| 175 | } | 175 | } |
| 176 | 176 | ||
| 177 | void gen_le16(int v) | 177 | ST_FUNC void gen_le16(int v) |
| 178 | { | 178 | { |
| 179 | g(v); | 179 | g(v); |
| 180 | g(v >> 8); | 180 | g(v >> 8); |
| 181 | } | 181 | } |
| 182 | 182 | ||
| 183 | void gen_le32(int c) | 183 | ST_FUNC void gen_le32(int c) |
| 184 | { | 184 | { |
| 185 | g(c); | 185 | g(c); |
| 186 | g(c >> 8); | 186 | g(c >> 8); |
| @@ -188,7 +188,7 @@ void gen_le32(int c) · 1 unmodified line | |||
| 188 | g(c >> 24); | 188 | g(c >> 24); |
| 189 | } | 189 | } |
| 190 | 190 | ||
| 191 | void gen_le64(int64_t c) | 191 | ST_FUNC void gen_le64(int64_t c) |
| 192 | { | 192 | { |
| 193 | g(c); | 193 | g(c); |
| 194 | g(c >> 8); | 194 | g(c >> 8); |
| @@ -200,7 +200,7 @@ void gen_le64(int64_t c) · 5 unmodified lines | |||
| 200 | g(c >> 56); | 200 | g(c >> 56); |
| 201 | } | 201 | } |
| 202 | 202 | ||
| 203 | void orex(int ll, int r, int r2, int b) | 203 | static void orex(int ll, int r, int r2, int b) |
| 204 | { | 204 | { |
| 205 | if ((r & VT_VALMASK) >= VT_CONST) | 205 | if ((r & VT_VALMASK) >= VT_CONST) |
| 206 | r = 0; | 206 | r = 0; |
| @@ -212,7 +212,7 @@ void orex(int ll, int r, int r2, int b) · 5 unmodified lines | |||
| 212 | } | 212 | } |
| 213 | 213 | ||
| 214 | /* output a symbol and patch all calls to it */ | 214 | /* output a symbol and patch all calls to it */ |
| 215 | void gsym_addr(int t, int a) | 215 | ST_FUNC void gsym_addr(int t, int a) |
| 216 | { | 216 | { |
| 217 | while (t) { | 217 | while (t) { |
| 218 | unsigned char *ptr = cur_text_section->data + t; | 218 | unsigned char *ptr = cur_text_section->data + t; |