This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


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

Re: gthr-win32.h patch


I hate to nitpick but please take a look at the rest of the ChangeLog
entries in gcc.  When a function is changed it is like this:

	* foo.c (foo_bar): Do something.

I'll add your change to gcc with the above modification to the ChangeLog.

cgf

On Thu, Jan 11, 2001 at 08:54:16AM +0100, Thomas Pfaff wrote:
>2001-01-10  Thomas Pfaff <tpfaff@gmx.net>
>
>    * gthr-win32.h: save and restore Win32 LastError in
>__gthread_objc_thread_get_data and __gthread_getspecific
>
>----- Original Message -----
>From: "Christopher Faylor" <cgf@redhat.com>
>To: "Thomas Pfaff" <tpfaff@gmx.net>
>Cc: <gcc-patches@gcc.gnu.org>
>Sent: Mittwoch, 10. Januar 2001 16:36
>Subject: Re: gthr-win32.h patch
>
>
>> This patch looks like it will do the right thing but you need to supply
>> a ChangeLog, too.
>>
>> I'll apply the patch once you supply the ChangeLog.  Send it to
>gcc-patches,
>> please.
>>
>> cgf
>>
>> On Wed, Jan 10, 2001 at 09:31:58AM +0100, Thomas Pfaff wrote:
>> >Hi,
>> >
>> >there is a problem with the -mthreads support for mingw32. If you compile
>> >with -mthreads and call a function that will throw an exception,
>> >__get_eh_context is called on function entry and the WIN32 LastError is
>> >cleared by TlsGetValue in gthread_getspecific. I have attached a patch
>that
>> >will preserve the WIN32 error.
>> >This patch will apply to gcc-current.
>> >
>> >Here is an example:
>> >
>> >#include <windows.h>
>> >
>> >#include <string>
>> >#include <iostream>
>> >
>> >using namespace std;
>> >
>> >static void FormatError( void );
>> >
>> >int main( void )
>> >{
>> >
>> > try {
>> >  SetLastError( ERROR_ACCESS_DENIED );
>> >  FormatError();
>> >  return 0;
>> > }
>> >
>> > catch( string &szError ) {
>> >  cerr << szError << endl;
>> > }
>> >
>> > catch( ... ) {
>> > }
>> >
>> > return 0;
>> >}
>> >
>> >static void FormatError( void )
>> >{
>> >
>> > int nLastError = GetLastError();
>> > char szLastError[2048];
>> > int nBufferSize = sizeof( szLastError );
>> >
>> > if( 0 == nLastError ) {
>> >  throw( string( "Last Error cleared by TlsGetValue" ) );
>> > }
>> >
>> > FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM, NULL,
>> >       nLastError, MAKELANGID( LANG_NEUTRAL, SUBLANG_SYS_DEFAULT ),
>> >       szLastError, nBufferSize, NULL );
>> >
>> > cerr << szLastError;
>> >}
>> >
>> >Without this patch you will see the "Last Error cleared" message,
>otherwise
>> >an "Access denied" as you would expect.
>> >
>> >Regards,
>> >
>> >Thomas Pfaff
>> >
>>
>>




-- 
cgf@cygnus.com                        Red Hat, Inc.
http://sources.redhat.com/            http://www.redhat.com/

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