Markus Gerwinski wrote:
I wrote:
In file included from intl/libgnuintl.h:22, from intl.h:31, from c-parse.y:40: C:/MinGW/include/locale.h:87: parse error before "const"
Any idea what could be wrong here?
I meanwhile found out a really strange thing. The line denoted by the error message reads:
_CRTIMP char* __cdecl setlocale (int, const char*);
If I rename `setlocale' into e.g. `setlocale_foo', this header is compiled without complaint.
Could that be due to a difference between gcc 3.3.3 (which I'm basing my gpc-build on) and the gcc 3.2.3 that came with my MinGW?
The file gcc/intl.h (in gcc-3.3.4, probably also in 3.3.3) contains this
#ifdef HAVE_LOCALE_H # include <locale.h> #endif
#ifndef HAVE_SETLOCALE --> # define setlocale(category, locale) (locale) #endif
#ifdef USE_INCLUDED_LIBINTL --> # include <intl/libgnuintl.h> #else [...]
For some reason, HAVE_LOCALE_H seems not to be set, so <locale.h> (which should declare setlocale) isn't included immediately, or else this header is included again later and has (under Mingw) no multiple-include-protection.
Unless they have special reasons, it's usually better to modify system/library declarations using defines *after* including all system/library headers. I don't know if it's a mistake here, or if they indeed have special reasons to complicate things.
Anyway, it's a backend issue, so please report it to the GCC folks.
For a quick work-around, you could try moving the `define' section after the next one.
Prof A Olowofoyeku (The African Chief) wrote:
No idea. I have built gpc-20041218 successfully under Mingw with no problem. Perhaps this is backend (or bison) thing? I tend to build GPC/Mingw on a gcc-3.2.3 backend.
Which is currently recommended because of the system conditional issues, so you (Markus) might prefer this as well. Still you might want to report the problem, so it'll hopefully be fixed in future GCC releases.
Frank