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

Vincent Lefevre vincent+gcc@vinc17.org
Mon Jul 22 16:23:00 GMT 2013


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?

Note that -Wno-unused-local-typedefs is not a solution as some
GCC versions (including not too old like 4.3.4) reject it:

http://hydra.nixos.org/build/5571095/download/1/mpfr-3.2.0-dev/nix-build-68cgybjr0zjj535s0vs9mfirq13d8k6a-mpfr-3.2.0-dev.drv-0/mpfr-3.2.0-dev/config.log

configure:5277: gcc -c -Wall -Wmissing-prototypes -Wpointer-arith -Wno-unused-local-typedefs -g -O2  conftest.c >&5
cc1: error: unrecognized command line option "-Wno-unused-local-typedefs"
configure:5277: $? = 1

-- 
Vincent Lefèvre <vincent@vinc17.net> - Web: <http://www.vinc17.net/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.net/blog/>
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)



More information about the Gcc-help mailing list