public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/38172] warn_unused_result does not work with structs not containing a copy constructor
       [not found] <bug-38172-4@http.gcc.gnu.org/bugzilla/>
@ 2010-11-24 19:17 ` pinskia at gcc dot gnu.org
  2011-10-09 17:37 ` paolo.carlini at oracle dot com
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2010-11-24 19:17 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrew at ishiboo dot com

--- Comment #3 from Andrew Pinski <pinskia at gcc dot gnu.org> 2010-11-24 18:30:56 UTC ---
*** Bug 46643 has been marked as a duplicate of this bug. ***


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

* [Bug c++/38172] warn_unused_result does not work with structs not containing a copy constructor
       [not found] <bug-38172-4@http.gcc.gnu.org/bugzilla/>
  2010-11-24 19:17 ` [Bug c++/38172] warn_unused_result does not work with structs not containing a copy constructor pinskia at gcc dot gnu.org
@ 2011-10-09 17:37 ` paolo.carlini at oracle dot com
  2012-06-25 14:03 ` joerg.richter@pdv-fs.de
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: paolo.carlini at oracle dot com @ 2011-10-09 17:37 UTC (permalink / raw)
  To: gcc-bugs

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

Paolo Carlini <paolo.carlini at oracle dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |RESOLVED
                 CC|gcc-bugs at gcc dot gnu.org |
         Resolution|                            |FIXED

--- Comment #4 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-10-09 17:36:12 UTC ---
Fixed in 4.5.x.


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

* [Bug c++/38172] warn_unused_result does not work with structs not containing a copy constructor
       [not found] <bug-38172-4@http.gcc.gnu.org/bugzilla/>
  2010-11-24 19:17 ` [Bug c++/38172] warn_unused_result does not work with structs not containing a copy constructor pinskia at gcc dot gnu.org
  2011-10-09 17:37 ` paolo.carlini at oracle dot com
@ 2012-06-25 14:03 ` joerg.richter@pdv-fs.de
  2014-01-17 12:43 ` karsten_burger at gmx dot de
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: joerg.richter@pdv-fs.de @ 2012-06-25 14:03 UTC (permalink / raw)
  To: gcc-bugs

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

Jörg Richter <joerg.richter@pdv-fs.de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |joerg.richter@pdv-fs.de

--- Comment #5 from Jörg Richter <joerg.richter@pdv-fs.de> 2012-06-25 13:58:26 UTC ---
Adding just a simple struct member makes the warning for Bar2 disappear again.
Reopen? Or should I file a new PR?

$ cat t.cc
struct MyClass
{
    int i;
};

typedef struct MyClass MyClass;

int Bar1( void ) __attribute__((warn_unused_result));
MyClass Bar2( void ) __attribute__((warn_unused_result));

void Foo( void )
{
  Bar1(); // Warns
  Bar2(); // Does not warn
}

$ gcc -c -o /dev/null t.cc
t.cc: In function 'void Foo()':
t.cc:13:9: warning: ignoring return value of 'int Bar1()', declared with
attribute warn_unused_result [-Wunused-result]

$ gcc -v
Using built-in specs.
COLLECT_GCC=/tools/pkg/gcc/4.7.1/bin/gcc
COLLECT_LTO_WRAPPER=/tools/pkg/gcc/4.7.1/libexec/gcc/x86_64-unknown-linux-gnu/4.7.1/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: gcc-4.7.1/configure --enable-languages=c,c++
--disable-bootstrap --disable-nls --with-local-prefix=/not_existing_directory
--with-as=/tools/pkg/binutils/2.21/bin/as
--with-ld=/tools/pkg/binutils/2.21/bin/ld --prefix=/tools/pkg/gcc/4.7.1
Thread model: posix
gcc version 4.7.1 (GCC)

Also with 4.6.3


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

* [Bug c++/38172] warn_unused_result does not work with structs not containing a copy constructor
       [not found] <bug-38172-4@http.gcc.gnu.org/bugzilla/>
                   ` (2 preceding siblings ...)
  2012-06-25 14:03 ` joerg.richter@pdv-fs.de
@ 2014-01-17 12:43 ` karsten_burger at gmx dot de
  2014-03-07 22:16 ` pinskia at gcc dot gnu.org
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 9+ messages in thread
From: karsten_burger at gmx dot de @ 2014-01-17 12:43 UTC (permalink / raw)
  To: gcc-bugs

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

Karsten Burger <karsten_burger at gmx dot de> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |karsten_burger at gmx dot de

--- Comment #6 from Karsten Burger <karsten_burger at gmx dot de> ---
Created attachment 31871
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=31871&action=edit
test case with vector::iterator as return value

my gcc still shows this problem, when I use a vector::iterator as return value.

gcc version 4.7.1 20120723 [gcc-4_7-branch revision 189773] (SUSE Linux)


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

* [Bug c++/38172] warn_unused_result does not work with structs not containing a copy constructor
       [not found] <bug-38172-4@http.gcc.gnu.org/bugzilla/>
                   ` (3 preceding siblings ...)
  2014-01-17 12:43 ` karsten_burger at gmx dot de
@ 2014-03-07 22:16 ` pinskia at gcc dot gnu.org
  2014-03-07 22:17 ` pinskia at gcc dot gnu.org
  2021-12-10 22:03 ` pinskia at gcc dot gnu.org
  6 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2014-03-07 22:16 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |NEW
   Last reconfirmed|                            |2014-03-07
         Resolution|FIXED                       |---
     Ever confirmed|0                           |1

