Is it possible to tell which GPC platform and version is being used? [...] This would really help in writing portable code. What do you think?
Please check what gpc (gcc) defines now in your system.
This is most easily done by creating an empty file, say foo.p, and compiling it with the '-v' option. In a unix system, you can do this with:
# touch foo.p # gcc -v foo.p
At least in the version I compiled yesterday for the Alpha, the defines are:
/v/dunix40_alpha/gnu/gcc/2.7.2.1/lib/gcc-lib/alpha-dec-osf4.0/2.7.2.1/gpc-cpp -lang-pascal -v -nocharescape -undef -D__GNUC__=970528(2 -D__GPC__=970528(2 -D__GNUC_MINOR__=7 -D__unix__ -D__osf__ -D__alpha -D__alpha__ -D_LONGLONG -D__SYSTYPE_BSD__ -D_SYSTYPE_BSD -D__unix -D__SYSTYPE_BSD -Asystem(unix) -Asystem(xpg4) -Acpu(alpha) -Amachine(alpha) -D__LANGUAGE_C__ -D__LANGUAGE_C -DLANGUAGE_C /tmp/foo.p /tmp/ccaagopa.i GNU CPP version 970528(2.7.2.1)
So, it seems that the __GPC__ define at least will get screwed up, if it is generated like it is now.
Also, please consider using assertions (see manual) instead of defines if you need something that works only in e.g. '#if' constructs, but does not expand in the code.
Also, I'd recommend in using the same definitions as are defined for the GCC for the same host. Why add new ones?
Happy hacking!
Juki jtv@hut.fi
A couple of bugs from the 970510 snapshot I compiled but did not yet test very much:
Please check the use of strncmp() functions in the code. At least in the gpc-lex.c and gpc-decl.c there are calls (9?) to this function without the length parameter. Trivial to fix, so I don't bother you with a diff.
The generated Makefile does not search the gpc-gperf.c from the source directory, but rather unnecessarily requires the use of the gperf program to generate the hash table, if gpc is not compiled in the source tree.
Some other problems in the Makefile: - 'make' command makes only the gpc-common.o because the order of the rules is incorrect. 'make all' works better. Please re-order the rules.
- I don't think it's a good idea to install libgcc.a always when installing gpc. You could e.g. install it only if it does not exist in the destination directory.
- When I did 'make install' the compiler was recompiled again without reason. I did not yet check why this happened, has anyone else seen this?