re PR c/25509 (can't disable __attribute__((warn_unused_result)))
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. From-SVN: r149458
This commit is contained in:
parent
5cec9f5974
commit
156f545a1b
@ -1,3 +1,11 @@
|
||||
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.
|
||||
|
||||
2009-07-09 DJ Delorie <dj@redhat.com>
|
||||
|
||||
* targhooks.c (default_target_can_inline_p): Rename from
|
||||
|
@ -8266,11 +8266,13 @@ c_warn_unused_result (gimple_seq seq)
|
||||
location_t loc = gimple_location (g);
|
||||
|
||||
if (fdecl)
|
||||
warning_at (loc, 0, "ignoring return value of %qD, "
|
||||
warning_at (loc, OPT_Wunused_result,
|
||||
"ignoring return value of %qD, "
|
||||
"declared with attribute warn_unused_result",
|
||||
fdecl);
|
||||
else
|
||||
warning_at (loc, 0, "ignoring return value of function "
|
||||
warning_at (loc, OPT_Wunused_result,
|
||||
"ignoring return value of function "
|
||||
"declared with attribute warn_unused_result");
|
||||
}
|
||||
break;
|
||||
|
@ -488,6 +488,10 @@ Wunused-macros
|
||||
C ObjC C++ ObjC++ Warning
|
||||
Warn about macros defined in the main file that are not used
|
||||
|
||||
Wunused-result
|
||||
C ObjC C++ ObjC++ Var(warn_unused_result) Init(1) Warning
|
||||
Warn if a caller of a function, marked with attribute warn_unused_result, does not use its return value
|
||||
|
||||
Wvariadic-macros
|
||||
C ObjC C++ ObjC++ Warning
|
||||
Do not warn about using variadic macros when -pedantic
|
||||
|
@ -260,7 +260,7 @@ Objective-C and Objective-C++ Dialects}.
|
||||
-Wsystem-headers -Wtrigraphs -Wtype-limits -Wundef -Wuninitialized @gol
|
||||
-Wunknown-pragmas -Wno-pragmas -Wunreachable-code @gol
|
||||
-Wunsuffixed-float-constants -Wunused -Wunused-function @gol
|
||||
-Wunused-label -Wunused-parameter -Wunused-value -Wunused-variable @gol
|
||||
-Wunused-label -Wunused-parameter -Wno-unused-result -Wunused-value -Wunused-variable @gol
|
||||
-Wvariadic-macros -Wvla @gol
|
||||
-Wvolatile-register-var -Wwrite-strings}
|
||||
|
||||
@ -3259,6 +3259,13 @@ Warn whenever a function parameter is unused aside from its declaration.
|
||||
To suppress this warning use the @samp{unused} attribute
|
||||
(@pxref{Variable Attributes}).
|
||||
|
||||
@item -Wno-unused-result
|
||||
@opindex Wunused-result
|
||||
@opindex Wno-unused-result
|
||||
Do not warn if a caller of a function marked with attribute
|
||||
@code{warn_unused_result} (@pxref{Variable Attributes}) does not use
|
||||
its return value. The default is @option{-Wunused-result}.
|
||||
|
||||
@item -Wunused-variable
|
||||
@opindex Wunused-variable
|
||||
@opindex Wno-unused-variable
|
||||
|
@ -1,3 +1,9 @@
|
||||
2009-07-10 Manuel López-Ibáñez <manu@gcc.gnu.org>
|
||||
|
||||
PR 25509
|
||||
PR 40614
|
||||
* g++.dg/warn/unused-result1-Werror.c: New.
|
||||
|
||||
2009-07-10 Paul Thomas <pault@gcc.gnu.org>
|
||||
|
||||
PR fortran/39334
|
||||
|
10
gcc/testsuite/g++.dg/warn/unused-result1-Werror.c
Normal file
10
gcc/testsuite/g++.dg/warn/unused-result1-Werror.c
Normal file
@ -0,0 +1,10 @@
|
||||
// PR 40614
|
||||
// { dg-options "-Werror=unused-result" }
|
||||
class QByteArray {
|
||||
public:
|
||||
QByteArray(const QByteArray &);
|
||||
};
|
||||
class QString {
|
||||
QByteArray toLocal8Bit() const __attribute__ ((warn_unused_result));
|
||||
void fooWarnHere() const { toLocal8Bit(); } // { dg-error "ignoring" }
|
||||
};
|
Loading…
Reference in New Issue
Block a user