-
Notifications
You must be signed in to change notification settings - Fork 444
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
Implement Consistent Commenting Style in backend #4568
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,17 @@ | ||
/* | ||
Copyright 2013-present Barefoot Networks, Inc. | ||
/// Copyright 2013-present Barefoot Networks, Inc. | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
/// Licensed under the Apache License, Version 2.0 (the "License"); | ||
/// you may not use this file except in compliance with the License. | ||
/// You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
/// http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
/// Unless required by applicable law or agreed to in writing, software | ||
/// distributed under the License is distributed on an "AS IS" BASIS, | ||
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
/// See the License for the specific language governing permissions and | ||
/// limitations under the License. | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
#include "action.h" | ||
|
||
|
@@ -213,4 +212,4 @@ void ActionConverter::postorder(const IR::P4Action *action) { | |
ctxt->structure->ids.emplace(action, id); | ||
} | ||
|
||
} // namespace BMV2 | ||
} /// namespace BMV2 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. for the namespace should I use /// or // ? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. They are internal, use two slashes here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually, another helpful contribution is to write this all down. Very good to have! We should have done this much earlier. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure we can do this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If you elaborate more then that will be helpful There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Basically, all these details we have discussed (comment style for namespaces, triple slashes vs star comments, newlines before functions) should be written down in text. This way we can refer to our "style document" whenever these questions come up. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. /** There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Triple slashes. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,17 @@ | ||
/* | ||
Copyright 2013-present Barefoot Networks, Inc. | ||
/// Copyright 2013-present Barefoot Networks, Inc. | ||
/// | ||
/// Licensed under the Apache License, Version 2.0 (the "License"); | ||
/// you may not use this file except in compliance with the License. | ||
/// You may obtain a copy of the License at | ||
/// | ||
/// http://www.apache.org/licenses/LICENSE-2.0 | ||
/// | ||
/// Unless required by applicable law or agreed to in writing, software | ||
/// distributed under the License is distributed on an "AS IS" BASIS, | ||
/// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
/// See the License for the specific language governing permissions and | ||
/// limitations under the License. | ||
|
||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
|
||
http://www.apache.org/licenses/LICENSE-2.0 | ||
|
||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
#include "controlFlowGraph.h" | ||
|
||
|
@@ -121,8 +120,8 @@ bool CFG::EdgeSet::checkSame(const CFG::EdgeSet &other) const { | |
return true; | ||
} | ||
|
||
// We check whether a table always jumps to the same destination, | ||
// even if it appears multiple times in the CFG. | ||
/// We check whether a table always jumps to the same destination, | ||
/// even if it appears multiple times in the CFG. | ||
bool CFG::checkMergeable(std::set<TableNode *> nodes) const { | ||
TableNode *first = nullptr; | ||
for (auto tn : nodes) { | ||
|
@@ -166,7 +165,7 @@ bool CFG::checkImplementable() const { | |
namespace { | ||
class CFGBuilder : public Inspector { | ||
CFG *cfg; | ||
/// predecessors of current CFG node | ||
// predecessors of current CFG node | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is not correct. Members in header files also will have triple slashes. We only use double slashes for "internal" comments within functions, for example. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please fix this for all instances. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. /// Create a header type in json. Are you referring to a gap in these comments? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You can format Github comments using triple '`', it will make your comment more readable: https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/creating-and-highlighting-code-blocks Yes, in all the comments where there is a newline between the comments and the actual function. |
||
const CFG::EdgeSet *live; | ||
P4::ReferenceMap *refMap; | ||
P4::TypeMap *typeMap; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You added an additional space here between the comment and the C++ code. Please remove it for all instances.