[ros-diffs] [sserapion] 37351: Declare war, shock and awe, and utterly defeat auto-import in one day.

sserapion at svn.reactos.org sserapion at svn.reactos.org
Fri Nov 14 06:49:21 CET 2008


Author: sserapion
Date: Thu Nov 13 23:49:21 2008
New Revision: 37351

URL: http://svn.reactos.org/svn/reactos?rev=37351&view=rev
Log:
Declare war, shock and awe, and utterly defeat auto-import in one day.

Modified:
    branches/ros-amd64-bringup/reactos/include/crt/_mingw.h
    branches/ros-amd64-bringup/reactos/include/crt/stdio.h

Modified: branches/ros-amd64-bringup/reactos/include/crt/_mingw.h
URL: http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/include/crt/_mingw.h?rev=37351&r1=37350&r2=37351&view=diff
==============================================================================
--- branches/ros-amd64-bringup/reactos/include/crt/_mingw.h [iso-8859-1] (original)
+++ branches/ros-amd64-bringup/reactos/include/crt/_mingw.h [iso-8859-1] Thu Nov 13 23:49:21 2008
@@ -22,28 +22,50 @@
 #define __stdcall
 #endif
 
-#ifndef __GNUC__
+#if defined(_MSC_VER)
+# ifdef _DLL
 # ifndef __MINGW_IMPORT
 #  define __MINGW_IMPORT  __declspec(dllimport)
 # endif
 # ifndef _CRTIMP
 #  define _CRTIMP  __declspec(dllimport)
 # endif
+# else
+#  ifndef __MINGW_IMPORT
+#   define __MINGW_IMPORT
+#  endif
+# ifndef _CRTIMP
+#  define _CRTIMP
+# endif
+#endif
 # define __DECLSPEC_SUPPORTED
 # define __attribute__(x) /* nothing */
-#else /* __GNUC__ */
+# define __restrict__/* nothing */
+#elif defined(__GNUC__)
 # ifdef __declspec
 #  ifndef __MINGW_IMPORT
+#   ifdef _DLL
 /* Note the extern. This is needed to work around GCC's
 limitations in handling dllimport attribute.  */
 #   define __MINGW_IMPORT  extern __attribute__ ((__dllimport__))
+#   else
+#    define __MINGW_IMPORT extern
+#   endif
 #  endif
 #  ifndef _CRTIMP
-#   ifdef __USE_CRTIMP
-#    define _CRTIMP  __attribute__ ((dllimport))
-#   else
-#    define _CRTIMP
-#   endif
+#    undef __USE_CRTIMP
+#    if !defined (_CRTBLD) && !defined (_SYSCRT)
+#      define __USE_CRTIMP 1
+#    endif
+#    ifdef __USE_CRTIMP
+#     ifdef _DLL
+#      define _CRTIMP  __attribute__ ((dllimport))
+#    else
+#      define _CRTIMP
+#    endif
+#    else
+#     define _CRTIMP
+#    endif
 #  endif
 #  define __DECLSPEC_SUPPORTED
 # else /* __declspec */
@@ -53,6 +75,15 @@
 #   define _CRTIMP
 #  endif
 # endif /* __declspec */
+#else
+# ifndef __MINGW_IMPORT
+#  define __MINGW_IMPORT __declspec(dllimport)
+# endif
+# ifndef _CRTIMP
+#  define _CRTIMP __declspec(dllimport)
+# endif
+# define __DECLSPEC_SUPPORTED
+# define __attribute__(x)/* nothing */
 #endif
 
 #if defined (__GNUC__) && defined (__GNUC_MINOR__)
@@ -63,12 +94,22 @@
 #define __MINGW_GNUC_PREREQ(major, minor)  0
 #endif
 
+#if defined (_MSC_VER)
+#define __MINGW_MSC_PREREQ(major,minor) \
+  ((_MSC_VER /100) > (major) \
+   || ((_MSC)VER /100) == (major) && (_MSC_VER) % 100) >=(minor)))
+#else
+#define __MINGW_MSC_PREREQ(major, minor) 0
+#endif
+
 #define USE___UUIDOF	0
 
 #ifdef __cplusplus
 # define __CRT_INLINE inline
 #else
