This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] mingw fixincl hacks for extern inline (PR bootstrap/30589)
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Bruce Korb <bkorb at gnu dot org>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Fri, 2 Nov 2007 16:25:19 -0400
- Subject: [PATCH] mingw fixincl hacks for extern inline (PR bootstrap/30589)
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
Hi!
_mingw.h between 3.2 and 3.10 inclusive used:
#ifdef __cplusplus
#define __CRT_INLINE inline
#else
#define __CRT_INLINE extern __inline__
#endif
(which needs fixincluding for -std=gnu99 or -std=c99 compilation with gcc
4.3), 3.11 has:
#ifdef __cplusplus
# define __CRT_INLINE inline
#else
# if ( __MINGW_GNUC_PREREQ(4, 3) && __STDC_VERSION__ >= 199901L)
# define __CRT_INLINE extern __attribute__((__gnu__inline__)) inline
# else
# define __CRT_INLINE extern __inline__
# endif
#endif
which has a typo in it - the attribute is __gnu_inline__ with just one
underscore in between the words and only 3.12+ has:
#ifdef __cplusplus
# define __CRT_INLINE inline
#else
# if __GNUC_STDC_INLINE__
# define __CRT_INLINE extern inline __attribute__((__gnu_inline__))
# else
# define __CRT_INLINE extern __inline__
# endif
#endif
which is correct. The patch below adds fixincludes stuff for this.
This is just from looking at and playing with _mingw.h from various
mingw-runtime-3.*.tar.gz tarballs, so I'd appreciate if somebody with
access to mingw could actually test it for real, I have only tested it
with make check in fixincludes on x86_64-linux.
Ok for trunk if somebody tests it on mingw?
2007-11-02 Jakub Jelinek <jakub@redhat.com>
Brooks Moses <brooks.moses@codesourcery.com>
PR bootstrap/30589
* inclhack.def (mingw_crt_inline, mingw_gnu__inline): New.
* fixincl.x: Regenerate.
* tests/base/_mingw.h: New.
--- fixincludes/inclhack.def.jj 2007-10-15 15:28:41.000000000 +0200
+++ fixincludes/inclhack.def 2007-11-02 16:17:09.000000000 +0100
@@ -2584,6 +2584,37 @@ fix = {
/*
+ * MinGW extern inline -- __CRT_INLINE needs to use the __gnu_inline__
+ * attribute (PR 30589)
+ */
+fix = {
+ hackname = mingw_crt_inline;
+ files = _mingw.h;
+ mach = '*-*-mingw32*';
+ bypass = '__GNUC_STDC_INLINE__';
+ select = '^([ \t]*#[ \t]*define[ \t]+__CRT_INLINE[ \t]+extern)[ \t]+__inline__[ \t]*$';
+ c_fix = format;
+ c_fix_arg = "%1 __attribute__((__gnu_inline__)) inline";
+ test_text = "#ifdef __cplusplus\n#define __CRT_INLINE inline\n#else\n"
+ "#define __CRT_INLINE extern __inline__\n#endif\n";
+};
+
+
+/*
+ * MinGW extern inline -- typo in __CRT_INLINE definition (PR 30589)
+ */
+fix = {
+ hackname = mingw_gnu__inline;
+ files = _mingw.h;
+ mach = '*-*-mingw32*';
+ select = '__gnu__inline__';
+ c_fix = format;
+ c_fix_arg = "__gnu_inline__";
+ test_text = "#define __CRT_INLINE extern __attribute__((__gnu__inline__)) inline";
+};
+
+
+/*
* nested comment
*/
fix = {
--- fixincludes/fixincl.x.jj 2007-11-02 16:10:06.000000000 +0100
+++ fixincludes/fixincl.x 2007-11-02 16:17:17.000000000 +0100
@@ -2,11 +2,11 @@
*
* DO NOT EDIT THIS FILE (fixincl.x)
*
- * It has been AutoGen-ed Sunday October 14, 2007 at 06:17:05 PM EDT
+ * It has been AutoGen-ed Friday November 2, 2007 at 04:17:17 PM CET
* From the definitions inclhack.def
* and the template file fixincl
*/
-/* DO NOT SVN-MERGE THIS FILE, EITHER Sun Oct 14 18:17:05 EDT 2007
+/* DO NOT SVN-MERGE THIS FILE, EITHER Fri Nov 2 16:17:17 CET 2007
*
* You must regenerate it. Use the ./genfixes script.
*
@@ -15,7 +15,7 @@
* certain ANSI-incompatible system header files which are fixed to work
* correctly with ANSI C and placed in a directory that GNU C will search.
*
- * This file contains 210 fixup descriptions.
+ * This file contains 212 fixup descriptions.
*
* See README for more information.
*
@@ -4589,6 +4589,87 @@ static const char* apzMath_Huge_Val_From
/* * * * * * * * * * * * * * * * * * * * * * * * * *
*
+ * Description of Mingw_Crt_Inline fix
+ */
+tSCC zMingw_Crt_InlineName[] =
+ "mingw_crt_inline";
+
+/*
+ * File name selection pattern
+ */
+tSCC zMingw_Crt_InlineList[] =
+ "_mingw.h\0";
+/*
+ * Machine/OS name selection pattern
+ */
+tSCC* apzMingw_Crt_InlineMachs[] = {
+ "*-*-mingw32*",
+ (const char*)NULL };
+
+/*
+ * content selection pattern - do fix if pattern found
+ */
+tSCC zMingw_Crt_InlineSelect0[] =
+ "^([ \\t]*#[ \\t]*define[ \\t]+__CRT_INLINE[ \\t]+extern)[ \\t]+__inline__[ \\t]*$";
+
+/*
+ * content bypass pattern - skip fix if pattern found
+ */
+tSCC zMingw_Crt_InlineBypass0[] =
+ "__GNUC_STDC_INLINE__";
+
+#define MINGW_CRT_INLINE_TEST_CT 2
+static tTestDesc aMingw_Crt_InlineTests[] = {
+ { TT_NEGREP, zMingw_Crt_InlineBypass0, (regex_t*)NULL },
+ { TT_EGREP, zMingw_Crt_InlineSelect0, (regex_t*)NULL }, };
+
+/*
+ * Fix Command Arguments for Mingw_Crt_Inline
+ */
+static const char* apzMingw_Crt_InlinePatch[] = {
+ "format",
+ "%1 __attribute__((__gnu_inline__)) inline",
+ (char*)NULL };
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ * Description of Mingw_Gnu__Inline fix
+ */
+tSCC zMingw_Gnu__InlineName[] =
+ "mingw_gnu__inline";
+
+/*
+ * File name selection pattern
+ */
+tSCC zMingw_Gnu__InlineList[] =
+ "_mingw.h\0";
+/*
+ * Machine/OS name selection pattern
+ */
+tSCC* apzMingw_Gnu__InlineMachs[] = {
+ "*-*-mingw32*",
+ (const char*)NULL };
+
+/*
+ * content selection pattern - do fix if pattern found
+ */
+tSCC zMingw_Gnu__InlineSelect0[] =
+ "__gnu__inline__";
+
+#define MINGW_GNU__INLINE_TEST_CT 1
+static tTestDesc aMingw_Gnu__InlineTests[] = {
+ { TT_EGREP, zMingw_Gnu__InlineSelect0, (regex_t*)NULL }, };
+
+/*
+ * Fix Command Arguments for Mingw_Gnu__Inline
+ */
+static const char* apzMingw_Gnu__InlinePatch[] = {
+ "format",
+ "__gnu_inline__",
+ (char*)NULL };
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
* Description of Nested_Auth_Des fix
*/
tSCC zNested_Auth_DesName[] =
@@ -8539,9 +8620,9 @@ static const char* apzX11_SprintfPatch[]
*
* List of all fixes
*/
-#define REGEX_COUNT 253
+#define REGEX_COUNT 256
#define MACH_LIST_SIZE_LIMIT 261
-#define FIX_COUNT 210
+#define FIX_COUNT 212
/*
* Enumerate the fixes
@@ -8657,6 +8738,8 @@ typedef enum {
MACHINE_NAME_FIXIDX,
MATH_EXCEPTION_FIXIDX,
MATH_HUGE_VAL_FROM_DBL_MAX_FIXIDX,
+ MINGW_CRT_INLINE_FIXIDX,
+ MINGW_GNU__INLINE_FIXIDX,
NESTED_AUTH_DES_FIXIDX,
NESTED_MOTOROLA_FIXIDX,
NESTED_SYS_LIMITS_FIXIDX,
@@ -9310,6 +9393,16 @@ tFixDesc fixDescList[ FIX_COUNT ] = {
MATH_HUGE_VAL_FROM_DBL_MAX_TEST_CT, FD_MACH_ONLY | FD_SHELL_SCRIPT,
aMath_Huge_Val_From_Dbl_MaxTests, apzMath_Huge_Val_From_Dbl_MaxPatch, 0 },
+ { zMingw_Crt_InlineName, zMingw_Crt_InlineList,
+ apzMingw_Crt_InlineMachs,
+ MINGW_CRT_INLINE_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
+ aMingw_Crt_InlineTests, apzMingw_Crt_InlinePatch, 0 },
+
+ { zMingw_Gnu__InlineName, zMingw_Gnu__InlineList,
+ apzMingw_Gnu__InlineMachs,
+ MINGW_GNU__INLINE_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
+ aMingw_Gnu__InlineTests, apzMingw_Gnu__InlinePatch, 0 },
+
{ zNested_Auth_DesName, zNested_Auth_DesList,
apzNested_Auth_DesMachs,
NESTED_AUTH_DES_TEST_CT, FD_MACH_ONLY | FD_SUBROUTINE,
--- fixincludes/tests/base/_mingw.h.jj 2007-11-02 16:10:53.000000000 +0100
+++ fixincludes/tests/base/_mingw.h 2007-11-02 16:17:26.000000000 +0100
@@ -0,0 +1,24 @@
+/* DO NOT EDIT THIS FILE.
+
+ It has been auto-edited by fixincludes from:
+
+ "fixinc/tests/inc/_mingw.h"
+
+ This had to be done to correct non-standard usages in the
+ original, manufacturer supplied header file. */
+
+
+
+#if defined( MINGW_CRT_INLINE_CHECK )
+#ifdef __cplusplus
+#define __CRT_INLINE inline
+#else
+#define __CRT_INLINE extern __attribute__((__gnu_inline__)) inline
+#endif
+
+#endif /* MINGW_CRT_INLINE_CHECK */
+
+
+#if defined( MINGW_GNU__INLINE_CHECK )
+#define __CRT_INLINE extern __attribute__((__gnu_inline__)) inline
+#endif /* MINGW_GNU__INLINE_CHECK */
Jakub