[2/2] Add more entries to the C++ get_std_name_hint array
diff mbox series

Message ID 20190813133630.GG9487@redhat.com
State New
Headers show
Series
  • [1/2] PR c++/91436 fix C++ dialect for std::make_unique fix-it hint
Related show

Commit Message

Jonathan Wakely Aug. 13, 2019, 1:36 p.m. UTC
This adds some commonly-used C++11/14 names, and some new C++17/20
names. The latter aren't available when using the -std=gnu++14
default, so the fix-it suggesting to use a newer dialect is helpful.

	* name-lookup.c (get_std_name_hint): Add more entries.

Tested x86_64-linux. OK for trunk?

Comments

Jason Merrill Aug. 13, 2019, 8:08 p.m. UTC | #1
On 8/13/19 9:36 AM, Jonathan Wakely wrote:
> This adds some commonly-used C++11/14 names, and some new C++17/20
> names. The latter aren't available when using the -std=gnu++14
> default, so the fix-it suggesting to use a newer dialect is helpful.
> 
>      * name-lookup.c (get_std_name_hint): Add more entries.
> 
> Tested x86_64-linux. OK for trunk?
> 
OK.

Jason
Jonathan Wakely Aug. 14, 2019, 10:24 a.m. UTC | #2
On 13/08/19 16:08 -0400, Jason Merrill wrote:
>On 8/13/19 9:36 AM, Jonathan Wakely wrote:
>>This adds some commonly-used C++11/14 names, and some new C++17/20
>>names. The latter aren't available when using the -std=gnu++14
>>default, so the fix-it suggesting to use a newer dialect is helpful.
>>
>>     * name-lookup.c (get_std_name_hint): Add more entries.
>>
>>Tested x86_64-linux. OK for trunk?
>>
>OK.

I realised as I was about to commit it that cxx17 is the wrong dialect
for remove_cvref and remove_cvref_t, so I corrected them to cxx2a
before committing it.

(I've tried to use remove_cvref_t in C++17 a few times, so this
diagnostic should help me!)

Patch
diff mbox series

commit 0c12d092e5659689951b5e134b84c5b506b543d5
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Tue Aug 13 13:42:40 2019 +0100

    Add more entries to the C++ get_std_name_hint array
    
            * name-lookup.c (get_std_name_hint): Add more entries.

diff --git a/gcc/cp/name-lookup.c b/gcc/cp/name-lookup.c
index 96b2d90540d..68ebd7655c7 100644
--- a/gcc/cp/name-lookup.c
+++ b/gcc/cp/name-lookup.c
@@ -5550,9 +5550,11 @@  get_std_name_hint (const char *name)
     {"make_any", "<any>", cxx17},
     /* <array>.  */
     {"array", "<array>", cxx11},
+    {"to_array", "<array>", cxx2a},
     /* <atomic>.  */
     {"atomic", "<atomic>", cxx11},
     {"atomic_flag", "<atomic>", cxx11},
+    {"atomic_ref", "<atomic>", cxx2a},
     /* <bitset>.  */
     {"bitset", "<bitset>", cxx11},
     /* <complex>.  */
@@ -5575,9 +5577,17 @@  get_std_name_hint (const char *name)
     {"ofstream", "<fstream>", cxx98},
     /* <functional>.  */
     {"bind", "<functional>", cxx11},
+    {"bind_front", "<functional>", cxx2a},
     {"function", "<functional>", cxx11},
     {"hash", "<functional>", cxx11},
+    {"invoke", "<functional>", cxx17},
     {"mem_fn", "<functional>", cxx11},
+    {"not_fn", "<functional>", cxx17},
+    {"reference_wrapper", "<functional>", cxx11},
+    {"unwrap_reference", "<functional>", cxx2a},
+    {"unwrap_reference_t", "<functional>", cxx2a},
+    {"unwrap_ref_decay", "<functional>", cxx2a},
+    {"unwrap_ref_decay_t", "<functional>", cxx2a},
     /* <future>. */
     {"async", "<future>", cxx11},
     {"future", "<future>", cxx11},
@@ -5618,11 +5628,16 @@  get_std_name_hint (const char *name)
     {"map", "<map>", cxx98},
     {"multimap", "<map>", cxx98},
     /* <memory>.  */
+    {"allocate_shared", "<memory>", cxx11},
+    {"allocator", "<memory>", cxx98},
+    {"allocator_traits", "<memory>", cxx11},
     {"make_shared", "<memory>", cxx11},
     {"make_unique", "<memory>", cxx14},
     {"shared_ptr", "<memory>", cxx11},
     {"unique_ptr", "<memory>", cxx11},
     {"weak_ptr", "<memory>", cxx11},
+    /* <memory_resource>.  */
+    {"pmr", "<memory_resource>", cxx17},
     /* <mutex>.  */
     {"mutex", "<mutex>", cxx11},
     {"timed_mutex", "<mutex>", cxx11},
@@ -5672,14 +5687,39 @@  get_std_name_hint (const char *name)
     {"u16string", "<string>", cxx11},
     {"u32string", "<string>", cxx11},
     /* <string_view>.  */
+    {"basic_string_view", "<string_view>", cxx17},
     {"string_view", "<string_view>", cxx17},
     /* <thread>.  */
     {"thread", "<thread>", cxx11},
+    {"this_thread", "<thread>", cxx11},
     /* <tuple>.  */
+    {"apply", "<tuple>", cxx17},
+    {"forward_as_tuple", "<tuple>", cxx11},
+    {"make_from_tuple", "<tuple>", cxx17},
     {"make_tuple", "<tuple>", cxx11},
+    {"tie", "<tuple>", cxx11},
     {"tuple", "<tuple>", cxx11},
+    {"tuple_cat", "<tuple>", cxx11},
     {"tuple_element", "<tuple>", cxx11},
+    {"tuple_element_t", "<tuple>", cxx14},
     {"tuple_size", "<tuple>", cxx11},
+    {"tuple_size_v", "<tuple>", cxx17},
+    /* <type_traits>.  */
+    {"enable_if", "<type_traits>", cxx11},
+    {"enable_if_t", "<type_traits>", cxx14},
+    {"invoke_result", "<type_traits>", cxx17},
+    {"invoke_result_t", "<type_traits>", cxx17},
+    {"remove_cvref", "<type_traits>", cxx17},
+    {"remove_cvref_t", "<type_traits>", cxx17},
+    {"type_identity", "<type_traits>", cxx2a},
+    {"type_identity_t", "<type_traits>", cxx2a},
+    {"void_t", "<type_traits>", cxx17},
+    {"conjunction", "<type_traits>", cxx17},
+    {"conjunction_v", "<type_traits>", cxx17},
+    {"disjunction", "<type_traits>", cxx17},
+    {"disjunction_v", "<type_traits>", cxx17},
+    {"negation", "<type_traits>", cxx17},
+    {"negation_v", "<type_traits>", cxx17},
     /* <unordered_map>.  */
     {"unordered_map", "<unordered_map>", cxx11},
     {"unordered_multimap", "<unordered_map>", cxx11},