[config] Macro for unused declarations

Would it be possible to have a macro for __attribute__((unused)) and similar pragmas to portably avoid "unused typedef" and related warnings (especially from recent versions of GCC)? I have mostly removed those in Boost.Graph, but there are some that need to remain---creating a typedef to a member type of a class to make sure that the member exists, for example. Thank you. -- Jeremiah Willcock

On Saturday 19 October 2013 14:12:56 Jeremiah Willcock wrote:
Would it be possible to have a macro for __attribute__((unused)) and similar pragmas to portably avoid "unused typedef" and related warnings (especially from recent versions of GCC)? I have mostly removed those in Boost.Graph, but there are some that need to remain---creating a typedef to a member type of a class to make sure that the member exists, for example. Thank you.
I wouldn't mind having BOOST_UNUSED or similar macro but not for this case. IMHO, that kind of warning is useless and should be disabled by compiler switches or #pragma gcc warning. It would probably be useful to file a ticket to the GCC team to move the warning to some higher levels (-Wpedantic, is it?). Silencing it by means of the attribute surely doesn't make the code better.

On 19/10/13 20:12, Jeremiah Willcock wrote:
Would it be possible to have a macro for __attribute__((unused)) and similar pragmas to portably avoid "unused typedef" and related warnings (especially from recent versions of GCC)? I have mostly removed those in Boost.Graph, but there are some that need to remain---creating a typedef to a member type of a class to make sure that the member exists, for example. Thank you.
Wouldn't it be better to have a set of macros like BOOST_IGNORE_UNUSED_TYPEDEF BOOST_IGNORE_UNUSED_VARIABLE BOOST_IGNORE_UNUSED_GLOBAL_VARIABLE There are macros or functions like this all over Boost already.
participants (3)
-
Andrey Semashev
-
Jeremiah Willcock
-
Mathias Gaunard