-
-
Notifications
You must be signed in to change notification settings - Fork 3k
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
API for checking if an annotation is a reference or function variable. #17386
API for checking if an annotation is a reference or function variable. #17386
Conversation
* frees memory that is dynamically allocated for it. | ||
* | ||
* Return: Nothing. | ||
*/ | ||
R_API void r_annotation_free(void *e, void *user); | ||
/** |
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.
Please don't invent your own documentation comment style. If you use doxygen style comments do so consistently. They are not only for human reading but also consumption by tools. See the documentation https://www.doxygen.nl/manual/index.html
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.
Radare2 uses this style https://www.kernel.org/doc/html/v4.16/doc-guide/kernel-doc.html#how-to-format-kernel-doc-comments
I have been told to use this and all functions in r_annotated_code.h
are documented using this style.
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.
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.
Is it written anywhere r2 documentation that it uses this style? If it I am fine with that, but I haven't seen it used anywhere except r_annotated_code.
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.
This https://github.com/radareorg/radare2/blob/master/DEVELOPERS.md claims that r2 uses doxygen C-style comments.
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.
@ITAYC0HEN @thestr4ng3r I'm not sure when this was decided. See this comment by @ITAYC0HEN #16939 (review) It was discussed when I was working on #16939 .
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.
Doxygen is the way to go.
libr/util/annotated_code.c
Outdated
@@ -23,6 +23,14 @@ R_API void r_annotation_free(void *e, void *user) { | |||
} | |||
} | |||
|
|||
R_API bool is_annotation_reference(RCodeAnnotation *annotation) { |
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.
Please consider renaming these functions. Most R_API functions use common prefix, this helps avoiding naming conflict and improves discoverability. Maybe r_annotation_is_reference
and r_annotation_is_variable
.
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.
I will rename them.
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.
@karliss I have renamed functions. If you are fine with the code now, please merge it. I think PR #2352 Cutter can get merged tonight. Since it uses the new API implemented in this PR, I want this to get merged first.
I will send a separate PR with documentation using Doxygen tonight, but I think it can be another PR as it could take more time to review.
R_API bool r_annotation_is_reference(RCodeAnnotation *annotation); | ||
/** | ||
* r_annotation_is_variable() - Checks if the specified annotation is a function variable. | ||
* @annotation: Pointer to an annotation. |
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.
shouldn't it be @param annotation
?
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.
This is how it is (if I understand correctly) in kernel-docs https://www.kernel.org/doc/html/v4.16/doc-guide/kernel-doc.html#how-to-format-kernel-doc-comments
*/ | ||
R_API bool r_annotation_is_reference(RCodeAnnotation *annotation); | ||
/** | ||
* r_annotation_is_variable() - Checks if the specified annotation is a function variable. |
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.
Should you include the name of the function in the docs? "r_annotation_is_variable() "? Also, if you include this, the signature is wrong as it receive parameters
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.
This is how it is in Kernel-doc, if I understand correctly. As I said, I'm going to update this to Doxygen, in another PR. So let's not worry about documentation for now.
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.
Please make sure to fix the docs in the upcoming pr.
Here's the new PR fixing the documentation: #17397 |
…edCode (#17429) * Annotation for function name (#17204) * Annotations for Constant Variables and Global Variables for the decompiler (#17281) * Annotation For Function Variables (#17375) * function variable annotation added (includes local variable and function parameter) * API for checking if an annotation is a reference or function variable. (#17386) * Update docs in annotate code API (#17397) * Unit tests for annotated code API (#17403)
…edCode (radareorg#17429) * Annotation for function name (radareorg#17204) * Annotations for Constant Variables and Global Variables for the decompiler (radareorg#17281) * Annotation For Function Variables (radareorg#17375) * function variable annotation added (includes local variable and function parameter) * API for checking if an annotation is a reference or function variable. (radareorg#17386) * Update docs in annotate code API (radareorg#17397) * Unit tests for annotated code API (radareorg#17403)
…edCode (#17429) * Annotation for function name (#17204) * Annotations for Constant Variables and Global Variables for the decompiler (#17281) * Annotation For Function Variables (#17375) * function variable annotation added (includes local variable and function parameter) * API for checking if an annotation is a reference or function variable. (#17386) * Update docs in annotate code API (#17397) * Unit tests for annotated code API (#17403)
Your checklist for this pull request
Detailed description
This PR implements the following two functions. Read the documentation below.
...
Test plan
...
Closing issues
...