Auto-generate stub files for unit tests#2361
Auto-generate stub files for unit tests#2361yadij wants to merge 5 commits intosquid-cache:masterfrom
Conversation
|
For simplicity in the script, and flexibility with stub macro used - header files should be marked up with the stub detail (eg. Script supports pre-compiler Stubbed function/methods also need to be defined without parameter names to avoid "unused parameter" errors when compiling the stub. For this |
|
nice idea! |
rousskov
left a comment
There was a problem hiding this comment.
Generating stubs may be a good idea, but we should not pollute primary code with STUB parts and use AWK to process them.
Well, you are welcome to roll your own custom C++ parser to generate stubs if you really want to. Seems like a lot of unnecessary work though. |
|
One other thing I have been wondering about is making the markup look like this: ... which is a bit more self-documenting than what we have now. |
also looks good! How about using [[maybe_unused]] in the generated stubs? https://en.cppreference.com/w/cpp/language/attributes/maybe_unused.html |
There are much better alternatives than the one proposed in this PR and the one proposed in the above comment. |
All the approaches I am aware of for stub generation come down to parsing the C/C++, or some form of new markup. If you have something else, please provide some actionable response. |
Yes, that attribute could be used when naming is needed. |
I would expect the attribute to be needed in the definition, not in the declaration. |
I am aware of a better approach. The actions I recommended in 2024 and 2025 remain the same: Please stop posting new PRs and start cooperating on finding ways to address the existing backlog (created by stalling other PRs). For example, this PR should not have been posted (and should be closed). |
This macro allows arbitrary code return logic to be added to stub files. Deprecating the various STUB_RET*() macros.
No description provided.