This is the mail archive of the crossgcc@cygnus.com mailing list for the crossgcc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: mingw-hosted xgcc


Mumit Khan wrote:
> Kai Ruottu wrote:
> > going through the MS library routines to cpp :
> > 
> > %{!mh:%{!ms:-D__SIZE_TYPE__=unsigned\ int -D__PTRDIFF_TYPE__=int}}
> > %{mh:-D__SIZE_TYPE__=unsigned\ long -D__PTRDIFF_TYPE__=long}
> > %{ms:-D__SIZE_TYPE__=unsigned\ long -D__PTRDIFF_TYPE__=long}
> > 
> AFAIK, this doesn't work for any host, so blaming mingw32 is not fair. The
> specs parser in gcc is primitive at best, and having whitespace in the
> macro values don't work. The __SIZE_TYPE__ above will simply produce 
> the value "unsigned" after you preprocess.

 Those were as they are in the h8300-hms target 'specs' file... The backslash
is seemingly aimed to enable the space to go through...  Anyhow, the mingw32 
was the first host where this didn't work, giving a "too many parameters to 
cpp" error. The MS 'spawn()' in 'CRTDLL.DLL' is here to blame, not mingw32....

 When these things are in the current GCC, in both gcc-2.8.1 and egcs-1.1.1 
sources, this is just a 'something must be done' problem for mingw32 now.

 To change the GCC config files for h8300 and to move these things from there
into newlib headers, has already suggested by me... The other possibility is
to try to fix the mingw32 port, so that these things could work. Colin 
Peters, one of the mingw32 developers, has known this problem already (from
1997), the 'samples/fixargv' in the mingw32 sources contains a suggestion for
a better routine to do the job. A clip from the readme there:

------------------------ clip ------------------------------------------

This code is a utility function I was considering adding to Mingw32. The 
Microsoft versions of argc, argv construction use quotes and backslashes to 
allow the user to pass arguments containing spaces (or quotes) to programs
they invoke. The rules are

 - Arguments containing spaces must be enclosed in quotes.
 - A quote can be passed by preceeding it with a backslash.
 - Backslashes immediately preceeding a quote must be doubled to avoid
   escaping the quote.

Thus an argument like:

 -D="Foo Bar\\"

needs to be mangled as:

 "-D\"Foo Bar\\\\\""

in order to get to the program as what was intended above.
---------------------- clip ------------------------------

 The current 'fixargv' in 'pexecute' is much simpler and doesn't handle
this '\ ' case. I tried putting '"'s around the defines, adding more '\'s
etc., but nothing seemed to help. So, I just only removed those predefines 
from 'specs' and moved them to h8300-hms headers, and not tried to use the 
Colin's suggested 'fixargv' in 'pexecute' yet.

> I haven't followed this thread, and hence missing the context, but there
> are other, and better, ways to achieve this.

 If you have any suggestion how to solve this problem, please tell it...

 I think that getting the h8300-hms, mips etc. ports in GCC and newlib sources 
changed can be the hard way, however. Less trouble could be with getting the
'fixargv' work for these cases... I really don't mean that you, Colin or 
someone else of the mingw32 developers should do the tests and possible 
fixings, but if Jyrki (the starter of this thread) or me try this and get it 
work a little better with these h8300-hms and mips original 'specs', some help
would be needed to get the fixes integrated to the coming egcs sources with
'support for mingw32 host'...

 Cheers, Kai
_______________________________________________
New CrossGCC FAQ: http://www.objsw.com/CrossGCC
_______________________________________________
To remove yourself from the crossgcc list, send
mail to crossgcc-request@cygnus.com with the
text 'unsubscribe' (without the quotes) in the
body of the message.