All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/5] Add support for the MinGW platform
@ 2013-05-21 19:16 Ramsay Jones
  2013-05-21 22:09 ` Josh Triplett
  0 siblings, 1 reply; 5+ messages in thread
From: Ramsay Jones @ 2013-05-21 19:16 UTC (permalink / raw)
  To: Christopher Li; +Cc: Sparse Mailing-list



Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
---
 cgcc | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/cgcc b/cgcc
index c075e5f..e94a965 100755
--- a/cgcc
+++ b/cgcc
@@ -226,6 +226,19 @@ sub add_specs {
 	    ' -D__OpenBSD__=1';
     } elsif ($spec eq 'unix') {
 	return ' -Dunix=1 -D__unix=1 -D__unix__=1';
+    } elsif ($spec =~ /^mingw/) {
+	return ' -isystem /mingw/include' .
+	    ' -D__MINGW32__=1' .
+	    ' -D__MSVCRT__=1' .
+	    ' -DWIN32=1 -D_WIN32=1 -D__WIN32=1 -D__WIN32__=1' .
+	    ' -DWINNT=1 -D__WINNT=1 -D__WINNT__=1' .
+	    " -D'_cdecl=__attribute__((__cdecl__))'" .
+	    " -D'__cdecl=__attribute__((__cdecl__))'" .
+	    " -D'_stdcall=__attribute__((__stdcall__))'" .
+	    " -D'__stdcall=__attribute__((__stdcall__))'" .
+	    " -D'_fastcall=__attribute__((__fastcall__))'" .
+	    " -D'__fastcall=__attribute__((__fastcall__))'" .
+	    " -D'__declspec(x)=__attribute__((x))'";
     } elsif ( $spec =~ /^cygwin/) {
 	return &add_specs ('unix') .
 	    ' -D__CYGWIN__=1 -D__CYGWIN32__=1' .
-- 
1.8.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/5] Add support for the MinGW platform
  2013-05-21 19:16 [PATCH 2/5] Add support for the MinGW platform Ramsay Jones
@ 2013-05-21 22:09 ` Josh Triplett
  2013-05-22 22:07   ` Ramsay Jones
  0 siblings, 1 reply; 5+ messages in thread
From: Josh Triplett @ 2013-05-21 22:09 UTC (permalink / raw)
  To: Ramsay Jones; +Cc: Christopher Li, Sparse Mailing-list

On Tue, May 21, 2013 at 08:16:38PM +0100, Ramsay Jones wrote:
> Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>

I believe this will match both 32-bit and 64-bit MinGW, which seems
wrong.  Please do check the architecture strings for 32-bit and 64-bit
MinGW, and handle them separately.

> ---
>  cgcc | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/cgcc b/cgcc
> index c075e5f..e94a965 100755
> --- a/cgcc
> +++ b/cgcc
> @@ -226,6 +226,19 @@ sub add_specs {
>  	    ' -D__OpenBSD__=1';
>      } elsif ($spec eq 'unix') {
>  	return ' -Dunix=1 -D__unix=1 -D__unix__=1';
> +    } elsif ($spec =~ /^mingw/) {
> +	return ' -isystem /mingw/include' .
> +	    ' -D__MINGW32__=1' .
> +	    ' -D__MSVCRT__=1' .
> +	    ' -DWIN32=1 -D_WIN32=1 -D__WIN32=1 -D__WIN32__=1' .
> +	    ' -DWINNT=1 -D__WINNT=1 -D__WINNT__=1' .
> +	    " -D'_cdecl=__attribute__((__cdecl__))'" .
> +	    " -D'__cdecl=__attribute__((__cdecl__))'" .
> +	    " -D'_stdcall=__attribute__((__stdcall__))'" .
> +	    " -D'__stdcall=__attribute__((__stdcall__))'" .
> +	    " -D'_fastcall=__attribute__((__fastcall__))'" .
> +	    " -D'__fastcall=__attribute__((__fastcall__))'" .
> +	    " -D'__declspec(x)=__attribute__((x))'";
>      } elsif ( $spec =~ /^cygwin/) {
>  	return &add_specs ('unix') .
>  	    ' -D__CYGWIN__=1 -D__CYGWIN32__=1' .
> -- 
> 1.8.2
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/5] Add support for the MinGW platform
  2013-05-21 22:09 ` Josh Triplett
@ 2013-05-22 22:07   ` Ramsay Jones
  2013-05-23  0:46     ` Josh Triplett
  0 siblings, 1 reply; 5+ messages in thread
From: Ramsay Jones @ 2013-05-22 22:07 UTC (permalink / raw)
  To: Josh Triplett; +Cc: Christopher Li, Sparse Mailing-list

Josh Triplett wrote:
> On Tue, May 21, 2013 at 08:16:38PM +0100, Ramsay Jones wrote:
>> Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
> 
> I believe this will match both 32-bit and 64-bit MinGW, which seems
> wrong.  Please do check the architecture strings for 32-bit and 64-bit
> MinGW, and handle them separately.

Yes, given that, for me:

  $ uname -a
  MINGW32_NT-5.1 TOSHIBA 1.0.12(0.46/3/2) 2010-02-05 01:08 i686 unknown
  $

