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]

small win32 ABI patch


The following patch is needed for Win32 targets to comply with MS ABI.
The test case included shows that the default value of 1 set in toplev.c
for DEFAULT_PCC_STRUCT_RETURN is not appropriate for win32 targets.

Test case:

  /* bug report and test case courtesy of Gert van Antwerpen
     <antwerp@tpd.tno.nl> */

  #include <windows.h>
  #include <stdio.h>
  int
  main ()
  {
    FARPROC f;
    HANDLE h;
    COORD c;		/* <<< this is a struct, and shows the problem. */
    long d;

    /* Get console */
    h = GetStdHandle (STD_OUTPUT_HANDLE);

    /* Do it indirect */
    f = GetLargestConsoleWindowSize;
    d = (*f) (h);

    /* Do it directly */
    c = GetLargestConsoleWindowSize (h);  /* <<< Here's the problem */

    /* This MUST be equal results ... */
    printf ("%d,%d\n", LOWORD (d), HIWORD (d));
    printf ("%d,%d\n", c.X, c.Y);
    return 0;
  }


Wed Aug  5 11:59:37 1998  Mumit Khan  <khan@xraylith.wisc.edu>
	
	* i386/cygwin32 (DEFAULT_PCC_STRUCT_RETURN): Define.

Index: gcc/config/i386/cygwin32.h
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/config/i386/cygwin32.h,v
retrieving revision 1.12.2.1
diff -u -3 -p -r1.12.2.1 cygwin32.h
--- gcc/config/i386/cygwin32.h	1998/07/28 22:31:07	1.12.2.1
+++ gcc/config/i386/cygwin32.h	1998/08/05 17:08:59
@@ -417,3 +417,8 @@ do {								\
 extern void i386_pe_record_external_function PROTO((char *));
 extern void i386_pe_declare_function_type STDIO_PROTO((FILE *, char *, int));
 extern void i386_pe_asm_file_end STDIO_PROTO((FILE *));
+
+/* For Win32 ABI compatibility */
+#undef DEFAULT_PCC_STRUCT_RETURN
+#define DEFAULT_PCC_STRUCT_RETURN 0
+

Regards,
Mumit


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