--- Comment #7 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Reopening since it is not fully fixed.


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

* [Bug c++/38172] warn_unused_result does not work with structs not containing a copy constructor
       [not found] <bug-38172-4@http.gcc.gnu.org/bugzilla/>
                   ` (4 preceding siblings ...)
  2014-03-07 22:16 ` pinskia at gcc dot gnu.org
@ 2014-03-07 22:17 ` pinskia at gcc dot gnu.org
  2021-12-10 22:03 ` pinskia at gcc dot gnu.org
  6 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2014-03-07 22:17 UTC (permalink / raw)
  To: gcc-bugs

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

Andrew Pinski <pinskia at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mdennis at merfer dot net

--- Comment #8 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
*** Bug 60460 has been marked as a duplicate of this bug. ***


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

* [Bug c++/38172] warn_unused_result does not work with structs not containing a copy constructor
       [not found] <bug-38172-4@http.gcc.gnu.org/bugzilla/>
                   ` (5 preceding siblings ...)
  2014-03-07 22:17 ` pinskia at gcc dot gnu.org
@ 2021-12-10 22:03 ` pinskia at gcc dot gnu.org
  6 siblings, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu.org @ 2021-12-10 22:03 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #16 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Martin Liška from comment #15)
> Can the bug be marked as resolved?

Not exactly with an empty struct we warn twice.
That is take:
struct MyClass{};
typedef struct MyClass MyClass;
MyClass Bar2( void ) __attribute__((warn_unused_result));
void Foo( void )
{
    Bar2(); // warns twice
}


But the following only warns once:
struct MyClass{int t;};
typedef struct MyClass MyClass;
MyClass Bar2( void ) __attribute__((warn_unused_result));
void Foo( void )
{
    Bar2();
}



The warning twice started with GCC 7.

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

* [Bug c++/38172] warn_unused_result does not work with structs not containing a copy constructor
  2008-11-18 22:14 [Bug c++/38172] New: " pinskia at gcc dot gnu dot org
  2008-11-18 22:16 ` [Bug c++/38172] " pinskia at gcc dot gnu dot org
@ 2008-11-18 22:17 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-11-18 22:17 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #2 from pinskia at gcc dot gnu dot org  2008-11-18 22:15 -------
*** Bug 31742 has been marked as a duplicate of this bug. ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mec at google dot com


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


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

* [Bug c++/38172] warn_unused_result does not work with structs not containing a copy constructor
  2008-11-18 22:14 [Bug c++/38172] New: " pinskia at gcc dot gnu dot org
@ 2008-11-18 22:16 ` pinskia at gcc dot gnu dot org
  2008-11-18 22:17 ` pinskia at gcc dot gnu dot org
  1 sibling, 0 replies; 9+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2008-11-18 22:16 UTC (permalink / raw)
  To: gcc-bugs



------- Comment #1 from pinskia at gcc dot gnu dot org  2008-11-18 22:14 -------
*** Bug 31063 has been marked as a duplicate of this bug. ***


-- 

pinskia at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fletcherdunn at yahoo dot
                   |                            |com


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


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

end of thread, other threads:[~2021-12-10 22:03 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-38172-4@http.gcc.gnu.org/bugzilla/>
2010-11-24 19:17 ` [Bug c++/38172] warn_unused_result does not work with structs not containing a copy constructor pinskia at gcc dot gnu.org
2011-10-09 17:37 ` paolo.carlini at oracle dot com
2012-06-25 14:03 ` joerg.richter@pdv-fs.de
2014-01-17 12:43 ` karsten_burger at gmx dot de
2014-03-07 22:16 ` pinskia at gcc dot gnu.org
2014-03-07 22:17 ` pinskia at gcc dot gnu.org
2021-12-10 22:03 ` pinskia at gcc dot gnu.org
2008-11-18 22:14 [Bug c++/38172] New: " pinskia at gcc dot gnu dot org
2008-11-18 22:16 ` [Bug c++/38172] " pinskia at gcc dot gnu dot org
2008-11-18 22:17 ` pinskia 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).