Skip to content

Commit 875b853

Browse files
author
serge-sans-paille
committed
[clang-tidy] Fix reST syntax
Authored by Eisuke Kawashima [#245]
1 parent 576bd52 commit 875b853

21 files changed

+107
-103
lines changed

clang-tools-extra/docs/clang-tidy/checks/bugprone-argument-comment.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ Options
2929
account.
3030

3131
.. option:: IgnoreSingleArgument
32+
3233
When true, the check will ignore the single argument.
3334

3435
.. option:: CommentBoolLiterals

clang-tools-extra/docs/clang-tidy/checks/bugprone-exception-escape.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ bugprone-exception-escape
55

66
Finds functions which may throw an exception directly or indirectly, but they
77
should not. The functions which should not throw exceptions are the following:
8+
89
* Destructors
910
* Move constructors
1011
* Move assignment operators

clang-tools-extra/docs/clang-tidy/checks/bugprone-forwarding-reference-overload.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ The check warns for constructors C1 and C2, because those can hide copy and move
3737
constructors. We suppress warnings if the copy and the move constructors are both
3838
disabled (deleted or private), because there is nothing the perfect forwarding
3939
constructor could hide in this case. We also suppress warnings for constructors
40-
like C3 that are guarded with an enable_if, assuming the programmer was aware of
40+
like C3 that are guarded with an ``enable_if``, assuming the programmer was aware of
4141
the possible hiding.
4242

4343
Background
4444
----------
4545

4646
For deciding whether a constructor is guarded with enable_if, we consider the
4747
default values of the type parameters and the types of the constructor
48-
parameters. If any part of these types is std::enable_if or std::enable_if_t, we
49-
assume the constructor is guarded.
48+
parameters. If any part of these types is ``std::enable_if`` or ``std::enable_if_t``,
49+
we assume the constructor is guarded.

clang-tools-extra/docs/clang-tidy/checks/bugprone-lambda-function-name.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ is almost never what was intended.
1010
Example:
1111

1212
.. code-block:: c++
13-
13+
1414
void FancyFunction() {
1515
[] { printf("Called from %s\n", __func__); }();
1616
[] { printf("Now called from %s\n", __FUNCTION__); }();

clang-tools-extra/docs/clang-tidy/checks/bugprone-not-null-terminated-result.rst

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ bugprone-not-null-terminated-result
55

66
Finds function calls where it is possible to cause a not null-terminated result.
77
Usually the proper length of a string is ``strlen(src) + 1`` or equal length of
8-
this expression, because the null terminator needs an extra space. Without the
8+
this expression, because the null terminator needs an extra space. Without the
99
null terminator it can result in undefined behaviour when the string is read.
1010

1111
The following and their respective ``wchar_t`` based functions are checked:
@@ -17,27 +17,27 @@ The following is a real-world example where the programmer forgot to increase
1717
the passed third argument, which is ``size_t length``. That is why the length
1818
of the allocated memory is not enough to hold the null terminator.
1919

20-
.. code-block:: c
20+
.. code-block:: c
2121
22-
static char *stringCpy(const std::string &str) {
23-
char *result = reinterpret_cast<char *>(malloc(str.size()));
24-
memcpy(result, str.data(), str.size());
25-
return result;
26-
}
22+
static char *stringCpy(const std::string &str) {
23+
char *result = reinterpret_cast<char *>(malloc(str.size()));
24+
memcpy(result, str.data(), str.size());
25+
return result;
26+
}
2727
2828
In addition to issuing warnings, fix-it rewrites all the necessary code. It also
2929
tries to adjust the capacity of the destination array:
3030

31-
.. code-block:: c
31+
.. code-block:: c
3232
33-
static char *stringCpy(const std::string &str) {
34-
char *result = reinterpret_cast<char *>(malloc(str.size() + 1));
35-
strcpy(result, str.data());
36-
return result;
37-
}
33+
static char *stringCpy(const std::string &str) {
34+
char *result = reinterpret_cast<char *>(malloc(str.size() + 1));
35+
strcpy(result, str.data());
36+
return result;
37+
}
3838
3939
Note: It cannot guarantee to rewrite every of the path-sensitive memory
40-
allocations.
40+
allocations.
4141

4242
.. _MemcpyTransformation:
4343

clang-tools-extra/docs/clang-tidy/checks/bugprone-suspicious-include.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@ Options
1919
-------
2020
.. option:: HeaderFileExtensions
2121

22-
Default value: `";h;hh;hpp;hxx"`
22+
Default value: ``";h;hh;hpp;hxx"``
2323
A semicolon-separated list of filename extensions of header files (the
2424
filename extensions should not contain a "." prefix). For extension-less
2525
header files, use an empty string or leave an empty string between ";"
2626
if there are other filename extensions.
2727

2828
.. option:: ImplementationFileExtensions
2929

30-
Default value: `"c;cc;cpp;cxx"`
30+
Default value: ``"c;cc;cpp;cxx"``
3131
Likewise, a semicolon-separated list of filename extensions of
3232
implementation files.

clang-tools-extra/docs/clang-tidy/checks/bugprone-suspicious-missing-comma.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,14 @@ Options
4646
.. option:: SizeThreshold
4747

4848
An unsigned integer specifying the minimum size of a string literal to be
49-
considered by the check. Default is `5U`.
49+
considered by the check. Default is ``5U``.
5050

5151
.. option:: RatioThreshold
5252

5353
A string specifying the maximum threshold ratio [0, 1.0] of suspicious string
54-
literals to be considered. Default is `".2"`.
54+
literals to be considered. Default is ``".2"``.
5555

5656
.. option:: MaxConcatenatedTokens
5757

5858
An unsigned integer specifying the maximum number of concatenated tokens.
59-
Default is `5U`.
59+
Default is ``5U``.

clang-tools-extra/docs/clang-tidy/checks/bugprone-terminating-continue.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
bugprone-terminating-continue
44
=============================
55

6-
Detects `do while` loops with a condition always evaluating to false that
7-
have a `continue` statement, as this `continue` terminates the loop
6+
Detects ``do while`` loops with a condition always evaluating to false that
7+
have a ``continue`` statement, as this ``continue`` terminates the loop
88
effectively.
99

1010
.. code-block:: c++
1111

1212
void f() {
1313
do {
14-
// some code
14+
// some code
1515
continue; // terminating continue
1616
// some other code
1717
} while(false);
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
.. title:: clang-tidy - cert-con36-c
22
.. meta::
33
:http-equiv=refresh: 5;URL=bugprone-spuriously-wake-up-functions.html
4-
4+
55
cert-con36-c
66
============
77

88
The cert-con36-c check is an alias, please see
9-
`bugprone-spuriously-wake-up-functions <bugprone-spuriously-wake-up-functions.html>`_
9+
`bugprone-spuriously-wake-up-functions <bugprone-spuriously-wake-up-functions.html>`_
1010
for more information.
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
.. title:: clang-tidy - cert-con54-cpp
22
.. meta::
33
:http-equiv=refresh: 5;URL=bugprone-spuriously-wake-up-functions.html
4-
4+
55
cert-con54-cpp
66
==============
77

88
The cert-con54-cpp check is an alias, please see
9-
`bugprone-spuriously-wake-up-functions <bugprone-spuriously-wake-up-functions.html>`_
9+
`bugprone-spuriously-wake-up-functions <bugprone-spuriously-wake-up-functions.html>`_
1010
for more information.

clang-tools-extra/docs/clang-tidy/checks/cppcoreguidelines-avoid-non-const-global-variables.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
cppcoreguidelines-avoid-non-const-global-variables
44
==================================================
55

6-
Finds non-const global variables as described in `I.2 of C++ Core Guidelines <https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#Ri-global>` .
7-
As `R.6 of C++ Core Guidelines <https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#Rr-global>` is a duplicate of rule I.2 it also covers that rule.
6+
Finds non-const global variables as described in `I.2 of C++ Core Guidelines <https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#Ri-global>`_ .
7+
As `R.6 of C++ Core Guidelines <https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#Rr-global>`_ is a duplicate of rule I.2 it also covers that rule.
88

99
.. code-block:: c++
1010

clang-tools-extra/docs/clang-tidy/checks/google-objc-global-variable-declaration.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ pattern of variable names in Google's Objective-C Style Guide.
99
The corresponding style guide rule:
1010
https://google.github.io/styleguide/objcguide.html#variable-names
1111

12-
All the global variables should follow the pattern of `g[A-Z].*` (variables) or
13-
`k[A-Z].*` (constants). The check will suggest a variable name that follows the
12+
All the global variables should follow the pattern of ``g[A-Z].*`` (variables) or
13+
``k[A-Z].*`` (constants). The check will suggest a variable name that follows the
1414
pattern if it can be inferred from the original name.
1515

1616
For code:

clang-tools-extra/docs/clang-tidy/checks/google-readability-casting.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,6 @@ https://google.github.io/styleguide/cppguide.html#Casting
99

1010
Corresponding cpplint.py check name: `readability/casting`.
1111

12-
This check is similar to `-Wold-style-cast`, but it suggests automated fixes
12+
This check is similar to ``-Wold-style-cast``, but it suggests automated fixes
1313
in some cases. The reported locations should not be different from the
14-
ones generated by `-Wold-style-cast`.
14+
ones generated by ``-Wold-style-cast``.

clang-tools-extra/docs/clang-tidy/checks/misc-misplaced-const.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ This check diagnoses when a ``const`` qualifier is applied to a ``typedef``/
88
are often misleading to developers because the ``const`` applies to the pointer
99
rather than the pointee.
1010

11-
For instance, in the following code, the resulting type is ``int *`` ``const``
11+
For instance, in the following code, the resulting type is ``int * const``
1212
rather than ``const int *``:
1313

1414
.. code-block:: c++

clang-tools-extra/docs/clang-tidy/checks/misc-no-recursion.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@ diagnoses each function in the cycle,
99
and displays one example of a possible call graph loop (recursion).
1010

1111
References:
12+
1213
* CERT C++ Coding Standard rule `DCL56-CPP. Avoid cycles during initialization of static objects <https://wiki.sei.cmu.edu/confluence/display/cplusplus/DCL56-CPP.+Avoid+cycles+during+initialization+of+static+objects>`_.
1314
* JPL Institutional Coding Standard for the C Programming Language (JPL DOCID D-60411) rule `2.4 Do not use direct or indirect recursion`.
1415
* OpenCL Specification, Version 1.2 rule `6.9 Restrictions: i. Recursion is not supported. <https://www.khronos.org/registry/OpenCL/specs/opencl-1.2.pdf>`_.
1516

1617
Limitations:
18+
1719
* The check does not handle calls done through function pointers
1820
* The check does not handle C++ destructors

clang-tools-extra/docs/clang-tidy/checks/misc-unused-parameters.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ code (e.g. when a different parameter is used instead). The suggested fixes
88
either comment parameter name out or remove the parameter completely, if all
99
callers of the function are in the same translation unit and can be updated.
1010

11-
The check is similar to the `-Wunused-parameter` compiler diagnostic and can be
11+
The check is similar to the ``-Wunused-parameter`` compiler diagnostic and can be
1212
used to prepare a codebase to enabling of that diagnostic. By default the check
1313
is more permissive (see :option:`StrictMode`).
1414

clang-tools-extra/docs/clang-tidy/checks/modernize-replace-disallow-copy-and-assign-macro.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Known Limitations
3737
-----------------
3838

3939
* Notice that the migration example above leaves the ``private`` access
40-
specification untouched. You might want to run the check:doc:`modernize-use-equals-delete
40+
specification untouched. You might want to run the check :doc:`modernize-use-equals-delete
4141
<modernize-use-equals-delete>` to get warnings for deleted functions in
4242
private sections.
4343

clang-tools-extra/docs/clang-tidy/checks/modernize-use-noexcept.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,25 @@ Example
1515
.. code-block:: c++
1616

1717
void foo() throw();
18-
void bar() throw(int) {}
18+
void bar() throw(int) {}
1919

2020
transforms to:
2121

2222
.. code-block:: c++
2323

2424
void foo() noexcept;
25-
void bar() noexcept(false) {}
25+
void bar() noexcept(false) {}
2626

2727
Options
2828
-------
2929

3030
.. option:: ReplacementString
3131

32-
Users can use :option:`ReplacementString` to specify a macro to use
33-
instead of ``noexcept``. This is useful when maintaining source code
34-
that uses custom exception specification marking other than
35-
``noexcept``. Fix-it hints will only be generated for non-throwing
36-
specifications.
32+
Users can use :option:`ReplacementString` to specify a macro to use
33+
instead of ``noexcept``. This is useful when maintaining source code
34+
that uses custom exception specification marking other than
35+
``noexcept``. Fix-it hints will only be generated for non-throwing
36+
specifications.
3737

3838
Example
3939
^^^^^^^

clang-tools-extra/docs/clang-tidy/checks/modernize-use-uncaught-exceptions.rst

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -12,53 +12,53 @@ they will be replaced with.
1212

1313
.. code-block:: c++
1414

15-
#define MACRO1 std::uncaught_exception
16-
#define MACRO2 std::uncaught_exception
17-
18-
int uncaught_exception() {
19-
return 0;
20-
}
21-
22-
int main() {
23-
int res;
24-
25-
res = uncaught_exception();
26-
// No warning, since it is not the deprecated function from namespace std
27-
28-
res = MACRO2();
29-
// Warning, but will not be replaced
30-
31-
res = std::uncaught_exception();
32-
// Warning and replaced
33-
34-
using std::uncaught_exception;
35-
// Warning and replaced
36-
37-
res = uncaught_exception();
38-
// Warning and replaced
39-
}
15+
#define MACRO1 std::uncaught_exception
16+
#define MACRO2 std::uncaught_exception
17+
18+
int uncaught_exception() {
19+
return 0;
20+
}
21+
22+
int main() {
23+
int res;
24+
25+
res = uncaught_exception();
26+
// No warning, since it is not the deprecated function from namespace std
27+
28+
res = MACRO2();
29+
// Warning, but will not be replaced
30+
31+
res = std::uncaught_exception();
32+
// Warning and replaced
33+
34+
using std::uncaught_exception;
35+
// Warning and replaced
36+
37+
res = uncaught_exception();
38+
// Warning and replaced
39+
}
4040

4141
After applying the fixes the code will look like the following:
4242

4343
.. code-block:: c++
4444

45-
#define MACRO1 std::uncaught_exception
46-
#define MACRO2 std::uncaught_exception
47-
48-
int uncaught_exception() {
49-
return 0;
50-
}
51-
52-
int main() {
53-
int res;
54-
55-
res = uncaught_exception();
56-
57-
res = MACRO2();
58-
59-
res = std::uncaught_exceptions();
60-
61-
using std::uncaught_exceptions;
62-
63-
res = uncaught_exceptions();
64-
}
45+
#define MACRO1 std::uncaught_exception
46+
#define MACRO2 std::uncaught_exception
47+
48+
int uncaught_exception() {
49+
return 0;
50+
}
51+
52+
int main() {
53+
int res;
54+
55+
res = uncaught_exception();
56+
57+
res = MACRO2();
58+
59+
res = std::uncaught_exceptions();
60+
61+
using std::uncaught_exceptions;
62+
63+
res = uncaught_exceptions();
64+
}

clang-tools-extra/docs/clang-tidy/checks/readability-const-return-type.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ return types.
1111
Examples:
1212

1313
.. code-block:: c++
14-
14+
1515
const int foo();
1616
const Clazz foo();
1717
Clazz *const foo();

0 commit comments

Comments
 (0)