LEFT | RIGHT |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <title>Clang Compiler User's Manual</title> | 3 <title>Clang Compiler User's Manual</title> |
4 <link type="text/css" rel="stylesheet" href="../menu.css" /> | 4 <link type="text/css" rel="stylesheet" href="../menu.css" /> |
5 <link type="text/css" rel="stylesheet" href="../content.css" /> | 5 <link type="text/css" rel="stylesheet" href="../content.css" /> |
6 <style type="text/css"> | 6 <style type="text/css"> |
7 td { | 7 td { |
8 vertical-align: top; | 8 vertical-align: top; |
9 } | 9 } |
10 </style> | 10 </style> |
(...skipping 18 matching lines...) Expand all Loading... |
29 <li><a href="#cl_diagnostics">Options to Control Error and Warning | 29 <li><a href="#cl_diagnostics">Options to Control Error and Warning |
30 Messages</a></li> | 30 Messages</a></li> |
31 </ul> | 31 </ul> |
32 </li> | 32 </li> |
33 <li><a href="#general_features">Language and Target-Independent Features</a> | 33 <li><a href="#general_features">Language and Target-Independent Features</a> |
34 <ul> | 34 <ul> |
35 <li><a href="#diagnostics">Controlling Errors and Warnings</a></li> | 35 <li><a href="#diagnostics">Controlling Errors and Warnings</a></li> |
36 <ul> | 36 <ul> |
37 <li><a href="#diagnostics_display">Controlling How Clang Displays Diagnostics
</a></li> | 37 <li><a href="#diagnostics_display">Controlling How Clang Displays Diagnostics
</a></li> |
38 <li><a href="#diagnostics_mappings">Diagnostic Mappings</a></li> | 38 <li><a href="#diagnostics_mappings">Diagnostic Mappings</a></li> |
39 <li><a href="#diagnostics_categories">Diagnostic Categories</a><li> | 39 <li><a href="#diagnostics_categories">Diagnostic Categories</a></li> |
40 <li><a href="#diagnostics_commandline">Controlling Diagnostics via Command Li
ne Flags</a></li> | 40 <li><a href="#diagnostics_commandline">Controlling Diagnostics via Command Li
ne Flags</a></li> |
41 <li><a href="#diagnostics_pragmas">Controlling Diagnostics via Pragmas</a></l
i> | 41 <li><a href="#diagnostics_pragmas">Controlling Diagnostics via Pragmas</a></l
i> |
42 </ul> | 42 </ul> |
43 <li><a href="#precompiledheaders">Precompiled Headers</a></li> | 43 <li><a href="#precompiledheaders">Precompiled Headers</a></li> |
44 <li><a href="#codegen">Controlling Code Generation</a></li> | 44 <li><a href="#codegen">Controlling Code Generation</a></li> |
45 </ul> | 45 </ul> |
46 </li> | 46 </li> |
47 <li><a href="#c">C Language Features</a> | 47 <li><a href="#c">C Language Features</a> |
48 <ul> | 48 <ul> |
49 <li><a href="#c_ext">Extensions supported by clang</a></li> | 49 <li><a href="#c_ext">Extensions supported by clang</a></li> |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 </pre> | 380 </pre> |
381 | 381 |
382 <p>These extra tokens are not strictly conforming, and are usually best handled | 382 <p>These extra tokens are not strictly conforming, and are usually best handled |
383 by commenting them out.</p> | 383 by commenting them out.</p> |
384 | 384 |
385 <p>This option is also enabled by <a href="">-Wfoo</a>, <a href="">-Wbar</a>, | 385 <p>This option is also enabled by <a href="">-Wfoo</a>, <a href="">-Wbar</a>, |
386 and <a href="">-Wbaz</a>.</p> | 386 and <a href="">-Wbaz</a>.</p> |
387 </dd> | 387 </dd> |
388 | 388 |
389 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> | 389 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> |
390 <dt id="opt_Wrvalue-copy-ctor"><b>-Wrvalue-copy-ctor</b>: Warn about | 390 <dt id="opt_Wambiguous-member-template"><b>-Wambiguous-member-template</b>: |
391 an inaccessible copy constructor when binding an rvalue to a | 391 Warn about unqualified uses of a member template whose name resolves |
392 reference.</dt> | 392 to another template at the location of the use.</dt> |
393 <dd>This option, which defaults to on, enables warnings about binding | 393 <dd>This option, which defaults to on, enables a warning in the |
394 an rvalue to a reference when the rvalue doesn't have a usable copy | 394 following code:</p> |
| 395 |
| 396 <pre> |
| 397 template<typename T> struct set{}; |
| 398 template<typename T> struct trait { typedef const T& type; }; |
| 399 struct Value { |
| 400 template<typename T> void set(typename trait<T>::type value) {} |
| 401 }; |
| 402 void foo() { |
| 403 Value v; |
| 404 v.set<double>(3.2); |
| 405 } |
| 406 </pre> |
| 407 |
| 408 <p>C++ [basic.lookup.classref] requires this to be an error, but, |
| 409 because it's hard to work around, Clang downgrades it to a warning as |
| 410 an extension.</p> |
| 411 </dd> |
| 412 |
| 413 <!-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> |
| 414 <dt id="opt_Wbind-to-temporary-copy"><b>-Wbind-to-temporary-copy</b>: Warn about |
| 415 an unusable copy constructor when binding a reference to a temporary.</dt> |
| 416 <dd>This option, which defaults to on, enables warnings about binding a |
| 417 reference to a temporary when the temporary doesn't have a usable copy |
395 constructor. For example:</p> | 418 constructor. For example:</p> |
396 | 419 |
397 <pre> | 420 <pre> |
398 struct NonCopyable { | 421 struct NonCopyable { |
399 NonCopyable(); | 422 NonCopyable(); |
400 private: | 423 private: |
401 NonCopyable(const NonCopyable&); | 424 NonCopyable(const NonCopyable&); |
402 }; | 425 }; |
403 void foo(const NonCopyable&); | 426 void foo(const NonCopyable&); |
404 void bar() { | 427 void bar() { |
405 foo(NonCopyable()); // Disallowed in C++98; allowed in C++0x. | 428 foo(NonCopyable()); // Disallowed in C++98; allowed in C++0x. |
406 } | 429 } |
407 </pre> | 430 </pre> |
| 431 <pre> |
| 432 struct NonCopyable2 { |
| 433 NonCopyable2(); |
| 434 NonCopyable2(NonCopyable2&); |
| 435 }; |
| 436 void foo(const NonCopyable2&); |
| 437 void bar() { |
| 438 foo(NonCopyable2()); // Disallowed in C++98; allowed in C++0x. |
| 439 } |
| 440 </pre> |
| 441 |
| 442 <p>Note that if <tt>NonCopyable2::NonCopyable2()</tt> has a default |
| 443 argument whose instantiation produces a compile error, that error will |
| 444 still be a hard error in C++98 mode even if this warning is turned |
| 445 off.</p> |
408 | 446 |
409 </dd> | 447 </dd> |
410 | 448 |
411 </dl> | 449 </dl> |
412 | 450 |
413 <!-- ======================================================================= --> | 451 <!-- ======================================================================= --> |
414 <h2 id="general_features">Language and Target-Independent Features</h2> | 452 <h2 id="general_features">Language and Target-Independent Features</h2> |
415 <!-- ======================================================================= --> | 453 <!-- ======================================================================= --> |
416 | 454 |
417 | 455 |
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
930 | 968 |
931 <!-- ======================================= --> | 969 <!-- ======================================= --> |
932 <h4 id="target_os_darwin">Darwin (Mac OS/X)</h4> | 970 <h4 id="target_os_darwin">Darwin (Mac OS/X)</h4> |
933 <!-- ======================================= --> | 971 <!-- ======================================= --> |
934 | 972 |
935 <p>No __thread support, 64-bit ObjC support requires SL tools.</p> | 973 <p>No __thread support, 64-bit ObjC support requires SL tools.</p> |
936 | 974 |
937 </div> | 975 </div> |
938 </body> | 976 </body> |
939 </html> | 977 </html> |
LEFT | RIGHT |