Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[trivial] Add end of namespace comments. Improve consistency. #9544

Conversation

practicalswift
Copy link
Contributor

No description provided.

@practicalswift practicalswift changed the title Add end of namespace comments. Improve consistency for anonymous namespaces. [trivial] Add end of namespace comments. Improve consistency. Jan 13, 2017
@fanquake fanquake added the Docs label Jan 13, 2017
@practicalswift practicalswift force-pushed the consistent-use-of-end-of-namespace-comments branch from 2553d2b to 7140b87 Compare January 31, 2017 20:02
@practicalswift
Copy link
Contributor Author

Merge conflict resolved!

@@ -225,7 +225,7 @@ class CBitcoinAddressVisitor : public boost::static_visitor<bool>
bool operator()(const CNoDestination& no) const { return false; }
};

} // anon namespace
} // namespace
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why remove anon ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jtimon My reasoning behind that was to achieve consistency how anonymous namespaces are indicated. Consistency in order to improve readability and allow for automatic identification of missing/incorrect end of namespace comments.

// namespace is the form preferred by the clang-tooling (clang-tidy, etc). // anonymous namespace is also quite common. I haven't seen // anon namespace before, but let me know if the choice of // anon namespace is intentional and I'll adjust this PR :-)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, it just seems to me that the same consistency can be achieved leaving "anon namespace" for anonymous namespaces with less disruption. But if clang prefers // namespace or // anonymous namespace I don't have a strong opinion.

@practicalswift
Copy link
Contributor Author

Any changes needed before merge? :-)

@paveljanik
Copy link
Contributor

The question should read: How can I attract you to the review? My answer is: sorry, I do not know.

I'm pro // anonymous namespace and having the end of namespace marks. But we do not have a recommendation for this in the developer notes, there is only "Block style example:" section there. With no end of namespace comment...

@practicalswift
Copy link
Contributor Author

@paveljanik I see! If the consensus opinion is that end of namespace marks are optional then this PR is redundant and I'll close it :-)

@laanwj
Copy link
Member

laanwj commented Feb 28, 2017

I think the point is that if end-of-namespace comments are to be required, they should be mentioned in doc/developer-notes.md along with rationale. It should be clear to contributors what the "rules" are. If not, changes like this come out of the blue.

@paveljanik
Copy link
Contributor

@practicalswift I do now know what the consensus is, but my opinion is the same as @laanwj 's.

@practicalswift practicalswift force-pushed the consistent-use-of-end-of-namespace-comments branch 4 times, most recently from 15bd40f to 602d1aa Compare February 28, 2017 15:27
@practicalswift
Copy link
Contributor Author

@laanwj Good point! I've added a note to doc/developer-notes.md in this PR.

@practicalswift practicalswift force-pushed the consistent-use-of-end-of-namespace-comments branch from 602d1aa to 11d4870 Compare February 28, 2017 15:32
@paveljanik
Copy link
Contributor

I'd slightly prefer // anonymous namespace over // namespace at the end of anonymous namespace, but this is minor.

@practicalswift
Copy link
Contributor Author

@paveljanik It seems like // namespace is the dominant form currently used in the repo:

$ git checkout master
$ git grep -E '} *// namespace$' | wc -l
21
$ git grep -E '} *// anonymous namespace$' | wc -l
3

// namespace is also the form preferred by the clang-tooling (clang-tidy, etc).

@paveljanik
Copy link
Contributor

@practicalswift yes. But it seems like the author forget to add the real name of the namespace after it ;-)

@@ -71,7 +71,7 @@ bool ParseDouble(const std::string& str, double *out)
if(out) *out = result;
return text.eof() && !text.fail();
}
}
} // namespace
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is univalue -> please report upstream.

@paveljanik
Copy link
Contributor

Concept ACK.

Please remove univalue change. Then utACK

@practicalswift practicalswift force-pushed the consistent-use-of-end-of-namespace-comments branch from 11d4870 to 8530606 Compare March 1, 2017 08:41
@practicalswift
Copy link
Contributor Author

@paveljanik Removed univalue change as requested :-)

@paveljanik
Copy link
Contributor

ACK 8530606

Thanks!

@practicalswift
Copy link
Contributor Author