-# if ( __MINGW_GNUC_PREREQ(4, 3)  &&  __STDC_VERSION__ >= 199901L)
+# if defined(_MSC_VER)
+#  define __CRT_INLINE __inline
+# elif  __GNUC_STDC_INLINE__
 #  define __CRT_INLINE extern inline __attribute__((__gnu_inline__))
 # else
 #  define __CRT_INLINE extern __inline__
@@ -88,6 +129,9 @@
 #ifdef __GNUC__
 #define __MINGW_ATTRIB_NORETURN __attribute__ ((__noreturn__))
 #define __MINGW_ATTRIB_CONST __attribute__ ((__const__))
+#elif __MINGW_MSC_PREREQ(12, 0)
+#define __MINGW_ATTRIB_NORETURN __declspec(noreturn)
+#define __MINGW_ATTRIB_CONST
 #else
 #define __MINGW_ATTRIB_NORETURN
 #define __MINGW_ATTRIB_CONST
@@ -112,15 +156,22 @@
 
 #if  __MINGW_GNUC_PREREQ (3, 1)
 #define __MINGW_ATTRIB_DEPRECATED __attribute__ ((__deprecated__))
+#elif __MINGW_MSC_PREREQ(12, 0)
+#define __MINGW_ATTRIB_DEPRECATED __declspec(deprecated)
 #else
 #define __MINGW_ATTRIB_DEPRECATED
-#endif /* GNUC >= 3.1 */
+#endif
  
 #if  __MINGW_GNUC_PREREQ (3, 3)
 #define __MINGW_NOTHROW __attribute__ ((__nothrow__))
+#elif __MINGW_MSC_PREREQ(12, 0) && defined (__cplusplus)
+#define __MINGW_NOTHROW __declspec(nothrow)
 #else
 #define __MINGW_NOTHROW
-#endif /* GNUC >= 3.3 */
+#endif
+
+/* TODO: Mark (almost) all CRT functions as __MINGW_NOTHROW.  This will
+allow GCC to optimize away some EH unwind code, at least in DW2 case.  */
 
 #ifndef __MSVCRT_VERSION__
 /*  High byte is the major version, low byte is the minor. */

Modified: branches/ros-amd64-bringup/reactos/include/crt/stdio.h
URL: http://svn.reactos.org/svn/reactos/branches/ros-amd64-bringup/reactos/include/crt/stdio.h?rev=37351&r1=37350&r2=37351&view=diff
==============================================================================
--- branches/ros-amd64-bringup/reactos/include/crt/stdio.h [iso-8859-1] (original)
+++ branches/ros-amd64-bringup/reactos/include/crt/stdio.h [iso-8859-1] Thu Nov 13 23:49:21 2008
@@ -242,9 +242,10 @@
 #if __MINGW_GNUC_PREREQ(4,4)
 #pragma push_macro("vsnprintf")
 #pragma push_macro("snprintf")
+#endif
   #undef vsnprintf
   #undef snprintf
-#endif
+
   extern
 #ifdef gnu_printf
   __attribute__((format(gnu_printf, 3, 0))) __attribute__((nonnull (3)))
@@ -261,14 +262,7 @@
   int __cdecl sprintf(char *_Dest,const char *_Format,...);
   int __cdecl vsprintf(char *_Dest,const char *_Format,va_list _Args);
 #ifndef __NO_ISOCEXT  /* externs in libmingwex.a */
-  __CRT_INLINE int __cdecl snprintf(char* s, size_t n, const char*  format, ...) {
-	  int r;
-	  va_list a;
-	  __mingw_va_start(a, format);
-	  r = _vsnprintf (s, n, format, a);
-	  __mingw_va_end(a);
-	  return r;
-  }
+  int __cdecl snprintf(char* s, size_t n, const char*  format, ...);
   __CRT_INLINE int __cdecl vsnprintf (char* s, size_t n, const char* format,va_list arg) {
     return _vsnprintf ( s, n, format, arg);
   }



More information about the Ros-diffs mailing list