public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/15317] New: __attribute__ unused in first parameter of constructor gives error
@ 2004-05-06 14:14 mb at apissoft dot com
  2004-05-06 14:29 ` [Bug c++/15317] " bangerth at dealii dot org
                   ` (9 more replies)
  0 siblings, 10 replies; 11+ messages in thread
From: mb at apissoft dot com @ 2004-05-06 14:14 UTC (permalink / raw)
  To: gcc-bugs

If the first parameter of a constructor is marked as unused i always get the error:
x25.cpp:26: error: expected unqualified-id before "const"
x25.cpp:26: error: expected `)' before "const"
x25.cpp:26: error: expected `,' or `;' before "const
where the line is
x25.cpp:26: CommonX25::CommonX25(UNUSED const char *lName, UNUSED const char
*rName, UNUSED const char *source, UNUSED const char *dest)

Michael

-- 
           Summary: __attribute__ unused in first parameter of constructor
                    gives error
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: minor
          Priority: P1
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: mb at apissoft dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: sparc-sun-solaris2.8
  GCC host triplet: sparc-sun-solaris2.8
GCC target triplet: sparc-sun-solaris2.8


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


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

* [Bug c++/15317] __attribute__ unused in first parameter of constructor gives error
  2004-05-06 14:14 [Bug c++/15317] New: __attribute__ unused in first parameter of constructor gives error mb at apissoft dot com
@ 2004-05-06 14:29 ` bangerth at dealii dot org
  2004-05-06 14:33 ` pinskia at gcc dot gnu dot org
                   ` (8 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: bangerth at dealii dot org @ 2004-05-06 14:29 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From bangerth at dealii dot org  2004-05-06 14:29 -------
Can you give us a small testcase? 
Thanks 
  Wolfgang 

-- 


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


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

* [Bug c++/15317] __attribute__ unused in first parameter of constructor gives error
  2004-05-06 14:14 [Bug c++/15317] New: __attribute__ unused in first parameter of constructor gives error mb at apissoft dot com
  2004-05-06 14:29 ` [Bug c++/15317] " bangerth at dealii dot org
