public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Patch for mingw stdint information
@ 2009-04-03 20:24 FX
  2009-04-04  8:38 ` Danny Smith
  2009-04-08  0:43 ` Joseph S. Myers
  0 siblings, 2 replies; 5+ messages in thread
From: FX @ 2009-04-03 20:24 UTC (permalink / raw)
  To: dannysmith, kai.tietz, nightstrike; +Cc: gcc

[-- Attachment #1: Type: text/plain, Size: 764 bytes --]

Hi all,

Please find attached a patch I built to add stdint-related information  
to GCC configuration for the mingw target (see http://gcc.gnu.org/ml/gcc/2009-04/msg00000.html 
  for more details about why). I built it from looking at the mingw  
headers, because I have them on my laptop, I'm in a hotel room far  
from home and I can get to sleep :)  I've not done (and will not do in  
the foreseeable future) any testing, so they'll need to be  
bootstrapped and regtest on at least the gcc.dg/c99-stdint-*.c tests.  
If you find failures of c99-stdint-1.c, it means the mingw headers  
need fixing (I'm particularly worried about int_fast8_t, which is  
"char" rather than "signed char", and I suspect this could spell  
trouble).

I hope this can help,
FX


[-- Attachment #2: mingw-stdint.diff --]
[-- Type: application/octet-stream, Size: 2250 bytes --]

diff -pru trunk.unmodified/gcc/config/i386/mingw32.h trunk/gcc/config/i386/mingw32.h
--- trunk.unmodified/gcc/config/i386/mingw32.h	2009-04-03 10:48:59.000000000 +0530
+++ trunk/gcc/config/i386/mingw32.h	2009-04-04 01:40:08.000000000 +0530
@@ -155,6 +155,45 @@ do {						         \
 #undef WINT_TYPE
 #define WINT_TYPE "short unsigned int"
 
+/* Types from stdint.h.  */
+#define INT8_TYPE "signed char"
+#define INT16_TYPE "short int"
+#define INT32_TYPE "int"
+#define INT64_TYPE "long long int"
+#define UINT8_TYPE "unsigned char"
+#define UINT16_TYPE "short unsigned int"
+#define UINT32_TYPE "unsigned int"
+#define UINT64_TYPE "long long unsigned int"
+
+#define INT_LEAST8_TYPE "signed char"
+#define INT_LEAST16_TYPE "short int"
+#define INT_LEAST32_TYPE "int"
+#define INT_LEAST64_TYPE "long long int"
+#define UINT_LEAST8_TYPE "unsigned char"
+#define UINT_LEAST16_TYPE "short unsigned int"
+#define UINT_LEAST32_TYPE "unsigned int"
+#define UINT_LEAST64_TYPE "long long unsigned int"
+
+/* INT_FAST8_TYPE being "char" instead of "signed char" is weird.  */
+#define INT_FAST8_TYPE "char"
+#define INT_FAST16_TYPE "short int"
+#define INT_FAST32_TYPE "int"
+#define INT_FAST64_TYPE "long long int"
+#define UINT_FAST8_TYPE "unsigned char"
+#define UINT_FAST16_TYPE "short unsigned int"
+#define UINT_FAST32_TYPE "unsigned int"
+#define UINT_FAST64_TYPE "long long unsigned int"
+
+#if TARGET_64BIT_DEFAULT
+#define INTPTR_TYPE "long long int"
+#define UINTPTR_TYPE "long long unsigned int"
+#else
+#define INTPTR_TYPE "int"
+#define UINTPTR_TYPE "unsigned int"
+#endif
+
+#define SIG_ATOMIC_TYPE "int"
+
 /* mingw32 uses the  -mthreads option to enable thread support.  */
 #undef GOMP_SELF_SPECS
 #define GOMP_SELF_SPECS "%{fopenmp: -mthreads}"
diff -pru trunk.unmodified/gcc/config.gcc trunk/gcc/config.gcc
--- trunk.unmodified/gcc/config.gcc	2009-04-03 10:49:00.000000000 +0530
+++ trunk/gcc/config.gcc	2009-04-04 01:35:47.000000000 +0530
@@ -1265,6 +1265,7 @@ i[34567]86-*-mingw* | x86_64-*-mingw*)
 	c_target_objs="${c_target_objs} msformat-c.o"
 	cxx_target_objs="${cxx_target_objs} winnt-cxx.o msformat-c.o"
 	default_use_cxa_atexit=yes
+	use_gcc_stdint=wrap
 	case ${enable_threads} in
 	  "" | yes | win32)
 	  thread_file='win32'

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

* RE: Patch for mingw stdint information
  2009-04-03 20:24 Patch for mingw stdint information FX
