Tarmik wrote:
Hi !
After succesfully compiling dehydra on cygwin, I wanted to port
dehydra to use C language instead of C++ and...
It should already work on linux, or mostly work. I don't have any
testcases for this because the GCC C frontend really disappointed me in
terms of how little type info it has.
See https://bugzilla.mozilla.org/show_bug.cgi?id=421097 for more
history/discussion on the subject of porting to C.
I've added gcc plugin initialization code into c-objc-common.c - for C+
+ front end the same initialization code is
inside cp\cp-lang.c.
Then about parameters which I wanted to pass to gcc plugin...
global_namespace like we discussed previously is working only in C++,
in C it should be NULL...
#ifdef GCC_CP_NAME_LOOKUP_H
// C++ frontend only
plugin_set_param(14,&global_namespace,0);
#else
plugin_set_param(14,NULL,0);
#endif
But after that I've got following list of errors:
../../gcc-4.3.0/gcc/gcc_externals_setup.h:80: error:
`cp_walk_subtrees' undeclared (first use in this function)
../../gcc-4.3.0/gcc/gcc_externals_setup.h:80: error: (Each undeclared
identifier is reported only once
../../gcc-4.3.0/gcc/gcc_externals_setup.h:80: error: for each function
it appears in.)
../../gcc-4.3.0/gcc/gcc_externals_setup.h:94: error: `type_as_string'
undeclared (first use in this function)
../../gcc-4.3.0/gcc/gcc_externals_setup.h:95: error: `decl_as_string'
undeclared (first use in this function)
../../gcc-4.3.0/gcc/gcc_externals_setup.h:96: error: `expr_as_string'
undeclared (first use in this function)
../../gcc-4.3.0/gcc/gcc_externals_setup.h:97: error: `lang_decl_name'
undeclared (first use in this function)
../../gcc-4.3.0/gcc/gcc_externals_setup.h:98: error:
`class_key_or_enum_as_string' undeclared (first use in this function)
I've already checked some of those - for example
class_key_or_enum_as_string is relatively simple one - can can be
copied almost as is (e.g. 'class' does not exists in c - but it's
irrelevant probably).
cp_walk_subtrees probably came because previously I had tree checking
assertions enabled (now disabled). - can be dropped out for timebeing.
Other functions are more complex. For instance - 'expr_as_string'
equalent does not exists in C source codes.
Can someone provide me more information on what those functions do,
and how c++ / c remapping could be potentially handled ?
I'd just make some stubs for those functions that return strings and
return "not implemented" and otherwise unhelpful values and see how far
you get. You can read g++ source to figure out what the various
functions do.
On a possibly related topic.
So I don't know much about cygwin/windows porting. From what I heard
from plugin discussion on the gcc mailing list, you need to explicitly
export ALL of the symbols in windows GCC in order to match the linux
dlopen behavior..but perhaps cygwin takes care of that.
Good luck,
Taras
_______________________________________________
dev-static-analysis mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-static-analysis