scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit 729bca35c55764bb98afccbd790570e5c94b47ed
parent 5d4796cb4d72a844fd0e6a002e0056e83b34b468
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Sun,  1 Jul 2012 19:22:09 +0200

Added restict field to the ctype struct

This field is used in the pointers in C99 mode. In this patch is also
changed vol and extrn abbreviates because weren-t so much clears.

Diffstat:
Msymbol.h | 5+++--
Mtypes.c | 16++++++++--------
2 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/symbol.h b/symbol.h @@ -28,12 +28,13 @@ enum namespace { struct ctype { bool c_type : 1; - bool c_extrn : 1; + bool c_extern : 1; bool c_static : 1; bool c_auto : 1; bool c_reg : 1; bool c_const : 1; - bool c_vol : 1; + bool c_volatile : 1; + bool c_restrict : 1; bool c_unsigned : 1; struct type *base; }; diff --git a/types.c b/types.c @@ -113,28 +113,28 @@ void ctype(struct ctype *cp, unsigned char mod) case TYPEDEF: if (cp->c_type) goto duplicated; - if (cp->c_extrn | cp->c_auto | cp->c_reg | cp->c_static) + if (cp->c_extern | cp->c_auto | cp->c_reg | cp->c_static) goto two_storage; cp->c_type = 1; return; case EXTERN: - if (cp->c_extrn) + if (cp->c_extern) goto duplicated; if (cp->c_type | cp->c_auto | cp->c_reg | cp->c_static) goto two_storage; - cp->c_extrn = 1; + cp->c_extern = 1; return; case STATIC: if (cp->c_static) goto duplicated; - if (cp->c_type | cp->c_extrn | cp->c_auto | cp->c_reg) + if (cp->c_type | cp->c_extern | cp->c_auto | cp->c_reg) goto two_storage; cp->c_static = 1; return; case AUTO: if (nested_level != 0) goto bad_file_scope_storage; - if (cp->c_type | cp->c_extrn | cp->c_static | cp->c_reg) + if (cp->c_type | cp->c_extern | cp->c_static | cp->c_reg) goto two_storage; if (cp->c_auto) goto duplicated; @@ -143,7 +143,7 @@ void ctype(struct ctype *cp, unsigned char mod) case REGISTER: if (nested_level != 0) goto bad_file_scope_storage; - if (cp->c_type | cp->c_extrn | cp->c_auto | cp->c_static) + if (cp->c_type | cp->c_extern | cp->c_auto | cp->c_static) goto two_storage; if (cp->c_reg) goto duplicated; @@ -155,9 +155,9 @@ void ctype(struct ctype *cp, unsigned char mod) cp->c_const = 1; return; case VOLATILE: - if (user_opt.typeqlf_repeat && cp->c_vol) + if (user_opt.typeqlf_repeat && cp->c_volatile) goto duplicated; - cp->c_vol = 1; + cp->c_volatile = 1; return; } bad_file_scope_storage: