public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* add more C++ name hints
@ 2022-08-05 19:35 Ulrich Drepper
  2022-08-17 10:29 ` Ulrich Drepper
  2022-08-17 12:17 ` Marek Polacek
  0 siblings, 2 replies; 3+ messages in thread
From: Ulrich Drepper @ 2022-08-05 19:35 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 402 bytes --]

How about adding a few more names from the std namespace to get appropriate
hints?  This patch compiles and the appropriate messages are printed.  Is
there a problem with just adding more or even at some point all the symbols
of the standard library?

gcc/ChangeLog:

        * cp/name-lookup.cc (get_std_name_hint): Add more symbols from the
        <iomanip>, <ios>, <istream> and <ostream> headers.

[-- Attachment #2: d-g++-std-io-syms-hints --]
[-- Type: application/octet-stream, Size: 2509 bytes --]

diff --git a/gcc/cp/name-lookup.cc b/gcc/cp/name-lookup.cc
index ce622761a1a..e77065b83b7 100644
--- a/gcc/cp/name-lookup.cc
+++ b/gcc/cp/name-lookup.cc
@@ -6771,6 +6771,43 @@ get_std_name_hint (const char *name)
     {"future", "<future>", cxx11},
     {"packaged_task", "<future>", cxx11},
     {"promise", "<future>", cxx11},
+    /* <iomanip>.  */
+    {"resetiosflags", "<iomanip>", cxx98},
+    {"setiosflags", "<iomanip>", cxx98},
+    {"setbase", "<iomanip>", cxx98},
+    {"setfill", "<iomanip>", cxx98},
+    {"setprecision", "<iomanip>", cxx98},
+    {"setw", "<iomanip>", cxx98},
+    {"get_money", "<iomanip>", cxx11},
+    {"put_money", "<iomanip>", cxx11},
+    {"get_time", "<iomanip>", cxx11},
+    {"put_time", "<iomanip>", cxx11},
+    {"quoted", "<iomanip>", cxx14},
+    /* <ios>.  */
+    {"boolalpha", "<ios>", cxx98},
+    {"noboolalpha", "<ios>", cxx98},
+    {"showbase", "<ios>", cxx98},
+    {"noshowbase", "<ios>", cxx98},
+    {"showpoint", "<ios>", cxx98},
+    {"noshowpoint", "<ios>", cxx98},
+    {"showpos", "<ios>", cxx98},
+    {"noshowpos", "<ios>", cxx98},
+    {"skipws", "<ios>", cxx98},
+    {"noskipws", "<ios>", cxx98},
+    {"uppercase", "<ios>", cxx98},
+    {"nouppercase", "<ios>", cxx98},
+    {"unitbuf", "<ios>", cxx98},
+    {"nounitbuf", "<ios>", cxx98},
+    {"internal", "<ios>", cxx98},
+    {"left", "<ios>", cxx98},
+    {"right", "<ios>", cxx98},
+    {"dec", "<ios>", cxx98},
+    {"hex", "<ios>", cxx98},
+    {"oct", "<ios>", cxx98},
+    {"fixed", "<ios>", cxx98},
+    {"scientific", "<ios>", cxx98},
+    {"hexfloat", "<ios>", cxx11},
+    {"defaultfloat", "<ios>", cxx11},
     /* <iostream>.  */
     {"cin", "<iostream>", cxx98},
     {"cout", "<iostream>", cxx98},
@@ -6781,6 +6818,7 @@ get_std_name_hint (const char *name)
     {"wclog", "<iostream>", cxx98},
     /* <istream>.  */
     {"istream", "<istream>", cxx98},
+    {"ws", "<istream>", cxx98},
     /* <iterator>.  */
     {"advance", "<iterator>", cxx98},
     {"back_inserter", "<iterator>", cxx98},
@@ -6800,6 +6838,12 @@ get_std_name_hint (const char *name)
     {"reverse_iterator", "<iterator>", cxx98},
     /* <ostream>.  */
     {"ostream", "<ostream>", cxx98},
+    {"ends", "<ostream>", cxx98},
+    {"flush", "<ostream>", cxx98},
+    {"endl", "<ostream>", cxx98},
+    {"emit_on_flush", "<ostream>", cxx20},
+    {"noemit_on_flush", "<ostream>", cxx20},
+    {"flush_emit", "<ostream>", cxx20},
     /* <list>.  */
     {"list", "<list>", cxx98},
     /* <map>.  */

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: add more C++ name hints
  2022-08-05 19:35 add more C++ name hints Ulrich Drepper
@ 2022-08-17 10:29 ` Ulrich Drepper
  2022-08-17 12:17 ` Marek Polacek
  1 sibling, 0 replies; 3+ messages in thread
From: Ulrich Drepper @ 2022-08-17 10:29 UTC (permalink / raw)
  To: gcc-patches

Any comment on this?

These changes are low-risk so the only real objection I can see is that
people don't deem these messages useful in the first place.  I would hope,
though, that some editors/IDEs provide one-click solutions to add the
#includes.


On Fri, Aug 5, 2022 at 9:35 PM Ulrich Drepper <drepper@redhat.com> wrote:

> How about adding a few more names from the std namespace to get
> appropriate hints?  This patch compiles and the appropriate messages are
> printed.  Is there a problem with just adding more or even at some point
> all the symbols of the standard library?
>
> gcc/ChangeLog:
>
>         * cp/name-lookup.cc (get_std_name_hint): Add more symbols from the
>         <iomanip>, <ios>, <istream> and <ostream> headers.
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: add more C++ name hints
  2022-08-05 19:35 add more C++ name hints Ulrich Drepper
  2022-08-17 10:29 ` Ulrich Drepper
@ 2022-08-17 12:17 ` Marek Polacek
  1 sibling, 0 replies; 3+ messages in thread
From: Marek Polacek @ 2022-08-17 12:17 UTC (permalink / raw)
  To: Ulrich Drepper; +Cc: gcc-patches

On Fri, Aug 05, 2022 at 09:35:33PM +0200, Ulrich Drepper via Gcc-patches wrote:
> How about adding a few more names from the std namespace to get appropriate
> hints?  This patch compiles and the appropriate messages are printed.  Is
> there a problem with just adding more or even at some point all the symbols
> of the standard library?

IMHO if the table in get_std_name_hint gets too big, we should probably see
if we can replace the O(n) search with something more efficient.
 
> gcc/ChangeLog:
> 
>         * cp/name-lookup.cc (get_std_name_hint): Add more symbols from the
>         <iomanip>, <ios>, <istream> and <ostream> headers.

Please drop the "cp/" prefix here.

Patch LGTM, but I can't approve.  Thanks and sorry for the delay,

Marek


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-08-17 12:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-05 19:35 add more C++ name hints Ulrich Drepper
2022-08-17 10:29 ` Ulrich Drepper
2022-08-17 12:17 ` Marek Polacek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).