public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/40614]  New: no -Werror= for attribute warn_unused_result
@ 2009-07-02  5:35 esigra at gmail dot com
  2009-07-02 11:33 ` [Bug c++/40614] " rguenth at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: esigra at gmail dot com @ 2009-07-02  5:35 UTC (permalink / raw)
  To: gcc-bugs

There is no way to get an error for ignoring the result of a function with
attribute warn_unused_result. There should be something like
-Werror=unused-return-value (or attribute error_unused_result).


-- 
           Summary: no -Werror= for attribute warn_unused_result
           Product: gcc
           Version: 4.3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: esigra at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40614


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

* [Bug c++/40614] no -Werror= for attribute warn_unused_result
  2009-07-02  5:35 [Bug c++/40614] New: no -Werror= for attribute warn_unused_result esigra at gmail dot com
@ 2009-07-02 11:33 ` rguenth at gcc dot gnu dot org
  2009-07-02 23:41 ` manu at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: rguenth at gcc dot gnu dot org @ 2009-07-02 11:33 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from rguenth at gcc dot gnu dot org  2009-07-02 11:33 -------
Confirmed.


-- 

rguenth at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement
             Status|UNCONFIRMED                 |NEW
     Ever Confirmed|0                           |1
           Keywords|                            |diagnostic
   Last reconfirmed|0000-00-00 00:00:00         |2009-07-02 11:33:27
               date|                            |


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40614


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

* [Bug c++/40614] no -Werror= for attribute warn_unused_result
  2009-07-02  5:35 [Bug c++/40614] New: no -Werror= for attribute warn_unused_result esigra at gmail dot com
  2009-07-02 11:33 ` [Bug c++/40614] " rguenth at gcc dot gnu dot org
@ 2009-07-02 23:41 ` manu at gcc dot gnu dot org
  2009-07-10  7:28 ` manu at gcc dot gnu dot org
  2009-07-10  7:29 ` manu at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: manu at gcc dot gnu dot org @ 2009-07-02 23:41 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from manu at gcc dot gnu dot org  2009-07-02 23:41 -------
We can add an option Wunused-result that controls the warnings.
Wno-unused-result and -Werror=unused-result will then work as expected.

Index: gcc/c-common.c
===================================================================
--- gcc/c-common.c      (revision 149197)
+++ gcc/c-common.c      (working copy)
@@ -8258,13 +8258,14 @@ c_warn_unused_result (gimple_seq seq)
              location_t loc = gimple_location (g);

              if (fdecl)
-               warning (0, "%Hignoring return value of %qD, "
-                        "declared with attribute warn_unused_result",
-                        &loc, fdecl);
+                warning_at (loc, OPT_Wunused_result,
+                            "ignoring return value of %qD, "
+                            "declared with attribute warn_unused_result",
+                            fdecl);
              else
-               warning (0, "%Hignoring return value of function "
-                        "declared with attribute warn_unused_result",
-                        &loc);
+               warning_at (loc, OPT_Wunused_result,
+                            "ignoring return value of function "
+                            "declared with attribute warn_unused_result");
            }
          break;


-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |manu at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40614


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

* [Bug c++/40614] no -Werror= for attribute warn_unused_result
  2009-07-02  5:35 [Bug c++/40614] New: no -Werror= for attribute warn_unused_result esigra at gmail dot com
  2009-07-02 11:33 ` [Bug c++/40614] " rguenth at gcc dot gnu dot org
  2009-07-02 23:41 ` manu at gcc dot gnu dot org
@ 2009-07-10  7:28 ` manu at gcc dot gnu dot org
  2009-07-10  7:29 ` manu at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: manu at gcc dot gnu dot org @ 2009-07-10  7:28 UTC (permalink / raw)
  To: gcc-bugs

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 793 bytes --]



------- Comment #3 from manu at gcc dot gnu dot org  2009-07-10 07:27 -------
Subject: Bug 40614

Author: manu
Date: Fri Jul 10 07:27:32 2009
New Revision: 149458

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=149458
Log:
2009-07-10  Manuel López-Ibáñez  <manu@gcc.gnu.org>

        PR 25509
        PR 40614
        * c.opt (Wunused-result): New.
        * doc/invoke.texi: Document it.
        * c-common.c (c_warn_unused_result): Use it.
testsuite/
        * g++.dg/warn/unused-result1-Werror.c: New.

Added:
    trunk/gcc/testsuite/g++.dg/warn/unused-result1-Werror.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/c-common.c
    trunk/gcc/c.opt
    trunk/gcc/doc/invoke.texi
    trunk/gcc/testsuite/ChangeLog


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40614


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

* [Bug c++/40614] no -Werror= for attribute warn_unused_result
  2009-07-02  5:35 [Bug c++/40614] New: no -Werror= for attribute warn_unused_result esigra at gmail dot com
                   ` (2 preceding siblings ...)
  2009-07-10  7:28 ` manu at gcc dot gnu dot org
@ 2009-07-10  7:29 ` manu at gcc dot gnu dot org
  3 siblings, 0 replies; 5+ messages in thread
From: manu at gcc dot gnu dot org @ 2009-07-10  7:29 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #4 from manu at gcc dot gnu dot org  2009-07-10 07:29 -------
FIXED in GCC 4.5


-- 

manu at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40614


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

end of thread, other threads:[~2009-07-10  7:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-02  5:35 [Bug c++/40614] New: no -Werror= for attribute warn_unused_result esigra at gmail dot com
2009-07-02 11:33 ` [Bug c++/40614] " rguenth at gcc dot gnu dot org
2009-07-02 23:41 ` manu at gcc dot gnu dot org
2009-07-10  7:28 ` manu at gcc dot gnu dot org
2009-07-10  7:29 ` manu at gcc dot gnu 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).