Rein in unintended external functions.

master
Jean-Claude Beaudoin 2016-09-25 22:32:41 -04:00
parent e38f49e32a
commit ff158bffe6
5 changed files with 20 additions and 20 deletions

View File

@ -135,7 +135,7 @@ BOOL WINAPI DllMain (HINSTANCE hDll, DWORD dwReason, LPVOID lpReserved)
/********************************************************/
/* copy a string and truncate it. */
PUB_FUNC char *pstrcpy(char *buf, int buf_size, const char *s)
ST_FUNC char *pstrcpy(char *buf, int buf_size, const char *s)
{
char *q, *q_end;
int c;
@ -155,7 +155,7 @@ PUB_FUNC char *pstrcpy(char *buf, int buf_size, const char *s)
}
/* strcat and truncate. */
PUB_FUNC char *pstrcat(char *buf, int buf_size, const char *s)
ST_FUNC char *pstrcat(char *buf, int buf_size, const char *s)
{
int len;
len = strlen(buf);
@ -164,7 +164,7 @@ PUB_FUNC char *pstrcat(char *buf, int buf_size, const char *s)
return buf;
}
PUB_FUNC char *pstrncpy(char *out, const char *in, size_t num)
ST_FUNC char *pstrncpy(char *out, const char *in, size_t num)
{
memcpy(out, in, num);
out[num] = '\0';
@ -1538,7 +1538,7 @@ typedef struct stat file_info_t;
typedef BY_HANDLE_FILE_INFORMATION file_info_t;
#endif
int get_file_info(const char *fname, file_info_t *out_info)
static int get_file_info(const char *fname, file_info_t *out_info)
{
#ifndef _WIN32
return stat(fname, out_info);
@ -1555,7 +1555,7 @@ int get_file_info(const char *fname, file_info_t *out_info)
#endif
}
int is_dir(file_info_t *info)
static int is_dir(file_info_t *info)
{
#ifndef _WIN32
return S_ISDIR(info->st_mode);
@ -1565,7 +1565,7 @@ int is_dir(file_info_t *info)
#endif
}
int is_same_file(const file_info_t *fi1, const file_info_t *fi2)
static int is_same_file(const file_info_t *fi1, const file_info_t *fi2)
{
#ifndef _WIN32
return fi1->st_dev == fi2->st_dev &&

6
tcc.h
View File

@ -1167,9 +1167,9 @@ ST_DATA struct TCCState *tcc_state;
#define AFF_PREPROCESS 0x0004 /* preprocess file */
/* public functions currently used by the tcc main function */
PUB_FUNC char *pstrcpy(char *buf, int buf_size, const char *s);
PUB_FUNC char *pstrcat(char *buf, int buf_size, const char *s);
PUB_FUNC char *pstrncpy(char *out, const char *in, size_t num);
ST_FUNC char *pstrcpy(char *buf, int buf_size, const char *s);
ST_FUNC char *pstrcat(char *buf, int buf_size, const char *s);
ST_FUNC char *pstrncpy(char *out, const char *in, size_t num);
PUB_FUNC char *tcc_basename(const char *name);
PUB_FUNC char *tcc_fileextension (const char *name);

View File

@ -1729,7 +1729,7 @@ static void tcc_output_binary(TCCState *s1, FILE *f,
#define EXTRA_RELITEMS 14
/* move the relocation value from .dynsym to .got */
void patch_dynsym_undef(TCCState *s1, Section *s)
static void patch_dynsym_undef(TCCState *s1, Section *s)
{
uint32_t *gotd = (void *)s1->got->data;
ElfW(Sym) *sym;
@ -1748,7 +1748,7 @@ void patch_dynsym_undef(TCCState *s1, Section *s)
#define EXTRA_RELITEMS 9
/* zero plt offsets of weak symbols in .dynsym */
void patch_dynsym_undef(TCCState *s1, Section *s)
static void patch_dynsym_undef(TCCState *s1, Section *s)
{
ElfW(Sym) *sym;

View File

@ -2048,7 +2048,7 @@ static void parse_escape_string(CString *outstr, const uint8_t *buf, int is_long
cstr_wccat(outstr, '\0');
}
void parse_string(const char *s, int len)
static void parse_string(const char *s, int len)
{
uint8_t buf[1000], *p = buf;
int is_long, sep;
@ -3208,7 +3208,7 @@ static int macro_subst_tok(
return 0;
}
int paste_tokens(int t1, CValue *v1, int t2, CValue *v2)
static int paste_tokens(int t1, CValue *v1, int t2, CValue *v2)
{
CString cstr;
int n;

View File

@ -156,7 +156,7 @@ static unsigned long func_sub_sp_offset;
static int func_ret_sub;
/* XXX: make it faster ? */
void g(int c)
ST_FUNC void g(int c)
{
int ind1;
ind1 = ind + 1;
@ -166,7 +166,7 @@ void g(int c)
ind = ind1;
}
void o(unsigned int c)
ST_FUNC void o(unsigned int c)
{
while (c) {
g(c);
@ -174,13 +174,13 @@ void o(unsigned int c)
}
}
void gen_le16(int v)
ST_FUNC void gen_le16(int v)
{
g(v);
g(v >> 8);
}
void gen_le32(int c)
ST_FUNC void gen_le32(int c)
{
g(c);
g(c >> 8);
@ -188,7 +188,7 @@ void gen_le32(int c)
g(c >> 24);
}
void gen_le64(int64_t c)
ST_FUNC void gen_le64(int64_t c)
{
g(c);
g(c >> 8);
@ -200,7 +200,7 @@ void gen_le64(int64_t c)
g(c >> 56);
}
void orex(int ll, int r, int r2, int b)
static void orex(int ll, int r, int r2, int b)
{
if ((r & VT_VALMASK) >= VT_CONST)
r = 0;
@ -212,7 +212,7 @@ void orex(int ll, int r, int r2, int b)
}
/* output a symbol and patch all calls to it */
void gsym_addr(int t, int a)
ST_FUNC void gsym_addr(int t, int a)
{
while (t) {
unsigned char *ptr = cur_text_section->data + t;