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 just to avoid namespace clutter, I think a two-part process (i.e. we add header guards now, then fix ‘#includes’ ad-hoc) would be good. It would also be good if we could have checkguards not fix up the files, but rather just spit out an error on non-conformant files, that way we could add it to our CI suite and get notifications when we break C++ style per-commit.

Sterling

On 11 Sep 2016, at 14:04, Tim Hutt wrote:

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
difficult with my regex hack though... Maybe make a temporary exception and
then say all new files must follow the style guide?

On 11 September 2016 at 20:58, Peter Snyder <[email protected]> wrote:

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 the included headers. I’m fine being corrected on this (sure would be
easier to automate this work :-).

Here’s the relevant section from the coding standard <
https://github.com/apache/incubator-mynewt-core/blob/
master/CODING_STANDARDS.md>:
Header files must contain the following structure:

Apache License (see above)
#ifdef aliasing, to prevent multiple includes
#include directives for other required header files
#ifdef __cplusplus wrappers to maintain C++ friendly APIs
Contents of the header file
- peter


On Sep 11, 2016, at 12:41 PM, Christopher Collins <[email protected]>
wrote:

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 did you exclude these files?

Er... the commit message also explains why they were excluded [*].
Sorry :).

[*] "Because the hack I used looks for normal #include guards for its
place
to put the C++ ones, and those files don't have any."


Reply via email to