clang -Wimplicit-fallthrough and missing breaks
Eike Rathke
erack at redhat.com
Mon May 9 17:10:26 UTC 2016
Hi Caolán,
On Monday, 2016-05-09 09:54:42 +0100, Caolán McNamara wrote:
> [... switch case indent ...]
Parts of that seem to be what the default Vim C-indent options cause, i.e.
switch (foo)
{
case bar:
...
break;
case bar:
{
...
}
break;
}
Modifying the cinoptions settings helps, in particular if the bN option
is not used (or N=0) (which I was guilty of for example, now changed ;-)
then the break statement is indented as well, b1 cures this to
switch (foo)
{
case bar:
...
break;
case bar:
{
...
}
break;
}
However, this only when re-indenting the code, to automatically do this
when typing also add 0=break to cinkeys.
Additional helpful settings are N-s to not indent inside a namespace
block, and g0 to not indent private: and public: within a class
declaration.
So, to combine, the settings would be
set cinoptions=b1,g0,N-s
set cinkeys+=0=break
We could force that in the mode lines.
Eike
--
LibreOffice Calc developer. Number formatter stricken i18n transpositionizer.
GPG key "ID" 0x65632D3A - 2265 D7F3 A7B0 95CC 3918 630B 6A6C D5B7 6563 2D3A
Better use 64-bit 0x6A6CD5B765632D3A here is why: https://evil32.com/
Care about Free Software, support the FSFE https://fsfe.org/support/?erack
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <https://lists.freedesktop.org/archives/libreoffice/attachments/20160509/cae58e3a/attachment.sig>
More information about the LibreOffice
mailing list