Closed GoogleCodeExporter closed 9 years ago
Thanks! Patch looks nominally good, I haven't looked into how fix_includes.py
works more deeply.
Could you also add a test case for this in fix_includes_test.py?
Original comment by kim.gras...@gmail.com
on 30 Dec 2014 at 8:55
> +_PRAGMA_LINE_RE = re.compile(r'\s*#pragma')
Think this should try to catch all of "#pragma once", e.g. with
r'\s*#pragma\s+once'.
> + file_lines[i].type not in [_COMMENT_LINE_RE, _BLANK_LINE_RE,
_PRAGMA_LINE_RE]):
Please wrap this at 80 columns.
- _HEADER_GUARD_RE, _HEADER_GUARD_DEFINE_RE):
+ _HEADER_GUARD_RE, _HEADER_GUARD_DEFINE_RE,
_PRAGMA_LINE_RE):
Please wrap at 80 columns.
With these things fixed and a test added, I think this looks great.
Original comment by kim.gras...@gmail.com
on 30 Dec 2014 at 9:17
>Think this should try to catch all of "#pragma once", e.g. with
>r'\s*#pragma\s+once'.
Yes, I was on the fence about this, but I agree now.
> Please wrap this at 80 columns.
OK
> With these things fixed and a test added, I think this looks great.
I'll post a new patch with the changes.
Original comment by c.d.glo...@gmail.com
on 30 Dec 2014 at 1:44
New patch.
- Respected 80 char limit
- Changed regex to catch #pragma once only instead of all pragmas
- Added 4 tests
= Check for traditional #pragma once immediately preceding header guards.
= Check solo #pragma once (no header guard)
= Check special case variants of each where #pragma once is separated from header guard via blanks or comments.
I had to make a couple of changes to the patch to get the solo #pragma once to
work.
Original comment by c.d.glo...@gmail.com
on 30 Dec 2014 at 4:25
Attachments:
Thanks, this looks good to me. I made some small edits to remove whitespace and
unrelated changes. I'd like Volodymyr to take a look too, but after that I'd be
happy to commit this.
Many thanks for the patch!
Original comment by kim.gras...@gmail.com
on 30 Dec 2014 at 9:23
Attachments:
Does "# pragma once" (space between # and pragma) work like "#pragma once"? The
rest looks good. Thanks for the great job, Chris and Kim.
Original comment by vsap...@gmail.com
on 3 Jan 2015 at 11:50
Good catch. There could be arbitrary space in there so the regex should be
\s*#\s*pragma\s+once to handle that.
Original comment by c.d.glo...@gmail.com
on 3 Jan 2015 at 11:57
And I think we can add one more test - #pragma which is not #pragma once
without header guards.
Original comment by vsap...@gmail.com
on 4 Jan 2015 at 5:22
Good input! I'm going out of town for a couple of days, unless one of you beat
me to it, I can try to fix this when I get back.
Original comment by kim.gras...@gmail.com
on 4 Jan 2015 at 6:58
Fixed in r597. Sorry this took so long!
Original comment by kim.gras...@gmail.com
on 30 Jan 2015 at 8:28
Original issue reported on code.google.com by
c.d.glo...@gmail.com
on 30 Dec 2014 at 4:35Attachments: