It's not better to have two different functions/entry points, one for when we have/need a CValue and other without it ?
On Sat, Mar 29, 2014 at 5:26 PM, Michael Matz <matz....@frakked.de> wrote: > Hi, > > > On Sat, 29 Mar 2014, grischka wrote: > > Thomas Preudhomme wrote: >> >>> Le 2014-03-15 20:10, mobi phil a écrit : >>> >>>> Hi, >>>> >>>> get_tok_str is called in several places with second parameter NULL, >>>> >>>> though inside members (thus dereferencing NULL) is possible. >>>> >>>> Probably this combination "bad" never happens, but would like to use >>>> this function to understand the code. >>>> >>> >>> Yes, it ought to be fixed. The solution would be simple: >>> >>> CValue cval; >>> >>> if (!cv) { >>> cval.ull = 0; >>> cv = &cval; >>> } >>> >> >> That doesn't fix anything except that it allows adding invalid >> code more easily. ;) >> > > Actually it does. get_tok_str only needs a CValue for certain tokens, > exactly those that aren't self-describing (keywords and identifiers are, > numbers for instance aren't). So depending on the caller of get_tok_str > (usually warning or error message printers) it's quite normal to simply not > have any CValue and only a token. It would be unreasonable to require such > callers to pass an invented CValue. Such invention can also be hidden > centrally inside get_tok_str. > > > Ciao, > Michael. > _______________________________________________ > Tinycc-devel mailing list > Tinycc-devel@nongnu.org > https://lists.nongnu.org/mailman/listinfo/tinycc-devel > >
_______________________________________________ Tinycc-devel mailing list Tinycc-devel@nongnu.org https://lists.nongnu.org/mailman/listinfo/tinycc-devel