mirror of
https://github.com/mirror/tinycc.git
synced 2025-02-04 06:30:10 +08:00
Just warn about unknown directives, define __STDC_VERSION__=199901L
This commit is contained in:
parent
5342b32eef
commit
3667408a57
@ -1,7 +1,10 @@
|
||||
version 0.9.24:
|
||||
|
||||
- Just warn about unknown directives, ignore quotes in #error/#warning
|
||||
- Define __STDC_VERSION__=199901L (477)
|
||||
|
||||
- Switch to newer tccpe.c (includes support for resources)
|
||||
- Handle backslashes within #include, #error, #warning
|
||||
- Handle backslashes within #include/#error/#warning
|
||||
- Import changesets (part 4) 428,457,460,467: defines for openbsd etc.
|
||||
- Use _WIN32 for a windows hosted tcc and define it for the PE target,
|
||||
otherwise define __unix / __linux (Detlef Riekenberg)
|
||||
|
2
TODO
2
TODO
@ -1,5 +1,7 @@
|
||||
TODO list:
|
||||
|
||||
- FPU st(0) is left unclean (incompatible with optimized gcc/msc code)
|
||||
|
||||
- bug with defines:
|
||||
#define spin_lock(lock) do { } while (0)
|
||||
#define wq_spin_lock spin_lock
|
||||
|
@ -1,6 +1,8 @@
|
||||
/* ---------------------------------------------- */
|
||||
/* alloca86b.S */
|
||||
|
||||
#include "config.h"
|
||||
|
||||
.globl __bound__alloca
|
||||
|
||||
__bound__alloca:
|
||||
@ -11,6 +13,7 @@ __bound__alloca:
|
||||
and $-4,%eax
|
||||
jz p6
|
||||
|
||||
#ifdef TCC_TARGET_PE
|
||||
p4:
|
||||
cmp $4096,%eax
|
||||
jle p5
|
||||
@ -20,17 +23,17 @@ p4:
|
||||
jmp p4
|
||||
|
||||
p5:
|
||||
#endif
|
||||
|
||||
sub %eax,%esp
|
||||
mov %esp,%eax
|
||||
|
||||
push %edx
|
||||
push %eax
|
||||
|
||||
push %ecx
|
||||
push %eax
|
||||
call __bound_new_region
|
||||
add $8, %esp
|
||||
|
||||
pop %eax
|
||||
pop %edx
|
||||
|
||||
|
@ -1,6 +1,8 @@
|
||||
/* ---------------------------------------------- */
|
||||
/* alloca86.S */
|
||||
|
||||
#include "config.h"
|
||||
|
||||
.globl _alloca
|
||||
|
||||
_alloca:
|
||||
@ -9,6 +11,8 @@ _alloca:
|
||||
add $3,%eax
|
||||
and $-4,%eax
|
||||
jz p3
|
||||
|
||||
#ifdef TCC_TARGET_PE
|
||||
p1:
|
||||
cmp $4096,%eax
|
||||
jle p2
|
||||
@ -17,6 +21,8 @@ p1:
|
||||
test %eax,(%esp)
|
||||
jmp p1
|
||||
p2:
|
||||
#endif
|
||||
|
||||
sub %eax,%esp
|
||||
mov %esp,%eax
|
||||
p3:
|
||||
|
36
tcc.c
36
tcc.c
@ -2307,12 +2307,14 @@ static uint8_t *parse_pp_string(uint8_t *p,
|
||||
#if/#endif */
|
||||
void preprocess_skip(void)
|
||||
{
|
||||
int a, start_of_line, c;
|
||||
int a, start_of_line, c, in_warn_or_error;
|
||||
uint8_t *p;
|
||||
|
||||
p = file->buf_ptr;
|
||||
start_of_line = 1;
|
||||
a = 0;
|
||||
redo_start:
|
||||
start_of_line = 1;
|
||||
in_warn_or_error = 0;
|
||||
for(;;) {
|
||||
redo_no_start:
|
||||
c = *p;
|
||||
@ -2325,10 +2327,9 @@ void preprocess_skip(void)
|
||||
p++;
|
||||
goto redo_no_start;
|
||||
case '\n':
|
||||
start_of_line = 1;
|
||||
file->line_num++;
|
||||
p++;
|
||||
goto redo_no_start;
|
||||
goto redo_start;
|
||||
case '\\':
|
||||
file->buf_ptr = p;
|
||||
c = handle_eob();
|
||||
@ -2340,13 +2341,17 @@ void preprocess_skip(void)
|
||||
}
|
||||
p = file->buf_ptr;
|
||||
goto redo_no_start;
|
||||
/* skip strings */
|
||||
/* skip strings */
|
||||
case '\"':
|
||||
case '\'':
|
||||
if (in_warn_or_error)
|
||||
goto _default;
|
||||
p = parse_pp_string(p, c, NULL);
|
||||
break;
|
||||
/* skip comments */
|
||||
/* skip comments */
|
||||
case '/':
|
||||
if (in_warn_or_error)
|
||||
goto _default;
|
||||
file->buf_ptr = p;
|
||||
ch = *p;
|
||||
minp();
|
||||
@ -2357,7 +2362,6 @@ void preprocess_skip(void)
|
||||
p = parse_line_comment(p);
|
||||
}
|
||||
break;
|
||||
|
||||
case '#':
|
||||
p++;
|
||||
if (start_of_line) {
|
||||
@ -2371,8 +2375,11 @@ void preprocess_skip(void)
|
||||
a++;
|
||||
else if (tok == TOK_ENDIF)
|
||||
a--;
|
||||
else if( tok == TOK_ERROR || tok == TOK_WARNING)
|
||||
in_warn_or_error = 1;
|
||||
}
|
||||
break;
|
||||
_default:
|
||||
default:
|
||||
p++;
|
||||
break;
|
||||
@ -3195,7 +3202,7 @@ static void preprocess(int is_bof)
|
||||
to emulate cpp behaviour */
|
||||
} else {
|
||||
if (!(saved_parse_flags & PARSE_FLAG_ASM_COMMENTS))
|
||||
error("invalid preprocessing directive #%s", get_tok_str(tok, &tokc));
|
||||
warning("Ignoring unknown preprocessing directive #%s", get_tok_str(tok, &tokc));
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -5464,9 +5471,9 @@ void gen_opl(int op)
|
||||
independent opt */
|
||||
void gen_opic(int op)
|
||||
{
|
||||
int c1, c2, t1, t2, n, c;
|
||||
int c1, c2, t1, t2, n;
|
||||
SValue *v1, *v2;
|
||||
long long l1, l2, l;
|
||||
long long l1, l2;
|
||||
typedef unsigned long long U;
|
||||
|
||||
v1 = vtop - 1;
|
||||
@ -5533,8 +5540,8 @@ void gen_opic(int op)
|
||||
if (c1 && (op == '+' || op == '&' || op == '^' ||
|
||||
op == '|' || op == '*')) {
|
||||
vswap();
|
||||
c = c1, c1 = c2, c2 = c;
|
||||
l = l1, l1 = l2, l2 = l;
|
||||
c2 = c1; //c = c1, c1 = c2, c2 = c;
|
||||
l2 = l1; //l = l1, l1 = l2, l2 = l;
|
||||
}
|
||||
/* Filter out NOP operations like x*1, x-0, x&-1... */
|
||||
if (c2 && (((op == '*' || op == '/' || op == TOK_UDIV ||
|
||||
@ -7650,7 +7657,7 @@ static void unary(void)
|
||||
break;
|
||||
}
|
||||
if (!s)
|
||||
error("field not found");
|
||||
error("field not found: %s", get_tok_str(tok & ~SYM_FIELD, NULL));
|
||||
/* add field offset to pointer */
|
||||
vtop->type = char_pointer_type; /* change type to 'char *' */
|
||||
vpushi(s->c);
|
||||
@ -9306,7 +9313,7 @@ static void decl(int l)
|
||||
#if 0
|
||||
{
|
||||
char buf[500];
|
||||
type_to_str(buf, sizeof(buf), &type, get_tok_str(v, NULL));
|
||||
type_to_str(buf, sizeof(buf), t, get_tok_str(v, NULL));
|
||||
printf("type = '%s'\n", buf);
|
||||
}
|
||||
#endif
|
||||
@ -10081,6 +10088,7 @@ TCCState *tcc_new(void)
|
||||
|
||||
/* standard defines */
|
||||
tcc_define_symbol(s, "__STDC__", NULL);
|
||||
tcc_define_symbol(s, "__STDC_VERSION__", "199901L");
|
||||
#if defined(TCC_TARGET_I386)
|
||||
tcc_define_symbol(s, "__i386__", NULL);
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user