* auto-profile.c (afdo_annotate_cfg): Use update_max_bb_count.
[official-gcc.git] / gcc / testsuite / g++.dg / lookup / missing-std-include-2.C
blob51c604a9f1e2afc667a244e566d41cd34f5c78f1
1 /* Example of fix-it hints that add #include directives,
2    adding them after a pre-existing #include.  */
4 /* { dg-options "-fdiagnostics-generate-patch" } */
6 /* This is padding (to avoid the generated patch containing DejaGnu
7    directives).  */
9 #include "empty.h"
11 namespace std
13   extern int sprintf (char *dst, const char *format, ...);
16 void test (void)
18   std::string s ("hello world"); // { dg-error ".string. is not a member of .std." }
19   // { dg-message ".std::string. is defined in header .<string>.; did you forget to .#include <string>.?" "" { target *-*-* } .-1 }
21   std::cout << 10; // { dg-error ".cout. is not a member of .std." }
22   // { dg-message ".std::cout. is defined in header .<iostream>.; did you forget to .#include <iostream>.?" "" { target *-*-* } .-1 }
25 /* Same again, to test idempotency of the added "#include" fix-it.  */
27 void test_2 (void)
29   std::string s ("hello again"); // { dg-error ".string. is not a member of .std." }
30   // { dg-message ".std::string. is defined in header .<string>.; did you forget to .#include <string>.?" "" { target *-*-* } .-1 }
32   std::cout << 10; // { dg-error ".cout. is not a member of .std." }
33   // { dg-message ".std::cout. is defined in header .<iostream>.; did you forget to .#include <iostream>.?" "" { target *-*-* } .-1 }
36 /* Verify the output from -fdiagnostics-generate-patch.
37    We expect the patch to begin with a header, containing this
38    source filename, via an absolute path.
39    Given the path, we can only capture it via regexps.  */
40 /* { dg-regexp "\\-\\-\\- .*" } */
41 /* { dg-regexp "\\+\\+\\+ .*" } */
43 /* Verify the hunks within the patch.
44    Use #if 0/#endif rather than comments, to allow the text to contain
45    a comment.
46    We expect a "#include <string>" and "#include <iostream>" to each have been
47    added once, immediately below the last #include.  */
48 #if 0
49 { dg-begin-multiline-output "" }
50 @@ -7,6 +7,8 @@
51     directives).  */
53  #include "empty.h"
54 +#include <string>
55 +#include <iostream>
57  namespace std
58  {
59 { dg-end-multiline-output "" }
60 #endif