I'm hoping that the following change will be sufficient (I don't have
access to a 64-bit MinGW, so I don't know what 'uname -a' returns, but
I think this will work ... ;-):

  $ git diff
  diff --git a/cgcc b/cgcc
  index e94a965..68f96b9 100755
  --- a/cgcc
  +++ b/cgcc
  @@ -226,7 +226,7 @@ sub add_specs {
              ' -D__OpenBSD__=1';
       } elsif ($spec eq 'unix') {
          return ' -Dunix=1 -D__unix=1 -D__unix__=1';
  -    } elsif ($spec =~ /^mingw/) {
  +    } elsif ($spec =~ /^mingw32/) {
          return ' -isystem /mingw/include' .
              ' -D__MINGW32__=1' .
              ' -D__MSVCRT__=1' .
  $


ATB,
Ramsay Jones



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/5] Add support for the MinGW platform
  2013-05-22 22:07   ` Ramsay Jones
@ 2013-05-23  0:46     ` Josh Triplett
  2013-05-25 19:37       ` Ramsay Jones
  0 siblings, 1 reply; 5+ messages in thread
From: Josh Triplett @ 2013-05-23  0:46 UTC (permalink / raw)
  To: Ramsay Jones; +Cc: Christopher Li, Sparse Mailing-list

On Wed, May 22, 2013 at 11:07:27PM +0100, Ramsay Jones wrote:
> Josh Triplett wrote:
> > On Tue, May 21, 2013 at 08:16:38PM +0100, Ramsay Jones wrote:
> >> Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
> > 
> > I believe this will match both 32-bit and 64-bit MinGW, which seems
> > wrong.  Please do check the architecture strings for 32-bit and 64-bit
> > MinGW, and handle them separately.
> 
> Yes, given that, for me:
> 
>   $ uname -a
>   MINGW32_NT-5.1 TOSHIBA 1.0.12(0.46/3/2) 2010-02-05 01:08 i686 unknown
>   $
> 
> I'm hoping that the following change will be sufficient (I don't have
> access to a 64-bit MinGW, so I don't know what 'uname -a' returns, but
> I think this will work ... ;-):
> 
>   $ git diff
>   diff --git a/cgcc b/cgcc
>   index e94a965..68f96b9 100755
>   --- a/cgcc
>   +++ b/cgcc
>   @@ -226,7 +226,7 @@ sub add_specs {
>               ' -D__OpenBSD__=1';
>        } elsif ($spec eq 'unix') {
>           return ' -Dunix=1 -D__unix=1 -D__unix__=1';
>   -    } elsif ($spec =~ /^mingw/) {
>   +    } elsif ($spec =~ /^mingw32/) {

Unfortunately, I don't think that suffices; I've seen a few different
architecture triples used for 64-bit MinGW, some of which include
"mingw32".  I *think* it might work to match i[3-6]86-.*-mingw.

- Josh Triplett

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/5] Add support for the MinGW platform
  2013-05-23  0:46     ` Josh Triplett
@ 2013-05-25 19:37       ` Ramsay Jones
  0 siblings, 0 replies; 5+ messages in thread
From: Ramsay Jones @ 2013-05-25 19:37 UTC (permalink / raw)
  To: Josh Triplett; +Cc: Christopher Li, Sparse Mailing-list

Josh Triplett wrote:
> On Wed, May 22, 2013 at 11:07:27PM +0100, Ramsay Jones wrote:
>> Josh Triplett wrote:
>>> On Tue, May 21, 2013 at 08:16:38PM +0100, Ramsay Jones wrote:
>>>> Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
>>>
>>> I believe this will match both 32-bit and 64-bit MinGW, which seems
>>> wrong.  Please do check the architecture strings for 32-bit and 64-bit
>>> MinGW, and handle them separately.
>>
>> Yes, given that, for me:
>>
>>   $ uname -a
>>   MINGW32_NT-5.1 TOSHIBA 1.0.12(0.46/3/2) 2010-02-05 01:08 i686 unknown
>>   $
>>
>> I'm hoping that the following change will be sufficient (I don't have
>> access to a 64-bit MinGW, so I don't know what 'uname -a' returns, but
>> I think this will work ... ;-):
>>
>>   $ git diff
>>   diff --git a/cgcc b/cgcc
>>   index e94a965..68f96b9 100755
>>   --- a/cgcc
>>   +++ b/cgcc
>>   @@ -226,7 +226,7 @@ sub add_specs {
>>               ' -D__OpenBSD__=1';
>>        } elsif ($spec eq 'unix') {
>>           return ' -Dunix=1 -D__unix=1 -D__unix__=1';
>>   -    } elsif ($spec =~ /^mingw/) {
>>   +    } elsif ($spec =~ /^mingw32/) {
> 
> Unfortunately, I don't think that suffices; I've seen a few different
> architecture triples used for 64-bit MinGW, some of which include
> "mingw32".

You are kidding, right?

>              I *think* it might work to match i[3-6]86-.*-mingw.

Is this pattern to be matched against "uname -s"?

Maybe I could match "uname -m" to i?86 *in addition* to the above?

At this point I'm guessing. Again, I don't have access to a 64-bit
MinGW system. Maybe support for 64-bit MinGW should be implemented
by a patch on top of this one (by someone who uses 64-bit MinGW).

ATB,
Ramsay Jones



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-05-25 20:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-05-21 19:16 [PATCH 2/5] Add support for the MinGW platform Ramsay Jones
2013-05-21 22:09 ` Josh Triplett
2013-05-22 22:07   ` Ramsay Jones
2013-05-23  0:46     ` Josh Triplett
2013-05-25 19:37       ` Ramsay Jones

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.