@paveljanik Thanks for reviewing! Let me know if any further tweaks are needed :-)

@practicalswift practicalswift force-pushed the consistent-use-of-end-of-namespace-comments branch from 470a0ee to c629d4f Compare April 27, 2017 22:44
@practicalswift practicalswift force-pushed the consistent-use-of-end-of-namespace-comments branch from c629d4f to 4c92401 Compare April 27, 2017 22:48
@practicalswift
Copy link
Contributor Author

Conflicts resolved!

@jtimon
Copy link
Contributor

jtimon commented Apr 27, 2017

Fast re-review checked that still doesn't need testing ACK 486a5d7

- Terminate namespaces with a comment (`// namespace mynamespace`). The comment
should be placed on the same line as the brace closing the namespace, e.g.

```c++
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: extra spaces?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jtimon Sorry I'm not sure I follow - where should the extra spaces be placed? :-)

Copy link
Contributor

@jtimon jtimon May 31, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/ ```/```/ ?

EDIT: not important

@practicalswift practicalswift force-pushed the consistent-use-of-end-of-namespace-comments branch from 486a5d7 to 5a9b508 Compare May 31, 2017 20:21
@practicalswift
Copy link
Contributor Author

@jtimon Fixed! :-)

@laanwj
Copy link
Member

laanwj commented Jun 26, 2017

utACK 5a9b508

@laanwj laanwj merged commit 5a9b508 into bitcoin:master Jun 26, 2017
laanwj added a commit that referenced this pull request Jun 26, 2017
…ency.

5a9b508 [trivial] Add end of namespace comments (practicalswift)

Tree-SHA512: 92b0fcae4d1d3f4da9e97569ae84ef2d6e09625a5815cd0e5f0eb6dd2ecba9852fa85c184c5ae9de5117050330ce995e9867b451fa8cd5512169025990541a2b
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 6, 2019
…consistency.

5a9b508 [trivial] Add end of namespace comments (practicalswift)

Tree-SHA512: 92b0fcae4d1d3f4da9e97569ae84ef2d6e09625a5815cd0e5f0eb6dd2ecba9852fa85c184c5ae9de5117050330ce995e9867b451fa8cd5512169025990541a2b
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 6, 2019
…consistency.

5a9b508 [trivial] Add end of namespace comments (practicalswift)

Tree-SHA512: 92b0fcae4d1d3f4da9e97569ae84ef2d6e09625a5815cd0e5f0eb6dd2ecba9852fa85c184c5ae9de5117050330ce995e9867b451fa8cd5512169025990541a2b
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 8, 2019
…consistency.

5a9b508 [trivial] Add end of namespace comments (practicalswift)

Tree-SHA512: 92b0fcae4d1d3f4da9e97569ae84ef2d6e09625a5815cd0e5f0eb6dd2ecba9852fa85c184c5ae9de5117050330ce995e9867b451fa8cd5512169025990541a2b
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 9, 2019
…consistency.

5a9b508 [trivial] Add end of namespace comments (practicalswift)

Tree-SHA512: 92b0fcae4d1d3f4da9e97569ae84ef2d6e09625a5815cd0e5f0eb6dd2ecba9852fa85c184c5ae9de5117050330ce995e9867b451fa8cd5512169025990541a2b
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Jul 11, 2019
…consistency.

5a9b508 [trivial] Add end of namespace comments (practicalswift)

Tree-SHA512: 92b0fcae4d1d3f4da9e97569ae84ef2d6e09625a5815cd0e5f0eb6dd2ecba9852fa85c184c5ae9de5117050330ce995e9867b451fa8cd5512169025990541a2b
barrystyle pushed a commit to PACGlobalOfficial/PAC that referenced this pull request Jan 22, 2020
…consistency.

5a9b508 [trivial] Add end of namespace comments (practicalswift)

Tree-SHA512: 92b0fcae4d1d3f4da9e97569ae84ef2d6e09625a5815cd0e5f0eb6dd2ecba9852fa85c184c5ae9de5117050330ce995e9867b451fa8cd5512169025990541a2b
@practicalswift practicalswift deleted the consistent-use-of-end-of-namespace-comments branch April 10, 2021 19:31
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Aug 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants