On Sun, 30 Jan 2011, SF Markus Elfring wrote: > > You can specify a metavariable as matching an expression of an arbitrary > > type, int, char *, etc. But parsing of function types in this position > > does not seem to yet be supported. > > Thanks for your clarification. > > Would you like to extend the capabilities of the semantic patch language for > this use case with (variable) function return types?
It would seem reasonable to do so, unless it causes some ambiguity in the parser. > > That is good for debugging, but probably more brutal than what is wanted > > in practice. Usually what is done in Linux code is to clean up the local > > state and return some error code to the caller. > > I would prefer to put on the emergency brake in some use cases instead of > keeping a software running without noticing an unexpected error situation. > http://en.wikipedia.org/wiki/Crash-only_software > > > > Yes, along the lines of the example I sent to Anders. > > I'm sorry that I am not as familiar with the presented "|" notation as you so > far. Does it enable the selection between alternative filters? Yes, the first one that matches is used. > >> http://cmake.org/gitweb?p=cmake.git;a=blob;f=Source/kwsys/ProcessUNIX.c;hb=b9e3c243d476efa04479d253cfc4f76ecbdb6fe3#l2713 > > > > I looked at the code, but I don't see the problem in that case, since the > > mentioned line is the header of a void function. > > How do you think about a usage of the return values from the function calls > "read" and "write"? > > Excerpt from the source file "Source/kwsys/ProcessUNIX.c": > > static void kwsysProcessesSignalHandler(int signum // Line 2713 > #if KWSYSPE_USE_SIGINFO > , siginfo_t* info, void* ucontext > #endif > ) > { > [...] > /* Signal all process objects that a child has terminated. */ > { > int i; > for(i=0; i < kwsysProcesses.Count; ++i) > { > /* Set the pipe in a signalled state. */ > char buf = 1; > kwsysProcess* cp = kwsysProcesses.Processes[i]; > kwsysProcess_ssize_t status= > read(cp->PipeReadEnds[KWSYSPE_PIPE_SIGNAL], &buf, 1); > status=write(cp->SignalPipe, &buf, 1); > (void)status; > } > } > [...] > } > > Would this source code example need any fine-tuning with the help of a SmPL > filter pattern application (for safety reasons)? In this case it really looks like the developer has decided that he doesn't care, at least about the result of the call to write. But one could search for this case if one wanted. julia _______________________________________________ Cocci mailing list [email protected] http://lists.diku.dk/mailman/listinfo/cocci (Web access from inside DIKUs LAN only)
