Re: Adding C++ header guards?

2016-09-13 Thread Tim Hutt
Ok second time lucky: https://github.com/Ti/incubator-mynewt-core/commit/3c030b01c31e30d2e3123610f70c0da3faf8ed29 This time it *should* put them after the #includes. I did find at least one file that had a random #include in the middle. It ignores that and only puts the guard after the first

Re: Adding C++ header guards?

2016-09-11 Thread Christopher Collins
On Sun, Sep 11, 2016 at 04:32:07PM -0700, Sterling Hughes wrote: > I think a temporary exception would be fine: but I’m not sure the > impact, perhaps somebody who understands C++ better can chime in. Why > are ‘#includes’ _excluded_ from the extern “C” namespace? Is it > just to avoid

Re: Adding C++ header guards?

2016-09-11 Thread Sterling Hughes
I think a temporary exception would be fine: but I’m not sure the impact, perhaps somebody who understands C++ better can chime in. Why are ‘#includes’ _excluded_ from the extern “C” namespace? Is it just to avoid cluttering that namespace? Or are there subtle/nefarious effects? If its

Re: Adding C++ header guards?

2016-09-11 Thread Greg Stein
Right. You don't want to apply the namespace to *other* headers, just the current file. Those other headers might be designed for inclusion by a C++ program. On Sun, Sep 11, 2016 at 2:58 PM, Peter Snyder wrote: > I think this is great too, but I don’t think it’s keeping to

Re: Adding C++ header guards?

2016-09-11 Thread Tim Hutt
Ah ok, I didn't read the style guide - I just copied the style of the existing files I checked (the HAL headers) seem to put #ifdef __cplusplus before #includes. I had a further search and some files put it after, some before. I'll have a look at getting them after the #includes. Might be quite

Re: Adding C++ header guards?

2016-09-11 Thread Peter Snyder
I think this is great too, but I don’t think it’s keeping to the mynewt coding standard. In particular I think the C++ wrappers are supposed to appear after other included files and before any file content. For sure this messes up your script (sorry) but it avoids any potential conflicts with

Re: Adding C++ header guards?

2016-09-11 Thread Christopher Collins
On Sun, Sep 11, 2016 at 12:39:27PM -0700, Christopher Collins wrote: > Look great to me, thanks! I just have a question - the commit message > indicates that two files were not modified: > > libs/baselibc/src/baselibc_test/unittests.h > libs/shell/include/shell/shell_prompt.h > > Why

Re: Adding C++ header guards?

2016-09-11 Thread Christopher Collins
On Sun, Sep 11, 2016 at 08:19:58PM +0100, Tim Hutt wrote: > I like C++ and would like to use it with MyNewt, so I've written a very > hacky tool in Go to detect C++ header guards: > > https://github.com/Ti/GuardChecker > > Here is the result of running it on apache-mynewt-core: > >

Re: Adding C++ header guards?

2016-09-09 Thread Christopher Collins
Only public headers (files in a "/include" directory) need the guards. Private headers (files in a "src/" directory) are only intended to be included by C files, and don't require them. Not that it hurts to add guards to the private headers as well. Chris On Fri, Sep 09, 2016 at 04:46:44PM

Re: Adding C++ header guards?

2016-09-09 Thread Sterling Hughes
PS: if anyone wants to volunteer to do this work, I’m more than happy to cede responsibility :-) On 9 Sep 2016, at 10:08, Sterling Hughes wrote: Hey, In our coding style we’ve agreed to be C++ friendly: https://github.com/apache/incubator-mynewt-core/blob/master/CODING_STANDARDS.md But