Doxygen: Can a \post start with \ref or any other Special Command? - clang

I'm getting an error from Clang when using CLANG_WARN_DOCUMENTATION_COMMENTS on a doxygen block that contains following line
\post \ref something == somethingelse
The warning says "Empty paragraph passed to '\post' command"
Is this a valid use of \post?
If it is, does anyone know if there's a way to suppress this warning without disabling all documentation warnings?
Cheers.

Related

A persistent warning when using //nolint:godox in Golang

WARN [runner/nolint] Found unknown linters in //nolint directives: godox todo: fix once roles are in place
This warning keeps coming up when I am building my Golang project. What does this mean?
What is the meaning of unknown linters here?
I already have godox enabled in my config file for the linter but this warning doesn't seem to be going away.
found a solution to this.
I was using a nolint:godox on a todo comment and it was formatted as follows.
//nolint:godox TODO: blah blah..
Which will throw out a warning. So we need to separate the comment from the actual nolint statement.
The correct way to do it is as follows:
//nolint:godox //TODO: blah blah..

How to fix problem with Latex in R-Markdown?

I have an R Markdown issue, I am trying to write my thesis on it, when I run the code to generate the pdf, the following message is shown:
! LaTeX Error: Command \counterwithout already defined.
Or name \end... illegal, see p.192 of the manual.
Error: Failed to compile THESIS.tex. See THESIS.log for more info.
Execution halted
Any suggestion?
Found your error on TeX exchange, and the solution seems to be to define the following variables:
\let\counterwithout\relax
\let\counterwithin\relax
Before the package chngcntr (if you are using it).
(Credit to the original answer post)

How do I pass GslHeader argument to clang-tidy while using -fix option?

I couldn't find sample code for a clang-tidy command line for fixing the following error:
[archlinux#thinkpad fizzbuzz]$ clang-tidy fizzbuzz2.cpp -checks=cppcoreguidelines-pro-bounds-constant-array-index
5 warnings generated.
fizzbuzz2.cpp:21:18: warning: do not use array subscript when the index is not an integer constant expression; use gsl::at() instead [cppcoreguidelines-pro-bounds-constant-array-index]
std::cout << arr[index] << std::endl;
^
Suppressed 4 warnings (4 in non-user code).
Use -header-filter=.* to display errors from all non-system headers. Use -system-headers to display errors from system headers as well.
[archlinux#thinkpad fizzbuzz]$
I just want to find out how I can get clang-tidy to fix this automatically. If not, how should I use gsl::at() to fix this? The clang-tidy documentation says the following:
cppcoreguidelines-pro-bounds-constant-array-index
This check flags all array subscript expressions on static arrays and std::arrays that either do not have a constant integer expression index or are out of bounds (for std::array). For out-of-bounds checking of static arrays, see the -Warray-bounds Clang diagnostic.
This rule is part of the “Bounds safety” profile of the C++ Core Guidelines, see https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#Pro-bounds-arrayindex.
Options
GslHeader
The check can generate fixes after this option has been set to the name of the include file that contains gsl::at(), e.g. “gsl/gsl.h”.
IncludeStyle
A string specifying which include-style is used, llvm or google. Default is llvm.
I found the gsl::at() subroutine in <gsl/gsl_util>. How do I tell clang-tidy to use it to fix my warning?
Edit: I looked at the config string and found the solution to this:
On running:
clang-tidy fizzbuzz2.cpp -checks=cppcoreguidelines-pro-bounds-constant-array-index -dump-config
I got some hints towards the solution
clang-tidy fizzbuzz2.cpp -checks=cppcoreguidelines-pro-bounds-constant-array-index -config="{CheckOptions: [{key: cppcoreguidelines-pro-bounds-constant-array-index.GslHeader, value: gsl/gsl_util}]}" -fix
Edit: I looked at the config string and found the solution to this:
On running:
clang-tidy fizzbuzz2.cpp -checks=cppcoreguidelines-pro-bounds-constant-array-index -dump-config
I got some hints towards the solution
clang-tidy fizzbuzz2.cpp -checks=cppcoreguidelines-pro-bounds-constant-array-index -config="{CheckOptions: [{key: cppcoreguidelines-pro-bounds-constant-array-index.GslHeader, value: gsl/gsl_util}]}" -fix

Suppress never-used warnings for auto-bound event handlers in Cppcheck

I use Cppcheck 1.70 for checking C++-Builder projects. I get a lot of style warnings like this
[source\DbgRecMain.cpp:452]: (style) The function 'FormResize' is never used.
These functions are event handlers that are used, but not explicitly from within the C++ code: they are bound by the VCL runtime after loading the corresponding form or data module. Naturally, Cppcheck does not check the DFM files, that's why it cannot detect the references between events and handlers defined there.
Some options that come to my mind
Adding some explicit references, but this have to be maintained by hand.
Suppressing all warnings of this kind, but this would hide really dead code.
How can I specifically suppress these warnings about apparently unused event handlers?
There is a chapter in the CppCheck documentation about suppressing warnings/errors. Chapter 6.2 in particular will be useful to you, as you will be able to suppress warnings about the individual event handlers as needed:
Chapter 6. Suppressions
If you want to filter out certain errors you can suppress these.
6.1. Suppressing a certain error type
You can suppress certain types of errors. The format for such a suppression is one of:
[error id]:[filename]:[line]
[error id]:[filename2]
[error id]
The error id is the id that you want to suppress. The easiest way to get it is to use the --xml command line flag. Copy and paste the id string from the XML output. This may be * to suppress all warnings (for a specified file or files).
The filename may include the wildcard characters * or ?, which match any sequence of characters or any single character respectively. It is recommended that you use "/" as path separator on all operating systems.
6.1.1. Command line suppression
The --suppress= command line option is used to specify suppressions on the command line. Example:
cppcheck --suppress=memleak:src/file1.cpp src/
6.1.2. Listing suppressions in a file
You can create a suppressions file. Example:
// suppress memleak and exceptNew errors in the file src/file1.cpp
memleak:src/file1.cpp
exceptNew:src/file1.cpp
// suppress all uninitvar errors in all files
uninitvar
Note that you may add empty lines and comments in the suppressions file.
You can use the suppressions file like this:
cppcheck --suppressions-list=suppressions.txt src/
6.2. Inline suppressions
Suppressions can also be added directly in the code by adding comments that contain special keywords. Before adding such comments, consider that the code readability is sacrificed a little.
This code will normally generate an error message:
void f() {
char arr[5];
arr[10] = 0;
}
The output is:
# cppcheck test.c
Checking test.c...
[test.c:3]: (error) Array ’arr[5]’ index 10 out of bounds
To suppress the error message, a comment can be added:
void f() {
char arr[5];
// cppcheck-suppress arrayIndexOutOfBounds
arr[10] = 0;
}
Now the --inline-suppr flag can be used to suppress the warning. No error is reported when invoking cppcheck this way:
cppcheck --inline-suppr test.c
Also see the following questions for more details:
How to use cppcheck's inline suppression filter option for C++ code?
Can I include cppcheck suppression within a function header?

Lua Compiling Error 'do' expected near '['

I have a Lua file that I decompiled using unluac. When I try to recompile the files without any changes I get the following error:
lua: main.lua:647: 'do' expected near '['
I really do not know the problem here, as the while do statement follows the correct format.
The error is on line 647 as stated above.
Source is here:
Full Pastebin Source
Expressions like while {}[1] do and if {}[1].parentFolderName then are invalid because of {}[1] reference. It needs to be ({})[1]. It's probably a result of some sort of automated processing, but you should be able to fix it manually.

Resources