@ 2009-04-04  8:38 ` Danny Smith
  2009-04-04  9:22   ` Kai Tietz
  2009-04-08  0:43 ` Joseph S. Myers
  1 sibling, 1 reply; 5+ messages in thread
From: Danny Smith @ 2009-04-04  8:38 UTC (permalink / raw)
  To: 'FX', dannysmith, kai.tietz, nightstrike; +Cc: gcc

> Hi all,
> 
> Please find attached a patch I built to add stdint-related 
> information  
> to GCC configuration for the mingw target (see 
> http://gcc.gnu.org/ml/gcc/2009-04/msg00000.html 
>   for more details about why).

Thanks for this.  I am just in the process of doning a testsuite run on exactly the the
same patch as yours 
(main diff is that I put everything in "mingw-stdint.h" for sanity reason.  I will need
Kai's help on 32/64 bit #ifdefs  

> I hope this can help,
It does of course.

Danny

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

* Re: Patch for mingw stdint information
  2009-04-04  8:38 ` Danny Smith
@ 2009-04-04  9:22   ` Kai Tietz
  2009-04-04 13:00     ` Dave Korn
  0 siblings, 1 reply; 5+ messages in thread
From: Kai Tietz @ 2009-04-04  9:22 UTC (permalink / raw)
  To: Danny Smith; +Cc: FX, dannysmith, kai.tietz, nightstrike, gcc

2009/4/4 Danny Smith <dannysmith@clear.net.nz>:
>> Hi all,
>>
>> Please find attached a patch I built to add stdint-related
>> information
>> to GCC configuration for the mingw target (see
>> http://gcc.gnu.org/ml/gcc/2009-04/msg00000.html
>>   for more details about why).
>
> Thanks for this.  I am just in the process of doning a testsuite run on exactly the the
> same patch as yours
> (main diff is that I put everything in "mingw-stdint.h" for sanity reason.  I will need
> Kai's help on 32/64 bit #ifdefs
>
>> I hope this can help,
> It does of course.
>
> Danny
>
>

Thanks for the patch. Are those defines really just for default target
necessary? Shouldn't be the defines target dependent?
Something like '#define UINTPTR_TYPE (TARGET_64BIT ? "long long int" : "int")' ?

Cheers,
Kai


-- 
|  (\_/) This is Bunny. Copy and paste
| (='.'=) Bunny into your signature to help
| (")_(") him gain world domination

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

* Re: Patch for mingw stdint information
  2009-04-04  9:22   ` Kai Tietz
@ 2009-04-04 13:00     ` Dave Korn
  0 siblings, 0 replies; 5+ messages in thread
From: Dave Korn @ 2009-04-04 13:00 UTC (permalink / raw)
  To: Kai Tietz; +Cc: Danny Smith, FX, dannysmith, kai.tietz, nightstrike, gcc

Kai Tietz wrote:
> 2009/4/4 Danny Smith <dannysmith@clear.net.nz>:

>> in "mingw-stdint.h" for sanity reason.  I will need Kai's help on 32/64
>> bit #ifdefs

> Thanks for the patch. Are those defines really just for default target 
> necessary? Shouldn't be the defines target dependent? Something like
> '#define UINTPTR_TYPE (TARGET_64BIT ? "long long int" : "int")' ?

  The config/newlib-stdint.h header provides a working example of adapting to
the varying sizes of different types, by using the xxx_TYPE_SIZE definitions.
 Assuming those change properly in response to TARGET_64BIT, they might be
considered more canonical than effectively inferring their values from the
target flag.

    cheers,
      DaveK


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

* Re: Patch for mingw stdint information
  2009-04-03 20:24 Patch for mingw stdint information FX
  2009-04-04  8:38 ` Danny Smith
@ 2009-04-08  0:43 ` Joseph S. Myers
  1 sibling, 0 replies; 5+ messages in thread
From: Joseph S. Myers @ 2009-04-08  0:43 UTC (permalink / raw)
  To: FX; +Cc: dannysmith, kai.tietz, nightstrike, gcc

On Sat, 4 Apr 2009, FX wrote:

> find failures of c99-stdint-1.c, it means the mingw headers need fixing (I'm
> particularly worried about int_fast8_t, which is "char" rather than "signed
> char", and I suspect this could spell trouble).

These types being plain "char" fails to conform to C99, but the compiler 
code allows it (and the testcases allow it) because of use in Solaris 
headers (and changing for an existing system would break compatibility of 
C++ mangling for any code using the type).  (Plain "char" is not a "signed 
integer type" or "unsigned integer type" in C99 terms, and the types are 
required to be signed integer types or unsigned integer types.)

-- 
Joseph S. Myers
joseph@codesourcery.com

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

end of thread, other threads:[~2009-04-08  0:37 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-03 20:24 Patch for mingw stdint information FX
2009-04-04  8:38 ` Danny Smith
2009-04-04  9:22   ` Kai Tietz
2009-04-04 13:00     ` Dave Korn
2009-04-08  0:43 ` Joseph S. Myers

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).