This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [SPATCH] Use __glibc_likely and __glibc_unlikely.


On Wed, May 22, 2013 at 01:59:59AM -0400, Mike Frysinger wrote:
> On Tuesday 21 May 2013 03:25:00 OndÅej BÃlka wrote:
> > On Mon, May 20, 2013 at 10:30:11PM +0000, Joseph S. Myers wrote:
> > > On Mon, 20 May 2013, Ondï~Yej BÃlka wrote:
> > > > http://kam.mff.cuni.cz/~ondra/expect.patch
> > > 
> > > This appears to be consistently missing a space before the open
> > > parenthesis, "__glibc_likely(".  It also appears to have produced
> > > too-long lines, losing newlines inside the calls when instead the
> > > multiline call contents should be reindented appropriately and only move
> > > onto a single line when the change makes the contents short enough to do
> > > so.
> > 
> > It is by coccinette design. Choices are:
> > 
> > 1. Ignore formating now and fix later. (it is too much to format manualy.)
> > 2. Ask coccinette team to add flag that does formating in gnu style.
> > 3. Use formatter.
> 
> i don't think it's that much trouble.  just do:
> (1) run coccinette to convert everything to new __glibc_likely helpers
> (2) run `git diff > f`
> (3) run `patch -p1 -R < f`
> (4) run `sed -i -r 's:(__glibc_(un)?likely)[(]:\1 (:' f`
> (5) run `patch -p1 < f`
> (6) run `git commit -a`

That is only part of problem and remembering to everytime write custom scripts
is hassle. 
Second part of problem is that it transforms following:

-  if (__builtin_expect (_IO_fwide (stderr, 0) != 0, 1)
+  if (__glibc_likely(_IO_fwide(stderr, 0) != 0)

This should be easy to do genericaly. I did not found out of box
formatter that does it, do anyone know it?
I could change sed to something like s:([a-zA-Z])[(]:\1 (:

Third part is ignoring newlines. Again it is best solved by formatter.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]