[Mesa-dev] [PATCH] dir-locals.el: use appropriate c-file-style

Damien Grassart damien at grassart.com
Tue Mar 7 01:47:30 UTC 2017


On Mon, Mar 6, 2017 at 7:44 PM, Ilia Mirkin <imirkin at alum.mit.edu> wrote:
> What's the difference between c-file-style linux and stroustrup?

The main differences are that stroustrup sets c-basic-offset to 4
while linux uses 8 and linux defines braces around "else" on single
line, i.e.: "} else {".

Even if these get tweaked, it seems more accurate to use the linux
style as a starting point for these directories. I had originally just
wanted to add this for the radv code but Michel suggested that we keep
consistent .dir-locals.el files where the coding style is the same.
Let me know if this isn't right for those other directories in this
patch.

The full definitions (from the c-style-alist variable) are:

 ("stroustrup"
  (c-basic-offset . 4)
  (c-comment-only-line-offset . 0)
  (c-offsets-alist
   (statement-block-intro . +)
   (substatement-open . 0)
   (substatement-label . 0)
   (label . 0)
   (statement-cont . +)))

 ("linux"
  (c-basic-offset . 8)
  (c-comment-only-line-offset . 0)
  (c-hanging-braces-alist
   (brace-list-open)
   (brace-entry-open)
   (substatement-open after)
   (block-close . c-snug-do-while)
   (arglist-cont-nonempty))
  (c-cleanup-list brace-else-brace)
  (c-offsets-alist
   (statement-block-intro . +)
   (knr-argdecl-intro . 0)
   (substatement-open . 0)
   (substatement-label . 0)
   (label . 0)
   (statement-cont . +)))

Thanks,
-Damien


More information about the mesa-dev mailing list