diff options
author | Etienne Bergeron <etienneb@google.com> | 2016-04-05 01:41:02 +0000 |
---|---|---|
committer | Etienne Bergeron <etienneb@google.com> | 2016-04-05 01:41:02 +0000 |
commit | 009ec085db1f1a6d1f17149cca0e67eefd63397c (patch) | |
tree | 561b622f6df875cf2b66c9915ce17280d2dadaf1 /clang-tools-extra/docs/clang-tidy | |
parent | 5cea969dca1964c6b9d600f6668a27f09150d753 (diff) | |
download | bcm5719-llvm-009ec085db1f1a6d1f17149cca0e67eefd63397c.tar.gz bcm5719-llvm-009ec085db1f1a6d1f17149cca0e67eefd63397c.zip |
[clang-tidy] Fix documentation of misc-suspicious-missing-comma
Summary:
The clang-tidy documentation generation was broken since commit : http://reviews.llvm.org/D18457
I ran locally the documentation generation and I fixed errors related to that specific check.
Reviewers: alexfh
Subscribers: cfe-commits
Differential Revision: http://reviews.llvm.org/D18764
llvm-svn: 265375
Diffstat (limited to 'clang-tools-extra/docs/clang-tidy')
-rw-r--r-- | clang-tools-extra/docs/clang-tidy/checks/misc-suspicious-missing-comma.rst | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/clang-tools-extra/docs/clang-tidy/checks/misc-suspicious-missing-comma.rst b/clang-tools-extra/docs/clang-tidy/checks/misc-suspicious-missing-comma.rst index e46566a3491..5f67f08e454 100644 --- a/clang-tools-extra/docs/clang-tidy/checks/misc-suspicious-missing-comma.rst +++ b/clang-tools-extra/docs/clang-tidy/checks/misc-suspicious-missing-comma.rst @@ -7,14 +7,19 @@ String literals placed side-by-side are concatenated at translation phase 6 (after the preprocessor). This feature is used to represent long string literal on multiple lines. -For instance, these declarations are equivalent: +For instance, the following declarations are equivalent: + +.. code:: c++ + const char* A[] = "This is a test"; - const char* B[] = "This" " is a " - "test"; + const char* B[] = "This" " is a " "test"; + A common mistake done by programmers is to forget a comma between two string literals in an array initializer list. +.. code:: c++ + const char* Test[] = { "line 1", "line 2" // Missing comma! @@ -23,13 +28,17 @@ literals in an array initializer list. "line 5" }; + The array contains the string "line 2line3" at offset 1 (i.e. Test[1]). Clang won't generate warnings at compile time. This checker may warn incorrectly on cases like: +.. code:: c++ + const char* SupportedFormat[] = { "Error %s", "Code " PRIu64, // May warn here. "Warning %s", }; + |