Building cmd I noticed that the case of sizeof(int) = sizeof(long)
(which is the case in all compilers) wasn't managed with my changes.
I wonder if this logic mess could be shortened without making
impossible to read the 'if' conditions without throwing up (I've
tried).

I've compiled on arm the libraries, cmd and kernel (except ape)
without any problem.

adr.

/sys/src/cmd/cc/lex.c
[...]
       vv = yylval.vval;
       if(c1 & Numvlong ||
         (uvlong)convvtox(vv, TUVLONG) > convvtox(vv, TULONG)){
               /* unsigned suffix or hex occupying the sing bit */
               if((c1 & Numuns) || convvtox(vv, TVLONG) < 0 && (c1 & Numdec) == 
0) {
                       c = LUVLCONST;
                       t = TUVLONG;
                       goto nret;
               }
               c = LVLCONST;
               t = TVLONG;
               goto nret;
       }
       if(c1 & Numlong ||
         (uvlong)convvtox(vv, TULONG) > convvtox(vv, TUINT)){
               if((c1 & Numuns) || convvtox(vv, TLONG) < 0 && (c1 & Numdec) == 
0) {
                       c = LULCONST;
                       t = TULONG;
                       goto nret;
               }
               /* decimal occupying the sing bit */
               if(convvtox(vv, TLONG) < 0 && (c1 & Numdec)) {
                       c = LVLCONST;
                       t = TVLONG;
                       goto nret;
               }
               c = LLCONST;
               t = TLONG;
               goto nret;
       }
       if((c1 & Numuns) || convvtox(vv, TINT) < 0 && (c1 & Numdec) == 0) {
               c = LUCONST;
               t = TUINT;
               goto nret;
       }
       if(convvtox(vv, TINT) < 0 && (c1 & Numdec)) {
               /* size(int) = size(long) */
               if(convvtox(vv, TLONG) < 0) {
                       c = LVLCONST;
                       t = TVLONG;
                       goto nret;
               }
               c = LLCONST;
               t = TLONG;
               goto nret;
       }
       c = LCONST;
       t = TINT;
       goto nret;
[...]


------------------------------------------
9fans: 9fans
Permalink: 
https://9fans.topicbox.com/groups/9fans/T4bced580971a40a2-Mda3d0c619c734bb0e1cf708c
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

Reply via email to