-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
More #include suggestions (PR c++/84269)
PR c++/84269 reports a number of names in the C and C++ standard libraries for which we don't yet offer #include fix-it hints. This patch adds them (up to comment #9). gcc/c-family/ChangeLog: PR c++/84269 * known-headers.cc (get_stdlib_header_for_name): Add various names from <assert.h>, <string.h>, and <memory.h>; add more names from <stdio.h>. gcc/cp/ChangeLog: PR c++/84269 * name-lookup.c (get_std_name_hint): Add names from <memory>, <tuple>, and <utility>. gcc/testsuite/ChangeLog: PR c++/84269 * g++.dg/lookup/missing-std-include-6.C: New test. * g++.dg/lookup/missing-std-include.C: Add std::pair and std::tuple tests. * g++.dg/spellcheck-reswords.C: Expect a hint about <cstring>. * g++.dg/spellcheck-stdlib.C: Add tests for names in <cstdio>, <cstring>, <cassert>, and <cstdlib>. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@258966 138bc75d-0d04-0410-961f-82ee72b054a4
- Loading branch information
dmalcolm
committed
Mar 29, 2018
1 parent
9830757
commit 5760796
Showing
9 changed files
with
213 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,10 @@ | ||
2018-03-29 David Malcolm <[email protected]> | ||
|
||
PR c++/84269 | ||
* known-headers.cc (get_stdlib_header_for_name): Add various names | ||
from <assert.h>, <string.h>, and <memory.h>; add more names from | ||
<stdio.h>. | ||
|
||
2018-03-27 Jakub Jelinek <[email protected]> | ||
|
||
PR c++/85061 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
2018-03-29 David Malcolm <[email protected]> | ||
|
||
PR c++/84269 | ||
* name-lookup.c (get_std_name_hint): Add names from <memory>, | ||
<tuple>, and <utility>. | ||
|
||
2018-03-29 Jason Merrill <[email protected]> | ||
|
||
PR c++/85093 - too many template args with pack expansion. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,13 @@ | ||
2018-03-29 David Malcolm <[email protected]> | ||
|
||
PR c++/84269 | ||
* g++.dg/lookup/missing-std-include-6.C: New test. | ||
* g++.dg/lookup/missing-std-include.C: Add std::pair and | ||
std::tuple tests. | ||
* g++.dg/spellcheck-reswords.C: Expect a hint about <cstring>. | ||
* g++.dg/spellcheck-stdlib.C: Add tests for names in <cstdio>, | ||
<cstring>, <cassert>, and <cstdlib>. | ||
|
||
2018-03-29 Vladimir Makarov <[email protected]> | ||
|
||
PR inline-asm/84985 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
// { dg-do compile { target c++11 } } | ||
|
||
/* <memory>. */ | ||
|
||
template<class T> | ||
void test_make_shared () | ||
{ | ||
auto p = std::make_shared<T>(); // { dg-error "'make_shared' is not a member of 'std'" } | ||
// { dg-message "'#include <memory>'" "" { target *-*-* } .-1 } | ||
// { dg-error "expected primary-expression before '>' token" "" { target *-*-* } .-2 } | ||
// { dg-error "expected primary-expression before '\\)' token" "" { target *-*-* } .-3 } | ||
} | ||
|
||
template<class T> | ||
void test_make_unique () | ||
{ | ||
auto p = std::make_unique<T>(); // { dg-error "'make_unique' is not a member of 'std'" } | ||
// { dg-message "'#include <memory>'" "" { target *-*-* } .-1 } | ||
// { dg-error "expected primary-expression before '>' token" "" { target *-*-* } .-2 } | ||
// { dg-error "expected primary-expression before '\\)' token" "" { target *-*-* } .-3 } | ||
} | ||
|
||
std::shared_ptr<int> test_shared_ptr; // { dg-error "'shared_ptr' in namespace 'std' does not name a template type" } | ||
// { dg-message "'#include <memory>'" "" { target *-*-* } .-1 } | ||
|
||
std::unique_ptr<int> test_unique_ptr; // { dg-error "'unique_ptr' in namespace 'std' does not name a template type" } | ||
// { dg-message "'#include <memory>'" "" { target *-*-* } .-1 } | ||
|
||
std::weak_ptr<int> test_weak_ptr; // { dg-error "'weak_ptr' in namespace 'std' does not name a template type" } | ||
// { dg-message "'#include <memory>'" "" { target *-*-* } .-1 } | ||
|
||
/* <tuple>. */ | ||
|
||
void test_make_tuple (int i, int j, int k) | ||
{ | ||
auto t = std::make_tuple (i, j, k); // { dg-error "'make_tuple' is not a member of 'std'" } | ||
// { dg-message "'#include <tuple>'" "" { target *-*-* } .-1 } | ||
} | ||
|
||
/* <utility>. */ | ||
|
||
template<class T> | ||
void test_forward(T&& arg) | ||
{ | ||
std::forward<T>(arg); // { dg-error "'forward' is not a member of 'std'" } | ||
// { dg-message "'#include <utility>'" "" { target *-*-* } .-1 } | ||
// { dg-error "expected primary-expression before '>' token" "" { target *-*-* } .-2 } | ||
} | ||
|
||
void test_make_pair (int i, int j) | ||
{ | ||
auto p = std::make_pair (i, j); // { dg-error "'make_pair' is not a member of 'std'" } | ||
// { dg-message "'#include <utility>'" "" { target *-*-* } .-1 } | ||
} | ||
|
||
template<class T> | ||
void test_move(T&& arg) | ||
{ | ||
std::move<T>(arg); // { dg-error "'move' is not a member of 'std'" } | ||
// { dg-message "'#include <utility>'" "" { target *-*-* } .-1 } | ||
// { dg-error "expected primary-expression before '>' token" "" { target *-*-* } .-2 } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters