annoying warnings typedef '...' locally defined but not used

Jonathan Wakely jwakely.gcc@gmail.com
Mon Jul 22 16:47:00 GMT 2013


On 22 July 2013 14:23, Vincent Lefevre wrote:
> With GCC 4.8.1, I get annoying warnings like:
>
> In file included from mpfr-impl.h:461:0,
>                  from mulders.c:33:
> mulders.c: In function 'mpfr_mulhigh_n':
> mpfr-sassert.h:50:18: warning: typedef 'MPFR_ASSERT_82' locally defined but not used [-Wunused-local-typedefs]
>   MPFR_ASSERT_CAT(MPFR_ASSERT_,__LINE__)[!!(c) ? 1 : -1]; } while (0)
>                   ^
> mpfr-sassert.h:47:33: note: in definition of macro 'MPFR_ASSERT_CAT_'
>  #  define MPFR_ASSERT_CAT_(a,b) a ## b
>                                  ^
> mpfr-sassert.h:50:2: note: in expansion of macro 'MPFR_ASSERT_CAT'
>   MPFR_ASSERT_CAT(MPFR_ASSERT_,__LINE__)[!!(c) ? 1 : -1]; } while (0)
>   ^
> mulders.c:82:3: note: in expansion of macro 'MPFR_STAT_STATIC_ASSERT'
>    MPFR_STAT_STATIC_ASSERT (MPFR_MULHIGH_TAB_SIZE >= 8); /* so that 3*(n/4) > n/2 */
>    ^
>
> How can I get rid of them in a portable way for GCC?

You can mark them with __attribute__((unused)), so you could define a
macro that expands to nothing for other compilers.



More information about the Gcc-help mailing list