[lttng-dev] [PATCH 1/3] Improve delete of configuration

Mathieu Desnoyers mathieu.desnoyers at efficios.com
Wed May 30 08:37:52 EDT 2012

* Yannick Brosseau (yannick.brosseau at gmail.com) wrote:
> On 2012-05-30 05:10, Francis Giraldeau wrote:
> > Le 2012-05-29 20:43, David Goulet a écrit :
> > > > + if (!config_exists(config_path)) + goto done;
> > >
> > > Please add {} even for a one liner if().
> >
> > I used checkpatch.pl from kernel scripts and the standard there is to
> > remove them. I can add them, but then patches will not pass the check.
> > IMHO I would follow the kernel style, since this makes easier for
> > everyone to check their patches. Or maybe there are options to skip
> > on-line-if-brace check? There is "--ignore BRACES" but then errors are
> > reported, only the description is not shown. Will wait for your input
> > on this.
> It's not because it's the kernel style that it's a good style... ;-)

All that being said, the reason why we agreed on having lttng-tools and
lttv use brackets for single-liner if/else is because that code is
exposed to less experienced programmers than, say, the Linux kernel.
It's just too easy for someone to go from:

if (cond)


if (cond)

as you notice, the condition does not apply to do_something anymore.
Brackets ensure that this type of code change does not create any bug.

I strictly follow the Linux kernel coding style for userspace rcu,
lttng-ust and lttng-modules though.



> Yannick

> _______________________________________________
> lttng-dev mailing list
> lttng-dev at lists.lttng.org
> http://lists.lttng.org/cgi-bin/mailman/listinfo/lttng-dev

Mathieu Desnoyers
Operating System Efficiency R&D Consultant
EfficiOS Inc.

More information about the lttng-dev mailing list