mescc: Tinycc support: Fix for ?-operator.

This commit is contained in:
Jan Nieuwenhuizen 2018-05-11 15:13:55 +02:00
parent 70cb56025f
commit e3a8316184
No known key found for this signature in database
GPG key ID: F3C1A0D9C1D65273
3 changed files with 14 additions and 7 deletions

View file

@ -222,7 +222,6 @@ broken="$broken
28_strings 28_strings
31_args 31_args
32_led
34_array_assignment 34_array_assignment
37_sprintf 37_sprintf
38_multiple_array_index 38_multiple_array_index

View file

@ -305,15 +305,15 @@
(let ((rank (pointer->rank pointer))) (let ((rank (pointer->rank pointer)))
(rank+= (ast->type type info) rank))) (rank+= (ast->type type info) rank)))
((decl-spec-list (type-spec ,type)) ((decl-spec-list (type-spec ,type)) (ast->type type info))
(ast->type type info))
;; `typedef int size; void foo (unsigned size u) ;; ;; `typedef int size; void foo (unsigned size u)
((decl-spec-list (type-spec ,type) (type-spec ,type2)) ((decl-spec-list (type-spec ,type) (type-spec ,type2))
(ast->type type info)) (ast->type type info))
((assn-expr ,a ,op ,b) ((assn-expr ,a ,op ,b) (ast->type a info))
(ast->type a info))
((cond-expr _ ,a ,b) (ast->type a info))
(_ (get-type o info)))) (_ (get-type o info))))

View file

@ -21,6 +21,11 @@
#include "30-test.i" #include "30-test.i"
#include <stdio.h> #include <stdio.h>
union foo
{
int i;
};
int int
test () test ()
{ {
@ -33,7 +38,10 @@ test ()
(one == 1) ? 1 : exit (1); (one == 1) ? 1 : exit (1);
puts ("t: (f) ?\n"); puts ("t: (f) ?\n");
(f) ? exit (1) : 1; (f) ? exit (2) : 1;
union foo fu;
fu.i = 1 ? 0 : 1;
return 0; return 0;
} }