* [plugin] compiling plugins with g++ and -pedantic gives getopt declaration error
@ 2010-08-06 15:05 Luke Dalessandro
0 siblings, 0 replies; only message in thread
From: Luke Dalessandro @ 2010-08-06 15:05 UTC (permalink / raw)
To: gcc
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.
luked@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:
luked@node:~$ cat test.cxx
extern "C" {
#include "gcc-plugin.h"
}
This compiles fine without "-pedantic":
luked@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.
luked@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.
luked@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.
luked@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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2010-08-06 14:44 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-06 15:05 [plugin] compiling plugins with g++ and -pedantic gives getopt declaration error Luke Dalessandro
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).