Mercurial > hg > CbC > old > device
changeset 878:9745d517f113
handle always inline attribute
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 02 Apr 2014 20:37:53 +0900 |
parents | 6955ee41688f |
children | 528595192871 |
files | mc-parse.c mc.h |
diffstat | 2 files changed, 15 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/mc-parse.c Wed Apr 02 17:44:57 2014 +0900 +++ b/mc-parse.c Wed Apr 02 20:37:53 2014 +0900 @@ -669,6 +669,7 @@ // attributes ( in different name space ) reserve("aligned",ALIGNED,ATTRIBUTE); reserve("noreturn",NORETURN,ATTRIBUTE); + reserve("__always_inline__",ALWAYS_INLINE,ATTRIBUTE); codegen_reinit(); // macro_define("__restrict\n"); @@ -918,7 +919,7 @@ decl(void) { NMTBL *n; - int t,sd; + int t,sd,attr; ctmode=0; if (mode==GDECL) { typedefed=0; } storage_class(); @@ -929,6 +930,7 @@ } storage_class(); type=t;sd=stypedecl; + attr = attribute; // decl0 will clear it n=decl0(); reverse(t); if (n == &null_nptr) { @@ -936,10 +938,12 @@ if (!(type>0&&car(type)==BIT_FIELD)) { error(DCERR); return; } - } + } else + set_attributes(n,attr); while (sym==ATTRIBUTE||sym==ASM) { int sym0 = sym; getsym(0); attributes(sym0); } + set_attributes(n,attribute); if(sym==LC || ( sym!=SM && sym!=COMMA && sym!=ASS)) { /* function body */ if (mode!=GDECL) { @@ -2165,6 +2169,9 @@ int sd = stypedecl; int arglist,arg_disp; int sinmode = inmode; + if (has_attr(n,ALWAYS_INLINE)) { + inmode = INLINE; + } if (parse_mode) { inmode = INLINE; } @@ -2253,11 +2260,14 @@ lfree_type_limit = 0; if (parse_mode) { // do not generate static inline function + inmode = sinmode; if (sinmode && n->sc==STATIC) return; + if (has_attr(n,ALWAYS_INLINE)) return; inmode = 0; pfdecl(fnptr); inmode = 0; } + inmode = sinmode; } /* copy function argment for inline function */ @@ -2303,6 +2313,7 @@ int args,nargs,cargs; NMTBL *a; + if (has_attr(n,ALWAYS_INLINE)) return; if (has_attr(n,GENERATED)) return; set_attr(n,GENERATED,0); @@ -5126,7 +5137,7 @@ nptr0 = name_space_search(nlist,sc); if (nptr0->sc == RESERVE) return sym = nptr0->dsp; - if (mode==ATTRIBUTE && nptr0->sc == ATTRIBUTE) + if (mode==ATTRIBUTE && nptr0->sc == ATTRIBUTE) return sym = nptr0->dsp; sym = IDENT; gnptr=nptr=nptr0;