This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/44056] New: plugin compile error: rtl.def uses "const" keyword because of "CONST" defined to "const" in include/ansidecl.h
- From: "crquan at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 10 May 2010 11:01:47 -0000
- Subject: [Bug c/44056] New: plugin compile error: rtl.def uses "const" keyword because of "CONST" defined to "const" in include/ansidecl.h
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Tried native compile gcc-4.50 on both x86_64-linux and i686-linux, and install
into separate directory, it can compile small plugin demo, and demo plugin also
worked well;
but while writing a useful gcc plugin with FOR_EACH_LOOP from cfgloop.h, it
exited with error:
gcc -I.
-I/opt/gcc-4.5.0/usr/bin/../lib/gcc/x86_64-pc-linux-gnu/4.5.0/plugin/include
-fPIC -c -o sensor_code_generators/univariate_polynomial.o
sensor_code_generators/univariate_polynomial.c
In file included from
/opt/gcc-4.5.0/usr/bin/../lib/gcc/x86_64-pc-linux-gnu/4.5.0/plugin/include/rtl.h:48:0,
from
/opt/gcc-4.5.0/usr/bin/../lib/gcc/x86_64-pc-linux-gnu/4.5.0/plugin/include/cfgloop.h:26,
from sensor_code_generators/univariate_polynomial.c:15:
/opt/gcc-4.5.0/usr/bin/../lib/gcc/x86_64-pc-linux-gnu/4.5.0/plugin/include/rtl.def:336:1:
error: expected identifier before 'const'
In file included from
/opt/gcc-4.5.0/usr/bin/../lib/gcc/x86_64-pc-linux-gnu/4.5.0/plugin/include/cfgloop.h:26:0,
from sensor_code_generators/univariate_polynomial.c:15:
/opt/gcc-4.5.0/usr/bin/../lib/gcc/x86_64-pc-linux-gnu/4.5.0/plugin/include/rtl.h:98:39:
error: 'LAST_AND_UNUSED_RTX_CODE' undeclared here (not in a function)
sensor_code_generators/univariate_polynomial.c:92:1: warning: useless storage
class specifier in empty declaration
make: *** [sensor_code_generators/univariate_polynomial.o] Error 1
The very first error is "expected identifier before 'const'", due to "const"
keyword used as enumeration, in rtl.def,
Further speaking, CONST is defined to const in include/ansidecl.h, only when
without IN_GCC defined,
But if I use -DIN_GCC to compile my own plugin, it produced other more random
errors,
So I think the problem is because rtl.def ansidecl.h conflicts,
Searched one mail archive on this Feb 2010 is related, but the author didn't
tell how to "reorder",
http://www.mail-archive.com/gcc@gcc.gnu.org/msg49585.html
BTW: There may be other gcc-4.5.0 new plugin system bugs, I personally suggest
a new bugzilla component "gcc-plugin" for this category of bugs;
--
Summary: plugin compile error: rtl.def uses "const" keyword
because of "CONST" defined to "const" in
include/ansidecl.h
Product: gcc
Version: 4.5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: crquan at gmail dot com
GCC host triplet: native x86_64-linux and i686-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44056