On Wed, 31 Aug 2011, Artem Shinkarov wrote: > On Wed, Aug 31, 2011 at 4:38 PM, Joseph S. Myers > <jos...@codesourcery.com> wrote: > > On Wed, 31 Aug 2011, Artem Shinkarov wrote: > > > >> 1) Helper function for the pseudo-builtins. > >> In my case the builtin can have 2 or 3 arguments, and I think that I > >> expressed that in a pretty much short way without any helper function. > >> Am I missing something? > > > > The point is to refactor what's common between this and other > > pseudo-builtins, not to have two pseudo-builtins doing things one way and > > one doing them another way.... > > Joseph, I don't mind adjusting, just look into the patch and tell me > if the way it is done at the moment is the right way to do it. I don't > see a good reason to write a helper function the way you describe, > because the number of operations we do there is very small. However, > if you think that this is a right way to go, I can put the statements > I am using right now to handle arguments of RID_BUILTIN_SHUFFLE in a > helper function. So is there anything missing?
The common parts are I think: * Parse open parenthesis. If there isn't one, a parse error is OK (no worse than at present) but "cannot take address of %<__builtin_whatever%>" would be better. * Parse expression list. * Parse close parenthesis (if not found, parse error). * Check number of arguments against the list of permitted numbers of arguments for this pseudo-builtin, and give an error if the number is wrong. -- Joseph S. Myers jos...@codesourcery.com