On Wed, 20 Apr 2022, Charles Forsyth wrote:

The short answer is whatever the historical reasons for the current 
interpretation(s), it
should follow C99 rules to avoid confusion.

This should do the trick. I hope to not have to send another patch in half an 
hour...

Charles, you are part of the p9f board, if you serve the 9legacy
sources there it would be really easy to send you a patch. In my
opinion it makes more sense to let the editions be archived as isos
and substitute the sources 9p service with a 9legacy one.

Just a suggestion,
adr.
/sys/src/cmd/cc/lex.c:
[...]
       vv = yylval.vval;
       if(c1 & Numvlong ||
         convvtox(vv, TUVLONG) > convvtox(vv, TULONG) ||
         (c1 & (Numdec|Numuns)) == Numdec && convvtox(vv, TLONG) < 0) {
               if((c1 & Numuns) || convvtox(vv, TVLONG) < 0) {
                       c = LUVLCONST;
                       t = TUVLONG;
                       goto nret;
               }
               c = LVLCONST;
               t = TVLONG;
               goto nret;
       }
       if(c1 & Numlong ||
         convvtox(vv, TULONG) > convvtox(vv, TUINT) ||
         (c1 & (Numdec|Numuns)) == Numdec && convvtox(vv, TINT) < 0) {
               if((c1 & Numuns) || convvtox(vv, TLONG) < 0) {
                       c = LULCONST;
                       t = TULONG;
                       goto nret;
               }
               c = LLCONST;
               t = TLONG;
               goto nret;
       }
       if((c1 & Numuns) || convvtox(vv, TINT) < 0) {
               c = LUCONST;
               t = TUINT;
               goto nret;
       }
       c = LCONST;
       t = TINT;
       goto nret;

nret:
       yylval.vval = convvtox(vv, t);
       if(yylval.vval != vv){
               nearln = lineno;
               warn(Z, "truncated constant: %T %s", types[t], symb);
       }
       return c;
[...]

------------------------------------------
9fans: 9fans
Permalink: 
https://9fans.topicbox.com/groups/9fans/T22754f10b241991c-Mabed3218d4cc85a6f48f03f7
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

Reply via email to