@ 2004-05-06 14:33 ` pinskia at gcc dot gnu dot org
  2004-05-06 14:36 ` mb at apissoft dot com
                   ` (7 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-06 14:33 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-05-06 14:33 -------
With a simple testcase I cannot verify it:
struct A
{
void f(const int *, const int *);
};

void A::f(__attribute__((unused)) const int *i, __attribute__((unused)) const int *i2)
{
}

Are sure that UNUSED is defined to be the attribute?

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |WAITING


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


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

* [Bug c++/15317] __attribute__ unused in first parameter of constructor gives error
  2004-05-06 14:14 [Bug c++/15317] New: __attribute__ unused in first parameter of constructor gives error mb at apissoft dot com
  2004-05-06 14:29 ` [Bug c++/15317] " bangerth at dealii dot org
  2004-05-06 14:33 ` pinskia at gcc dot gnu dot org
@ 2004-05-06 14:36 ` mb at apissoft dot com
  2004-05-06 14:43 ` [Bug c++/15317] [3.4/3.5 Regression] " pinskia at gcc dot gnu dot org
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: mb at apissoft dot com @ 2004-05-06 14:36 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mb at apissoft dot com  2004-05-06 14:36 -------
small testcase:

class CommonX25 {
 private:
#if defined AIX && !defined AIX43
 ...
#endif /* AIX */

 public:
  CommonX25(const char *, const char *, const char *, const char *);
  ~CommonX25();
};

CommonX25::CommonX25(__attribute__ ((unused)) const char *lName, __attribute__ (
(unused)) const char *rName, __attribute__ ((unused)) const char *source, __attr
ibute__ ((unused)) const char *dest)
{
#if defined AIX && !defined AIX43
  ...
#else
  cerr << "CommonX25 not implemented" << endl;
  exit(-1);
#endif
}

compiled with:
 g++ -c -o test.o test.cpp

-- 


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


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

* [Bug c++/15317] [3.4/3.5 Regression] __attribute__ unused in first parameter of constructor gives error
  2004-05-06 14:14 [Bug c++/15317] New: __attribute__ unused in first parameter of constructor gives error mb at apissoft dot com
                   ` (2 preceding siblings ...)
  2004-05-06 14:36 ` mb at apissoft dot com
@ 2004-05-06 14:43 ` pinskia at gcc dot gnu dot org
  2004-05-06 14:44 ` pinskia at gcc dot gnu dot org
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-06 14:43 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-05-06 14:43 -------
Confirmed, reduced example:
struct A
{
  A(char);
};
A::A(__attribute__((unused)) char i2)
{}

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |NEW
     Ever Confirmed|                            |1
           Keywords|                            |rejects-valid
   Last reconfirmed|0000-00-00 00:00:00         |2004-05-06 14:43:09
               date|                            |
            Summary|__attribute__ unused in     |[3.4/3.5 Regression]
                   |first parameter of          |__attribute__ unused in
                   |constructor gives error     |first parameter of
                   |                            |constructor gives error
   Target Milestone|---                         |3.4.1


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


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

* [Bug c++/15317] [3.4/3.5 Regression] __attribute__ unused in first parameter of constructor gives error
  2004-05-06 14:14 [Bug c++/15317] New: __attribute__ unused in first parameter of constructor gives error mb at apissoft dot com
                   ` (3 preceding siblings ...)
  2004-05-06 14:43 ` [Bug c++/15317] [3.4/3.5 Regression] " pinskia at gcc dot gnu dot org
@ 2004-05-06 14:44 ` pinskia at gcc dot gnu dot org
  2004-05-24  2:31 ` mmitchel at gcc dot gnu dot org
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2004-05-06 14:44 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-05-06 14:44 -------
A work around is to place the attribute after the variable name but this works only on 3.4.0 and above:
struct A
{
A(char);
};
A::A(char i2 __attribute__((unused)))
{}

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |3.4.0 3.5.0
      Known to work|                            |3.3.3


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


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

* [Bug c++/15317] [3.4/3.5 Regression] __attribute__ unused in first parameter of constructor gives error
  2004-05-06 14:14 [Bug c++/15317] New: __attribute__ unused in first parameter of constructor gives error mb at apissoft dot com
                   ` (4 preceding siblings ...)
  2004-05-06 14:44 ` pinskia at gcc dot gnu dot org
@ 2004-05-24  2:31 ` mmitchel at gcc dot gnu dot org
  2004-05-25  0:41 ` cvs-commit at gcc dot gnu dot org
                   ` (3 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2004-05-24  2:31 UTC (permalink / raw)
  To: gcc-bugs



-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
         AssignedTo|unassigned at gcc dot gnu   |mark at codesourcery dot com
                   |dot org                     |
             Status|NEW                         |ASSIGNED


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


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

* [Bug c++/15317] [3.4/3.5 Regression] __attribute__ unused in first parameter of constructor gives error
  2004-05-06 14:14 [Bug c++/15317] New: __attribute__ unused in first parameter of constructor gives error mb at apissoft dot com
                   ` (5 preceding siblings ...)
  2004-05-24  2:31 ` mmitchel at gcc dot gnu dot org
@ 2004-05-25  0:41 ` cvs-commit at gcc dot gnu dot org
  2004-05-25  0:42 ` cvs-commit at gcc dot gnu dot org
                   ` (2 subsequent siblings)
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-05-25  0:41 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-05-24 02:23 -------
Subject: Bug 15317

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	mmitchel@gcc.gnu.org	2004-05-24 02:22:19

Modified files:
	gcc/testsuite  : ChangeLog 
	gcc/cp         : ChangeLog parser.c typeck.c 
Added files:
	gcc/testsuite/g++.dg/ext: attrib14.C 
	gcc/testsuite/g++.dg/template: error12.C ptrmem9.C 

Log message:
	PR c++/15044
	* parser.c (cp_parser_class_head): Robustify.
	
	PR c++/15317
	* parser.c (cp_parser_decl_specifier_seq): Correct error in
	comment.
	(cp_parser_constructor_declarator_p): Treat attributes
	as decl-specifiers.
	
	PR c++/15329
	* typeck.c (build_unary_op): Do not attempt to resolve casts to
	base classes in templates.
	
	PR c++/15044
	* g++.dg/template/error12.C: New test.
	
	PR c++/15317
	* g++.dg/ext/attrib14.C: New test.
	
	PR c++/15329
	* g++.dg/template/ptrmem9.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3389.2.182&r2=1.3389.2.183
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3892.2.105&r2=1.3892.2.106
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/parser.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.157.2.27&r2=1.157.2.28
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/typeck.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.519.2.15&r2=1.519.2.16
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/attrib14.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.2.16.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/error12.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/ptrmem9.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1



-- 


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


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

* [Bug c++/15317] [3.4/3.5 Regression] __attribute__ unused in first parameter of constructor gives error
  2004-05-06 14:14 [Bug c++/15317] New: __attribute__ unused in first parameter of constructor gives error mb at apissoft dot com
                   ` (6 preceding siblings ...)
  2004-05-25  0:41 ` cvs-commit at gcc dot gnu dot org
@ 2004-05-25  0:42 ` cvs-commit at gcc dot gnu dot org
  2004-05-25  0:50 ` cvs-commit at gcc dot gnu dot org
  2004-05-25  1:04 ` mmitchel at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-05-25  0:42 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-05-24 02:29 -------
Subject: Bug 15317

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	mmitchel@gcc.gnu.org	2004-05-24 02:29:35

Modified files:
	gcc/testsuite  : ChangeLog 
	gcc/cp         : ChangeLog parser.c typeck.c 
Added files:
	gcc/testsuite/g++.dg/ext: attrib15.C 
	gcc/testsuite/g++.dg/template: error12.C ptrmem9.C 

Log message:
	PR c++/15044
	* parser.c (cp_parser_class_head): Robustify.
	
	PR c++/15317
	* parser.c (cp_parser_decl_specifier_seq): Correct error in
	comment.
	(cp_parser_constructor_declarator_p): Treat attributes
	as decl-specifiers.
	
	PR c++/15329
	* typeck.c (build_unary_op): Do not attempt to resolve casts to
	base classes in templates.
	
	PR c++/15044
	* g++.dg/template/error12.C: New test.
	
	PR c++/15317
	* g++.dg/ext/attrib15.C: New test.
	
	PR c++/15329
	* g++.dg/template/ptrmem9.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.3777&r2=1.3778
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.4056&r2=1.4057
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/parser.c.diff?cvsroot=gcc&r1=1.194&r2=1.195
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/typeck.c.diff?cvsroot=gcc&r1=1.543&r2=1.544
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/attrib15.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/error12.C.diff?cvsroot=gcc&r1=1.1&r2=1.2
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/ptrmem9.C.diff?cvsroot=gcc&r1=1.1&r2=1.2



-- 


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


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

* [Bug c++/15317] [3.4/3.5 Regression] __attribute__ unused in first parameter of constructor gives error
  2004-05-06 14:14 [Bug c++/15317] New: __attribute__ unused in first parameter of constructor gives error mb at apissoft dot com
                   ` (7 preceding siblings ...)
  2004-05-25  0:42 ` cvs-commit at gcc dot gnu dot org
@ 2004-05-25  0:50 ` cvs-commit at gcc dot gnu dot org
  2004-05-25  1:04 ` mmitchel at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: cvs-commit at gcc dot gnu dot org @ 2004-05-25  0:50 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From cvs-commit at gcc dot gnu dot org  2004-05-24 02:30 -------
Subject: Bug 15317

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_4-branch
Changes by:	mmitchel@gcc.gnu.org	2004-05-24 02:30:28

Modified files:
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/g++.dg/ext: attrib15.C 

Log message:
	PR c++/15044
	* parser.c (cp_parser_class_head): Robustify.
	
	PR c++/15317
	* parser.c (cp_parser_decl_specifier_seq): Correct error in
	comment.
	(cp_parser_constructor_declarator_p): Treat attributes
	as decl-specifiers.
	
	PR c++/15329
	* typeck.c (build_unary_op): Do not attempt to resolve casts to
	base classes in templates.
	
	PR c++/15044
	* g++.dg/template/error12.C: New test.
	
	PR c++/15317
	* g++.dg/ext/attrib15.C: New test.
	
	PR c++/15329
	* g++.dg/template/ptrmem9.C: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3389.2.183&r2=1.3389.2.184
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/attrib15.C.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1



-- 


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


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

* [Bug c++/15317] [3.4/3.5 Regression] __attribute__ unused in first parameter of constructor gives error
  2004-05-06 14:14 [Bug c++/15317] New: __attribute__ unused in first parameter of constructor gives error mb at apissoft dot com
                   ` (8 preceding siblings ...)
  2004-05-25  0:50 ` cvs-commit at gcc dot gnu dot org
@ 2004-05-25  1:04 ` mmitchel at gcc dot gnu dot org
  9 siblings, 0 replies; 11+ messages in thread
From: mmitchel at gcc dot gnu dot org @ 2004-05-25  1:04 UTC (permalink / raw)
  To: gcc-bugs


------- Additional Comments From mmitchel at gcc dot gnu dot org  2004-05-24 02:34 -------
Fixed in GCC 3.4.1.

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


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


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

end of thread, other threads:[~2004-05-24  2:34 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-05-06 14:14 [Bug c++/15317] New: __attribute__ unused in first parameter of constructor gives error mb at apissoft dot com
2004-05-06 14:29 ` [Bug c++/15317] " bangerth at dealii dot org
2004-05-06 14:33 ` pinskia at gcc dot gnu dot org
2004-05-06 14:36 ` mb at apissoft dot com
2004-05-06 14:43 ` [Bug c++/15317] [3.4/3.5 Regression] " pinskia at gcc dot gnu dot org
2004-05-06 14:44 ` pinskia at gcc dot gnu dot org
2004-05-24  2:31 ` mmitchel at gcc dot gnu dot org
2004-05-25  0:41 ` cvs-commit at gcc dot gnu dot org
2004-05-25  0:42 ` cvs-commit at gcc dot gnu dot org
2004-05-25  0:50 ` cvs-commit at gcc dot gnu dot org
2004-05-25  1:04 ` mmitchel 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).