Hi Everyone,

I have an Ubuntu 9.04 system that I've installed gcc-4.5.1 on, using an in-tree 
build of gmp, mpfr,  mpc, and libelf.

  lu...@node:~$ gcc-4.5.1 -v
  Using built-in specs.
  COLLECT_GCC=gcc-4.5.1
  
COLLECT_LTO_WRAPPER=/home/luked/local/libexec/gcc/x86_64-unknown-linux-gnu/4.5.1/lto-wrapper
  Target: x86_64-unknown-linux-gnu
  Configured with: ../configure --prefix=/home/luked/local --enable-lto 
--enable-plugin --enable-multilib --program-suffix=-4.5.1
  Thread model: posix
  gcc version 4.5.1 (GCC) 

I'm evaluating the plugin interface for an academic project, but I have the 
following compilation problem. The test I am using is:

  lu...@node:~$ cat test.cxx 
  extern "C" {
  #include "gcc-plugin.h"
  }

This compiles fine without "-pedantic":

  lu...@node:~$ g++-4.5.1 -I`g++-4.5.1 -print-file-name=plugin`/include -c 
test.cxx 

But adding "-pedantic" results in an error due to a function type mismatch for 
getopt.

  lu...@node:~$ g++-4.5.1 -I`g++-4.5.1 -print-file-name=plugin`/include 
-pedantic -c test.cxx 
  In file included from 
/home/luked/local/lib/gcc/x86_64-unknown-linux-gnu/4.5.1/plugin/include/gcc-plugin.h:28:0,
                 from test.cxx:2:
  
/home/luked/local/lib/gcc/x86_64-unknown-linux-gnu/4.5.1/plugin/include/system.h:382:53:
 error: declaration of ‘int getopt(int, char* const*, const char*)’ throws 
different exceptions
  /usr/include/getopt.h:152:12: error: from previous declaration ‘int 
getopt(int, char* const*, const char*) throw ()’

The plugin/include/system.h does indeed declare getopt without the throw().

  luked@:~$ sed -n 380,384p 
/home/luked/local/lib/gcc/x86_64-unknown-linux-gnu/4.5.1/plugin/include/system.h

  #if defined (HAVE_DECL_GETOPT) && !HAVE_DECL_GETOPT
  extern int getopt (int, char * const *, const char *);
  #endif

And my auto-conf.h declares HAVE_DECL_GETOPT 0.

  lu...@node:~$ sed -n 679,683p 
/home/luked/local/lib/gcc/x86_64-unknown-linux-gnu/4.5.1/plugin/include/auto-host.h
  /* Define to 1 if we found a declaration for 'getopt', otherwise define to 0.
     */
  #ifndef USED_FOR_TARGET
  #define HAVE_DECL_GETOPT 0
  #endif

I don't know what "USED_FOR_TARGET" means, but it isn't defined anywhere inside 
of the plugin.

  lu...@node1x4x2a:~/local/lib/gcc/x86_64-unknown-linux-gnu/4.5.1/plugin$ grep 
-r USED_FOR_TARGET * | uniq
  include/config/i386/i386.h:#ifndef USED_FOR_TARGET
  include/auto-host.h:#ifndef USED_FOR_TARGET
  include/tm.h:#if defined IN_GCC && !defined GENERATOR_FILE && !defined 
USED_FOR_TARGET
  include/coretypes.h:#ifndef USED_FOR_TARGET

Does this seem like a configuration bug that I should report, or is it more 
likely that there's something wrong with my system?

Thanks,
Luke

Reply via email to