www.digitalmars.com         C & C++   DMDScript  

c++ - Suppressing warning 6 without disabling it

reply "Johnny Willemsen" <jwillemsen remedy.nl> writes:
Hi,

When building ACE/TAO I get the warning: Warning 6: value of expression is 
not used

In ACE/TAO we use a macro ACE_UNUSED_ARG for arguments which are there, but 
not used under certain conditions. The macro is defined as
# define ACE_UNUSED_ARG(a) do {/* null */} while (&a == 0)
or
# define ACE_UNUSED_ARG(a) (a)

But both don't suppress the warning with DMC? Anyone an idea how to get rid 
of warning 6, with such a macro, we don't want do disable it completely.

Johnny
Sep 23 2004
next sibling parent reply "Włodzimierz Skiba" <abx abx.art.pl> writes:
"Johnny Willemsen" <jwillemsen remedy.nl> wrote in
news:ciuli7$1d7s$1 digitaldaemon.com: 

 Anyone an idea how to
 get rid of warning 6, with such a macro, we don't want do disable it
 completely. 

In wxWidgets we have: #define WXUNUSED(identifier) #ifdef __BORLANDC__ # define wxUnusedVar(identifier) identifier #else template <class T> inline void wxUnusedVar(const T& WXUNUSED(t)) { } #endif and then write code which afaik works with all c++ compilers we support (including DMC): wxUnusedVar(some_variable); ABX
Sep 23 2004
parent "Johnny Willemsen" <jwillemsen remedy.nl> writes:
Hi,

Thanks for this, I have added such a construct also to ACE. I only observed 
that the template way of doing this, increases the size of the app a little, 
the do/while solution is optimized out by the compiler, the template 
probably not.

Johnny

"Włodzimierz Skiba" <abx abx.art.pl> wrote in message 
news:ciurr4$1j0m$1 digitaldaemon.com...
 "Johnny Willemsen" <jwillemsen remedy.nl> wrote in
 news:ciuli7$1d7s$1 digitaldaemon.com:

 Anyone an idea how to
 get rid of warning 6, with such a macro, we don't want do disable it
 completely.

In wxWidgets we have: #define WXUNUSED(identifier) #ifdef __BORLANDC__ # define wxUnusedVar(identifier) identifier #else template <class T> inline void wxUnusedVar(const T& WXUNUSED(t)) { } #endif and then write code which afaik works with all c++ compilers we support (including DMC): wxUnusedVar(some_variable); ABX

Sep 24 2004
prev sibling parent "Walter" <newshound digitalmars.com> writes:
"Johnny Willemsen" <jwillemsen remedy.nl> wrote in message
news:ciuli7$1d7s$1 digitaldaemon.com...
 Hi,

 When building ACE/TAO I get the warning: Warning 6: value of expression is
 not used

 In ACE/TAO we use a macro ACE_UNUSED_ARG for arguments which are there,

 not used under certain conditions. The macro is defined as
 # define ACE_UNUSED_ARG(a) do {/* null */} while (&a == 0)
 or
 # define ACE_UNUSED_ARG(a) (a)

 But both don't suppress the warning with DMC? Anyone an idea how to get

 of warning 6, with such a macro, we don't want do disable it completely.

-w6 see www.digitalmars.com/ctg/sc.html#dashw
Sep 30 2004