diff mbox

ATTRIBUTE_UNUSED => ARG_UNUSED

Message ID COL101-W43F644CBEE145D9457C39CE64C0@phx.gbl
State New
Headers show

Commit Message

Jay K Nov. 5, 2010, 10:25 p.m. UTC
ATTRIBUTE_UNUSED => ARG_UNUSED
In 4.5.1, configure -enable-build-with-cxx, with older g++:

+         void *ARG_UNUSED(data_p))
 {
   /* Body of _cpp_free_definition inlined here for speed.
      Macros and assertions no longer have anything to free.  */
j


and so on.


for a in  *.h *.c; do perl -pi.bak -e "s/([A-Za-z0-9_]+) ATTRIBUTE_UNUSED/ARG_UNUSED(\1)/" $a; done


 - Jay

Comments

Jay K Nov. 5, 2010, 10:48 p.m. UTC | #1
> for a in  *.h *.c; do perl -pi.bak -e "s/([A-Za-z0-9_]+) ATTRIBUTE_UNUSED/ARG_UNUSED(\1)/" $a; done

eek, careful there, it breaks stuff, e.g. genautomata.c

 - Jay


----------------------------------------
> From: jay.krell
> To: gcc-patches
> Subject: ATTRIBUTE_UNUSED => ARG_UNUSED
> Date: Fri, 5 Nov 2010 22:25:14 +0000
>
>
> ATTRIBUTE_UNUSED => ARG_UNUSED
> In 4.5.1, configure -enable-build-with-cxx, with older g++:
>
> diff -u -r1.1.1.1 directives.c
> --- directives.c    28 May 2010 05:49:44 -0000    1.1.1.1
> +++ directives.c    5 Nov 2010 21:44:04 -0000
> @@ -1,3 +1,5 @@
> @@ -621,8 +623,8 @@
>  /* Undefine a single macro/assertion/whatever.  */
>
>  static int
> -undefine_macros (cpp_reader *pfile ATTRIBUTE_UNUSED, cpp_hashnode *h,
> -         void *data_p ATTRIBUTE_UNUSED)
> +undefine_macros (cpp_reader *ARG_UNUSED(pfile), cpp_hashnode *h,
> +         void *ARG_UNUSED(data_p))
>  {
>    /* Body of _cpp_free_definition inlined here for speed.
>       Macros and assertions no longer have anything to free.  */
> j
>
>
> and so on.
>
>
> for a in  *.h *.c; do perl -pi.bak -e "s/([A-Za-z0-9_]+) ATTRIBUTE_UNUSED/ARG_UNUSED(\1)/" $a; done
>
>
>  - Jay
Richard Biener Nov. 6, 2010, 2:37 p.m. UTC | #2
On Fri, Nov 5, 2010 at 11:48 PM, Jay K <jay.krell@cornell.edu> wrote:
>
>> for a in  *.h *.c; do perl -pi.bak -e "s/([A-Za-z0-9_]+) ATTRIBUTE_UNUSED/ARG_UNUSED(\1)/" $a; done
>
> eek, careful there, it breaks stuff, e.g. genautomata.c

I think people are more used to ATTRIBUTE_UNUSED syntax, so I'd rather
get rid of ARG_UNUSED
(what's its advantage?)

Richard.

>  - Jay
>
>
> ----------------------------------------
>> From: jay.krell
>> To: gcc-patches
>> Subject: ATTRIBUTE_UNUSED => ARG_UNUSED
>> Date: Fri, 5 Nov 2010 22:25:14 +0000
>>
>>
>> ATTRIBUTE_UNUSED => ARG_UNUSED
>> In 4.5.1, configure -enable-build-with-cxx, with older g++:
>>
>> diff -u -r1.1.1.1 directives.c
>> --- directives.c    28 May 2010 05:49:44 -0000    1.1.1.1
>> +++ directives.c    5 Nov 2010 21:44:04 -0000
>> @@ -1,3 +1,5 @@
>> @@ -621,8 +623,8 @@
>>  /* Undefine a single macro/assertion/whatever.  */
>>
>>  static int
>> -undefine_macros (cpp_reader *pfile ATTRIBUTE_UNUSED, cpp_hashnode *h,
>> -         void *data_p ATTRIBUTE_UNUSED)
>> +undefine_macros (cpp_reader *ARG_UNUSED(pfile), cpp_hashnode *h,
>> +         void *ARG_UNUSED(data_p))
>>  {
>>    /* Body of _cpp_free_definition inlined here for speed.
>>       Macros and assertions no longer have anything to free.  */
>> j
>>
>>
>> and so on.
>>
>>
>> for a in  *.h *.c; do perl -pi.bak -e "s/([A-Za-z0-9_]+) ATTRIBUTE_UNUSED/ARG_UNUSED(\1)/" $a; done
>>
>>
>>  - Jay
>
>
Jay K Nov. 6, 2010, 3:46 p.m. UTC | #3
If it was used consistently, it might work better.. but yeah.. I gave up on a mass edit and hacked ansidecl.h instead.
I'm about to open a bug summarizing my experience with configure -enable-build-with-cxx in 4.5.1 so far.
At least what doesn't work. It also works fine with g++ 4.x.
Problems with g++ 3.3 and SunStudio 12 C++.
ENUM_BITFIELD is a problem.
obstack_free subtracting void* or such is a problem.
abs(wide int) is a problem => ambiguous between overloads..

 - Jay

----------------------------------------
> Date: Sat, 6 Nov 2010 15:37:43 +0100
> Subject: Re: ATTRIBUTE_UNUSED => ARG_UNUSED
> From: richard.guenther@gmail.com
> To: jay.krell@cornell.edu
> CC: gcc-patches@gcc.gnu.org
>
> On Fri, Nov 5, 2010 at 11:48 PM, Jay K  wrote:
> >
> >> for a in  *.h *.c; do perl -pi.bak -e "s/([A-Za-z0-9_]+) ATTRIBUTE_UNUSED/ARG_UNUSED(\1)/" $a; done
> >
> > eek, careful there, it breaks stuff, e.g. genautomata.c
>
> I think people are more used to ATTRIBUTE_UNUSED syntax, so I'd rather
> get rid of ARG_UNUSED
> (what's its advantage?)
>
> Richard.
>
> >  - Jay
> >
> >
> > ----------------------------------------
> >> From: jay.krell
> >> To: gcc-patches
> >> Subject: ATTRIBUTE_UNUSED => ARG_UNUSED
> >> Date: Fri, 5 Nov 2010 22:25:14 +0000
> >>
> >>
> >> ATTRIBUTE_UNUSED => ARG_UNUSED
> >> In 4.5.1, configure -enable-build-with-cxx, with older g++:
> >>
> >> diff -u -r1.1.1.1 directives.c
> >> --- directives.c    28 May 2010 05:49:44 -0000    1.1.1.1
> >> +++ directives.c    5 Nov 2010 21:44:04 -0000
> >> @@ -1,3 +1,5 @@
> >> @@ -621,8 +623,8 @@
> >>  /* Undefine a single macro/assertion/whatever.  */
> >>
> >>  static int
> >> -undefine_macros (cpp_reader *pfile ATTRIBUTE_UNUSED, cpp_hashnode *h,
> >> -         void *data_p ATTRIBUTE_UNUSED)
> >> +undefine_macros (cpp_reader *ARG_UNUSED(pfile), cpp_hashnode *h,
> >> +         void *ARG_UNUSED(data_p))
> >>  {
> >>    /* Body of _cpp_free_definition inlined here for speed.
> >>       Macros and assertions no longer have anything to free.  */
> >> j
> >>
> >>
> >> and so on.
> >>
> >>
> >> for a in  *.h *.c; do perl -pi.bak -e "s/([A-Za-z0-9_]+) ATTRIBUTE_UNUSED/ARG_UNUSED(\1)/" $a; done
> >>
> >>
> >>  - Jay
> >
> >
diff mbox

Patch

diff -u -r1.1.1.1 directives.c
--- directives.c    28 May 2010 05:49:44 -0000    1.1.1.1
+++ directives.c    5 Nov 2010 21:44:04 -0000
@@ -1,3 +1,5 @@ 
@@ -621,8 +623,8 @@ 
 /* Undefine a single macro/assertion/whatever.  */
 
 static int
-undefine_macros (cpp_reader *pfile ATTRIBUTE_UNUSED, cpp_hashnode *h,
-         void *data_p ATTRIBUTE_UNUSED)
+undefine_macros (cpp_reader *ARG_UNUSED(pfile), cpp_hashnode *h,