Trim trailing spaces everywhere.

This commit is contained in:
gus knight
2015-07-27 12:43:40 -04:00
parent 5e67f24e6b
commit 41031221c8
27 changed files with 430 additions and 430 deletions

72
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
@ -50,7 +50,7 @@ static unsigned char isidnum_table[256 - CH_EOF];
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
@ -221,7 +221,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 */
@ -255,7 +255,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]);
@ -511,7 +511,7 @@ static int handle_stray1(uint8_t *p)
ST_FUNC void minp(void)
{
inp();
if (ch == '\\')
if (ch == '\\')
handle_stray();
}
@ -557,7 +557,7 @@ static uint8_t *parse_line_comment(uint8_t *p)
ST_FUNC uint8_t *parse_comment(uint8_t *p)
{
int c;
p++;
for(;;) {
/* fast skip loop */
@ -635,13 +635,13 @@ static inline void skip_spaces(void)
cinp();
}
static inline int check_space(int t, int *spc)
static inline int check_space(int t, int *spc)
{
if (t < 256 && (isidnum_table[t - CH_EOF] & IS_SPC)) {
if (*spc)
if (*spc)
return 1;
*spc = 1;
} else
} else
*spc = 0;
return 0;
}
@ -774,7 +774,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)
@ -930,7 +930,7 @@ static void tok_str_add2(TokenString *s, int t, CValue *cv)
cstr->size = cv->cstr->size;
cstr->data_allocated = NULL;
cstr->size_allocated = cstr->size;
memcpy((char *)cstr + sizeof(CString),
memcpy((char *)cstr + sizeof(CString),
cv->cstr->data, cstr->size);
len += nb_words;
}
@ -1253,14 +1253,14 @@ static int expr_preprocess(void)
{
int c, t;
TokenString str;
tok_str_new(&str);
while (tok != TOK_LINEFEED && tok != TOK_EOF) {
next(); /* do macro subst */
if (tok == TOK_DEFINED) {
next_nomacro();
t = tok;
if (t == '(')
if (t == '(')
next_nomacro();
c = define_find(tok) != 0;
if (t == '(')
@ -1914,7 +1914,7 @@ static void parse_escape_string(CString *outstr, const uint8_t *buf, int is_long
break;
case '\'':
case '\"':
case '\\':
case '\\':
case '?':
break;
default:
@ -2070,7 +2070,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;
@ -2126,7 +2126,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 */
d = (double)bn[1] * 4294967296.0 + (double)bn[0];
@ -2363,7 +2363,7 @@ static inline void next_nomacro1(void)
} else {
tok_flags &= ~TOK_FLAG_EOF;
/* pop include file */
/* test if previous '#endif' was after a #ifdef at
start of file */
if (tok_flags & TOK_FLAG_ENDIF) {
@ -2400,7 +2400,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)) {
file->buf_ptr = p;
preprocess(tok_flags & TOK_FLAG_BOF);
@ -2420,7 +2420,7 @@ maybe_newline:
}
}
break;
/* dollar is allowed to start identifiers when not parsing asm */
case '$':
if (!(isidnum_table[c - CH_EOF] & IS_ID)
@ -2433,14 +2433,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;
@ -2594,7 +2594,7 @@ maybe_newline:
tok = TOK_GT;
}
break;
case '&':
PEEKC(c, p);
if (c == '&') {
@ -2607,7 +2607,7 @@ maybe_newline:
tok = '&';
}
break;
case '|':
PEEKC(c, p);
if (c == '|') {
@ -2633,7 +2633,7 @@ maybe_newline:
tok = '+';
}
break;
case '-':
PEEKC(c, p);
if (c == '-') {
@ -2655,7 +2655,7 @@ maybe_newline:
PARSE2('*', '*', '=', TOK_A_MUL)
PARSE2('%', '%', '=', TOK_A_MOD)
PARSE2('^', '^', '=', TOK_A_XOR)
/* comments or operator */
case '/':
PEEKC(c, p);
@ -2675,7 +2675,7 @@ maybe_newline:
tok = '/';
}
break;
/* simple tokens */
case '(':
case ')':
@ -2730,7 +2730,7 @@ ST_FUNC void next_nomacro(void)
next_nomacro_spc();
} while (tok < 256 && (isidnum_table[tok - CH_EOF] & IS_SPC));
}
static void macro_subst(
TokenString *tok_str,
@ -2924,7 +2924,7 @@ static int macro_subst_tok(
CValue cval;
CString cstr;
char buf[32];
/* if symbol is a macro, prepare substitution */
/* special macros */
if (tok == TOK___LINE__) {
@ -2942,10 +2942,10 @@ static int macro_subst_tok(
time(&ti);
tm = localtime(&ti);
if (tok == TOK___DATE__) {
snprintf(buf, sizeof(buf), "%s %2d %d",
snprintf(buf, sizeof(buf), "%s %2d %d",
ab_month_name[tm->tm_mon], tm->tm_mday, tm->tm_year + 1900);
} else {
snprintf(buf, sizeof(buf), "%02d:%02d:%02d",
snprintf(buf, sizeof(buf), "%02d:%02d:%02d",
tm->tm_hour, tm->tm_min, tm->tm_sec);
}
cstrval = buf;
@ -3010,8 +3010,8 @@ static int macro_subst_tok(
tok_str_new(&str);
parlevel = spc = 0;
/* NOTE: non zero sa->t indicates VA_ARGS */
while ((parlevel > 0 ||
(tok != ')' &&
while ((parlevel > 0 ||
(tok != ')' &&
(tok != ',' || sa->type.t)))) {
if (tok == TOK_EOF || tok == 0)
break;
@ -3143,7 +3143,7 @@ static inline int *macro_twosharps(const int *ptr0)
/* given 'a##b', remove nosubsts preceding 'b' */
while ((t1 = *++ptr) == TOK_NOSUBST)
;
if (t1 && t1 != TOK_TWOSHARPS
if (t1 && t1 != TOK_TWOSHARPS
&& t1 != ':') /* 'a##:' don't build a new token */
{
TOK_GET(&t1, &ptr, &cv1);
@ -3181,7 +3181,7 @@ static void macro_subst(
int t, spc, nosubst;
CValue cval;
int *macro_str1 = NULL;
/* first scan for '##' operator handling */
ptr = macro_str;
spc = nosubst = 0;
@ -3334,7 +3334,7 @@ ST_FUNC void preprocess_new(void)
: 0;
memset(hash_ident, 0, TOK_HASH_SIZE * sizeof(TokenSym *));
tok_ident = TOK_IDENT;
p = tcc_keywords;
while (*p) {