public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/101052] New: Suggest stdlib.h when exit(1) is called
@ 2021-06-13 22:24 jg at jguk dot org
  2021-06-13 22:25 ` [Bug c++/101052] " jg at jguk dot org
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: jg at jguk dot org @ 2021-06-13 22:24 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101052

            Bug ID: 101052
           Summary: Suggest stdlib.h when exit(1) is called
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: jg at jguk dot org
  Target Milestone: ---

>From godbolt GCC trunk 13 June 2021

Could #include <stdlib.h> be suggested please.


-Wall -O2
123
<Compilation failed>

# For more information see the output window
x86-64 gcc (trunk) - 322ms
#1 with x86-64 gcc (trunk)
<source>: In function 'void f(int*)':
<source>:8:9: error: 'exit' was not declared in this scope
    8 |         exit(1);
      |         ^~~~
Compiler returned: 1



//#include <stdlib.h>

#include <cstddef>
void f(int * g)
{
    if(NULL == g)
    {
        exit(1);
    }
}

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

* [Bug c++/101052] Suggest stdlib.h when exit(1) is called
  2021-06-13 22:24 [Bug c++/101052] New: Suggest stdlib.h when exit(1) is called jg at jguk dot org
@ 2021-06-13 22:25 ` jg at jguk dot org
  2021-06-14 10:43 ` redi at gcc dot gnu.org
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: jg at jguk dot org @ 2021-06-13 22:25 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101052

--- Comment #1 from Jonny Grant <jg at jguk dot org> ---
Code link:
https://godbolt.org/z/vYTc87db1

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

* [Bug c++/101052] Suggest stdlib.h when exit(1) is called
  2021-06-13 22:24 [Bug c++/101052] New: Suggest stdlib.h when exit(1) is called jg at jguk dot org
  2021-06-13 22:25 ` [Bug c++/101052] " jg at jguk dot org
@ 2021-06-14 10:43 ` redi at gcc dot gnu.org
  2021-06-14 15:35 ` redi at gcc dot gnu.org
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2021-06-14 10:43 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101052

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-06-14
     Ever confirmed|0                           |1
           Assignee|unassigned at gcc dot gnu.org      |redi at gcc dot gnu.org
             Status|UNCONFIRMED                 |ASSIGNED

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

* [Bug c++/101052] Suggest stdlib.h when exit(1) is called
  2021-06-13 22:24 [Bug c++/101052] New: Suggest stdlib.h when exit(1) is called jg at jguk dot org
  2021-06-13 22:25 ` [Bug c++/101052] " jg at jguk dot org
  2021-06-14 10:43 ` redi at gcc dot gnu.org
@ 2021-06-14 15:35 ` redi at gcc dot gnu.org
  2021-06-14 17:24 ` cvs-commit at gcc dot gnu.org
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2021-06-14 15:35 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101052

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Patch posted for review: 
https://gcc.gnu.org/pipermail/gcc-patches/2021-June/572665.html

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

* [Bug c++/101052] Suggest stdlib.h when exit(1) is called
  2021-06-13 22:24 [Bug c++/101052] New: Suggest stdlib.h when exit(1) is called jg at jguk dot org
                   ` (2 preceding siblings ...)
  2021-06-14 15:35 ` redi at gcc dot gnu.org
@ 2021-06-14 17:24 ` cvs-commit at gcc dot gnu.org
  2021-06-14 17:25 ` redi at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-06-14 17:24 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101052

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>:

https://gcc.gnu.org/g:93bfadf3a1db7d73e9ca4a4a3d40f7f81ea16d39

commit r12-1435-g93bfadf3a1db7d73e9ca4a4a3d40f7f81ea16d39
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Mon Jun 14 11:38:11 2021 +0100

    c-family: Add fix-it suggestions for more <stdlib.h> names [PR101052]

            PR c++/101052

    gcc/c-family/ChangeLog:

            * known-headers.cc (get_stdlib_header_for_name): Add known
            headers for EXIT_FAILURE, EXIT_SUCCESS, abort, atexit, calloc,
            exit, and getenv.

    gcc/testsuite/ChangeLog:

            * g++.dg/spellcheck-stdlib.C: Add checks for <cstdlib> names.
            * gcc.dg/spellcheck-stdlib.c: Likewise.

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

* [Bug c++/101052] Suggest stdlib.h when exit(1) is called
  2021-06-13 22:24 [Bug c++/101052] New: Suggest stdlib.h when exit(1) is called jg at jguk dot org
                   ` (3 preceding siblings ...)
  2021-06-14 17:24 ` cvs-commit at gcc dot gnu.org
@ 2021-06-14 17:25 ` redi at gcc dot gnu.org
  2021-06-14 17:26 ` redi at gcc dot gnu.org
  2021-06-14 18:06 ` jg at jguk dot org
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2021-06-14 17:25 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101052

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |12.0
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Implemented for GCC 12

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

* [Bug c++/101052] Suggest stdlib.h when exit(1) is called
  2021-06-13 22:24 [Bug c++/101052] New: Suggest stdlib.h when exit(1) is called jg at jguk dot org
                   ` (4 preceding siblings ...)
  2021-06-14 17:25 ` redi at gcc dot gnu.org
@ 2021-06-14 17:26 ` redi at gcc dot gnu.org
  2021-06-14 18:06 ` jg at jguk dot org
  6 siblings, 0 replies; 8+ messages in thread
From: redi at gcc dot gnu.org @ 2021-06-14 17:26 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101052

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement

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

* [Bug c++/101052] Suggest stdlib.h when exit(1) is called
  2021-06-13 22:24 [Bug c++/101052] New: Suggest stdlib.h when exit(1) is called jg at jguk dot org
                   ` (5 preceding siblings ...)
  2021-06-14 17:26 ` redi at gcc dot gnu.org
@ 2021-06-14 18:06 ` jg at jguk dot org
  6 siblings, 0 replies; 8+ messages in thread
From: jg at jguk dot org @ 2021-06-14 18:06 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101052

--- Comment #5 from Jonny Grant <jg at jguk dot org> ---
Amazing 1-day turnaround, thank you Jonathan!

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

end of thread, other threads:[~2021-06-14 18:06 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-13 22:24 [Bug c++/101052] New: Suggest stdlib.h when exit(1) is called jg at jguk dot org
2021-06-13 22:25 ` [Bug c++/101052] " jg at jguk dot org
2021-06-14 10:43 ` redi at gcc dot gnu.org
2021-06-14 15:35 ` redi at gcc dot gnu.org
2021-06-14 17:24 ` cvs-commit at gcc dot gnu.org
2021-06-14 17:25 ` redi at gcc dot gnu.org
2021-06-14 17:26 ` redi at gcc dot gnu.org
2021-06-14 18:06 ` jg at jguk dot org

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).