
On 03/19/2012 04:43 PM, Eric Blake wrote:
On 03/19/2012 06:43 AM, Daniel P. Berrange wrote: [...] since the open '(' lets the rest of the code indent nicely when using default emacs indentation. But it's still pretty easy to recognize the difference between complex returns and the real offenders. I think the number of false positives and false negatives is pretty near zero if you boil it down to detecting uses where there are no spaces between the '(' and ')'. Thus, for cfg.mk, I suggest a pattern something like:
sc_prohibit_return_as_function: @prohibit='\<return *([^ ]*)' \ halt='avoid extra () with return statements' \ $(_sc_search_regexp)
I agree with the first part. There are some places that should be kept as is. However, the '\<return *([^ ]*)' would generate some false positives, for example 'return (buf[0] << 0) | (buf[1] << 8)' and few others I've found. Don't worry though, I've created a regexp that matches just what's needed, composing the patch right now. Martin