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

Reply via email to