Skip to contentSkip to conversation

Proposal for GNU indent compatibility

DISCUSSION Pavel Roskin 5 participants 6 messages Jun 19, 2009 – Jul 31, 2009

lore
Share & tools
lore
#0 lore raw

Hello!

In order to encourage developers to use proper indentation on the newly added code, I suggest that we accept the default style of GNU indent. That is, the space after "!" should not be needed. That's the only difference I'm aware of.

Running indent on the code and then adding spaces after "!" is ridiculous, in my opinion. GRUB and indent are both GNU programs, it should not be needed to do such things.

That doesn't mean that we should start reformatting the existing code. Neither does it mean that it's acceptable to submit code that GNU indent failed to format nicely.

Signature · 2 lines
Regards,
Pavel Roskin
#1 lore raw
Quoted 4 lines · Pavel Roskin

Hello!

In order to encourage developers to use proper indentation on the newly added code, I suggest that we accept the default style of GNU indent.

I agree with proposition

Quoted 4 lines

That is, the space after "!" should not be needed. That's the only difference I'm aware of.

I ran indent on whole codebase. It failed on ./lib/LzmaDec.c and ./script/lua/lvm.c and issued warnings on ./script/lua/ldump.c and ./script/lua/lundump.c
It made following changes.
1) Cut long lines. Not always in a sensible place
2) Added a space before parenthesis in __attribute__ ((...))
3) Put newlines after ^L, not around
4) Removed space after !
5) Fixed spaces
6) Added spaces before comment if comment shares a line with code
7) Merged short lines in arguments
8) Removed spaces before labels
9) Added a space after &
10) in initializations like
a = {
..
};
it has put { on new line and without spacing
Perhaps something more. The patch would be 77280 lines. If someone there would be a way to check indent doen't introduce bugs we could run it sometimes on all .c files.

Quoted 19 lines

Running indent on the code and then adding spaces after "!" is ridiculous, in my opinion. GRUB and indent are both GNU programs, it should not be needed to do such things.

That doesn't mean that we should start reformatting the existing code. Neither does it mean that it's acceptable to submit code that GNU indent failed to format nicely.

--
Regards,
Pavel Roskin

_______________________________________________
Grub-devel mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/grub-devel

Signature · 4 lines
Regards
Vladimir 'phcoder' Serbinenko

Personal git repository: http://repo.or.cz/w/grub2/phcoder.git
#2 lore raw
Quoted 1 line · Vladimir 'phcoder' Serbinenko

8) Removed spaces before labels

Oh, I missed that. I think we should follow GNU indent in the label placement as well.

Quoted 4 lines

it has put { on new line and without spacing
Perhaps something more. The patch would be 77280 lines. If someone there would be a way to check indent doen't introduce bugs we could run it sometimes on all .c files.

I'm sure it doesn't introduce bugs, but it can mangle some code.

My point is that we should accept the code processed by GNU indent without any additional changes unless GNU indent obviously mangles the code. There should be no coding conventions that GNU indent doesn't follow.

I don't think we need to reindent everything.

Signature · 2 lines
Regards,
Pavel Roskin
#3 lore raw
In reply to Pavel Roskin
Quoted 6 lines · Pavel Roskin

Hello!

In order to encourage developers to use proper indentation on the newly added code, I suggest that we accept the default style of GNU indent. That is, the space after "!" should not be needed. That's the only difference I'm aware of.

What does GCS say about spaces after "!"?

Signature · 5 lines
Robert Millan

  The DRM opt-in fallacy: "Your data belongs to us. We will decide when (and
  how) you may access your data; but nobody's threatening your freedom: we
  still allow you to remove your data and not access it at all."
#4 lore raw
Quoted 4 lines

In order to encourage developers to use proper indentation on the newly added code, I suggest that we accept the default style of GNU indent. That is, the space after "!" should not be needed. That's the only difference I'm aware of.

What does GCS say about spaces after "!"?

It doesn't say anything on the topic. But it has a single example relating to gnulib where there is a space used after !.

| #include "error.h"
| #include <errno.h>
| #include <stdio.h>

| char *program_name = "myprogram";

| FILE *
| xfopen (char const *name)
| {
|   FILE *fp = fopen (name, "r");
|   if (! fp)
|     error (1, errno, "cannot read %s", name);
|  return fp;
| }
#5 lore raw
In reply to Pavel Roskin

Hi,

Quoted 5 lines · Pavel Roskin

In order to encourage developers to use proper indentation on the newly added code, I suggest that we accept the default style of GNU indent. That is, the space after "!" should not be needed. That's the only difference I'm aware of.

Quoted 7 lines

Running indent on the code and then adding spaces after "!" is ridiculous, in my opinion. GRUB and indent are both GNU programs, it should not be needed to do such things.

That doesn't mean that we should start reformatting the existing code. Neither does it mean that it's acceptable to submit code that GNU indent failed to format nicely.

I do not have a problem with this. Thus the space change around "!".

--
Marco