4
0
mirror of git://sourceware.org/git/newlib-cygwin.git synced 2025-01-18 12:29:32 +08:00

* crt1.c: (__mingw_CRTStartup): Change return to void. Add

noreturn attribute. Align stack to 16 bytes before passing args
	to main.
	(mainCRTStartup): Change return to void.
	(WinMainCRTStartup): Likewise.
This commit is contained in:
Danny Smith 2004-08-24 08:49:33 +00:00
parent ef642316f6
commit 45b1139e41
2 changed files with 22 additions and 18 deletions

View File

@ -1,3 +1,12 @@
2004-08-24 Danny Smith <dannysmith@users.sourceforge.net>
* crt1.c: (__mingw_CRTStartup): Change return to void. Add
noreturn attribute. Align stack to 16 bytes before passing args
to main.
(mainCRTStartup): Change return to void.
(WinMainCRTStartup): Likewise.
2004-08-15 Danny Smith <dannysmith@users.sourceforge.net> 2004-08-15 Danny Smith <dannysmith@users.sourceforge.net>
* profile/COPYING: New file. * profile/COPYING: New file.

View File

@ -9,10 +9,8 @@
* *
*/ */
/* Hide the declaration of _fmode with dllimport attribute in stdlib.h. /* Hide the declaration of _fmode with dllimport attribute in stdlib.h to
This is not necessary with Mumit Khan's patches to gcc's winnt.c, avoid problems with older GCC. */
but those patches are still unofficial. */
#define __IN_MINGW_RUNTIME #define __IN_MINGW_RUNTIME
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h> #include <stdio.h>
@ -30,7 +28,6 @@
* a-good-idea use of include. */ * a-good-idea use of include. */
#include "init.c" #include "init.c"
extern void _pei386_runtime_relocator (void); extern void _pei386_runtime_relocator (void);
extern int main (int, char **, char **); extern int main (int, char **, char **);
@ -62,7 +59,7 @@ extern int* __p__fmode(void); /* To access the dll _fmode */
extern int _CRT_fmode; extern int _CRT_fmode;
static void static void
_mingw32_init_fmode () _mingw32_init_fmode (void)
{ {
/* Don't set the std file mode if the user hasn't set any value for it. */ /* Don't set the std file mode if the user hasn't set any value for it. */
if (_CRT_fmode) if (_CRT_fmode)
@ -96,7 +93,6 @@ _mingw32_init_fmode ()
#else #else
*_imp___fmode_dll = _fmode; *_imp___fmode_dll = _fmode;
#endif #endif
} }
/* This function will be called when a trap occurs. Thanks to Jacob /* This function will be called when a trap occurs. Thanks to Jacob
@ -164,8 +160,8 @@ _gnu_exception_handler (EXCEPTION_POINTERS * exception_data)
/* /*
* The function mainCRTStartup is the entry point for all console programs. * The function mainCRTStartup is the entry point for all console programs.
*/ */
static int static void __attribute__((noreturn))
__mingw_CRTStartup () __mingw_CRTStartup (void)
{ {
int nRet; int nRet;
@ -194,11 +190,14 @@ __mingw_CRTStartup ()
* NOTE: DLLs don't do this because that would be rude! * NOTE: DLLs don't do this because that would be rude!
*/ */
_mingw32_init_fmode (); _mingw32_init_fmode ();
/* Adust references to dllimported data that have non-zero offsets. */ /* Adust references to dllimported data that have non-zero offsets. */
_pei386_runtime_relocator (); _pei386_runtime_relocator ();
/* Align the stack to 16 bytes for the sake of SSE ops in main
or in functions inlined into main. */
asm __volatile__ ("andl $-16, %%esp" : : : "%esp");
/* /*
* Call the main function. If the user does not supply one * Call the main function. If the user does not supply one
* the one in the 'libmingw32.a' library will be linked in, and * the one in the 'libmingw32.a' library will be linked in, and
@ -214,21 +213,18 @@ __mingw_CRTStartup ()
_cexit (); _cexit ();
ExitProcess (nRet); ExitProcess (nRet);
return 0;
} }
/* /*
* The function mainCRTStartup is the entry point for all console programs. * The function mainCRTStartup is the entry point for all console programs.
*/ */
int void
mainCRTStartup () mainCRTStartup (void)
{ {
#ifdef __MSVCRT__ #ifdef __MSVCRT__
__set_app_type (__CONSOLE_APP); __set_app_type (__CONSOLE_APP);
#endif #endif
__mingw_CRTStartup (); __mingw_CRTStartup ();
return 0;
} }
/* /*
@ -236,14 +232,13 @@ mainCRTStartup ()
* This simply gets rid of the annoying warning about not being able * This simply gets rid of the annoying warning about not being able
* to find WinMainCRTStartup when linking GUI applications. * to find WinMainCRTStartup when linking GUI applications.
*/ */
int void
WinMainCRTStartup () WinMainCRTStartup (void)
{ {
#ifdef __MSVCRT__ #ifdef __MSVCRT__
__set_app_type (__GUI_APP); __set_app_type (__GUI_APP);
#endif #endif
__mingw_CRTStartup (); __mingw_CRTStartup ();
return 0;
} }
/* /*