diff --git a/www/diagnostics.html b/www/diagnostics.html index 4f68f58d52..5be4db2074 100644 --- a/www/diagnostics.html +++ b/www/diagnostics.html @@ -200,8 +200,37 @@ void addHTTPService(servers::Server const &server, ::services::WebService const

Fix-it Hints

-

simple example + template<> example

+

"Fix-it" hints provide advice for fixing small, localized problems +in source code. When Clang produces a diagnostic about a particular +problem that it can work around (e.g., non-standard or redundant +syntax, missing keywords, common mistakes, etc.), it may also provide +specific guidance in the form of a code transformation to correct the +problem. For example, here Clang warns about the use of a GCC +extension that has been considered obsolete since 1993:

+
+  $ clang t.c
+  t.c:5:28: warning: use of GNU old-style field designator extension
+  struct point origin = { x: 0.0, y: 0.0 };
+                          ~~ ^
+                          .x = 
+  t.c:5:36: warning: use of GNU old-style field designator extension
+  struct point origin = { x: 0.0, y: 0.0 };
+                                  ~~ ^
+                                  .y = 
+
+ +

The underlined code should be removed, then replaced with the code below the caret line (".x =" or ".y =", respectively). "Fix-it" hints are most useful for working around common user errors and misconceptions. For example, C++ users commonly forget the syntax for explicit specialization of class templates, as in the following error:

+ +
+  $ clang t.cpp
+  t.cpp:9:3: error: template specialization requires 'template<>'
+    struct iterator_traits<file_iterator> {
+    ^
+    template<> 
+
+ +

Again, after describing the problem, Clang provides the fix--add template<>--as part of the diagnostic.

Automatic Macro Expansion