[libiberty] Add ARG_UNUSED as a C++-friendly replacement for ATTRIBUTE_UNUSED

Bernardo Innocenti bernie@develer.com
Sun Jul 11 23:52:00 GMT 2004


Hello,

this patch adds the ARG_UNUSED() macro to be used in place of
ATTRIBUTE_UNUSED.  The syntax looks like this:

	void foo (ARG_UNUSED (int, x))
	{
	} 

The C++ frontend can't parse attribute((unused)) when it
appears after the variable name.  The cleanest work-around
is using the standard C++ syntax to specify unused
parameters, which can also be used when bootstrapping from
other C++ compilers.

This patch is a prerequisite for the upcoming C++ bootstrap
patches that I've been preparing.


include/
2004-07-11  Bernardo Innocenti  <bernie@develer.com>

	* ansidecl.h (ARG_UNUSED): New Macro.

diff -u -p -r1.16 ansidecl.h
--- ansidecl.h	17 Jun 2003 14:10:00 -0000	1.16
+++ ansidecl.h	11 Jul 2004 15:38:23 -0000
@@ -312,4 +312,10 @@ So instead we use the macro below and te
 #define __extension__
 #endif
 
+#ifdef __cplusplus
+# define ARG_UNUSED(T, N)	T
+#else
+# define ARG_UNUSED(T, N)	T N ATTRIBUTE_UNUSED
+#endif
+
 #endif	/* ansidecl.h	*/

-- 
  // Bernardo Innocenti - Develer S.r.l., R&D dept.
\X/  http://www.develer.com/



More information about the Gdb-patches mailing list