widl: Updated to 1.5.22 version

git-svn-id: svn+ssh://svn.code.sf.net/p/mingw-w64/code/trunk@5544 4407c894-4637-0410-b4f5-ada5f102cad1
diff --git a/mingw-w64-tools/widl/VERSION b/mingw-w64-tools/widl/VERSION
index 1510f94..0f66934 100644
--- a/mingw-w64-tools/widl/VERSION
+++ b/mingw-w64-tools/widl/VERSION
@@ -1 +1 @@
-WIDL version 1.5.21
+WIDL version 1.5.22
diff --git a/mingw-w64-tools/widl/configure b/mingw-w64-tools/widl/configure
index 781571a..92ec20d 100755
--- a/mingw-w64-tools/widl/configure
+++ b/mingw-w64-tools/widl/configure
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for widl 1.5.21.
+# Generated by GNU Autoconf 2.69 for widl 1.5.22.
 #
 # Report bugs to <mingw-w64-public@lists.sourceforge.net>.
 #
@@ -580,8 +580,8 @@
 # Identity of this package.
 PACKAGE_NAME='widl'
 PACKAGE_TARNAME='widl'
-PACKAGE_VERSION='1.5.21'
-PACKAGE_STRING='widl 1.5.21'
+PACKAGE_VERSION='1.5.22'
+PACKAGE_STRING='widl 1.5.22'
 PACKAGE_BUGREPORT='mingw-w64-public@lists.sourceforge.net'
 PACKAGE_URL=''
 
@@ -1278,7 +1278,7 @@
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures widl 1.5.21 to adapt to many kinds of systems.
+\`configure' configures widl 1.5.22 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1349,7 +1349,7 @@
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
-     short | recursive ) echo "Configuration of widl 1.5.21:";;
+     short | recursive ) echo "Configuration of widl 1.5.22:";;
    esac
   cat <<\_ACEOF
 
@@ -1441,7 +1441,7 @@
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-widl configure 1.5.21
+widl configure 1.5.22
 generated by GNU Autoconf 2.69
 
 Copyright (C) 2012 Free Software Foundation, Inc.
@@ -1994,7 +1994,7 @@
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by widl $as_me 1.5.21, which was
+It was created by widl $as_me 1.5.22, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
@@ -2933,7 +2933,7 @@
 
 # Define the identity of the package.
  PACKAGE='widl'
- VERSION='1.5.21'
+ VERSION='1.5.22'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -5493,7 +5493,7 @@
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by widl $as_me 1.5.21, which was
+This file was extended by widl $as_me 1.5.22, which was
 generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
@@ -5559,7 +5559,7 @@
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
-widl config.status 1.5.21
+widl config.status 1.5.22
 configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
diff --git a/mingw-w64-tools/widl/include/basetsd.h b/mingw-w64-tools/widl/include/basetsd.h
index 4a59897..f855352 100644
--- a/mingw-w64-tools/widl/include/basetsd.h
+++ b/mingw-w64-tools/widl/include/basetsd.h
@@ -36,7 +36,7 @@
  * 64-bit.
  */
 
-#if (defined(__x86_64__) || defined(__powerpc64__) || defined(__sparc64__)) && !defined(_WIN64)
+#if (defined(__x86_64__) || defined(__powerpc64__) || defined(__sparc64__) || defined(__aarch64__)) && !defined(_WIN64)
 #define _WIN64
 #endif
 
@@ -297,6 +297,14 @@
 # undef  WORDS_BIGENDIAN
 # undef  BITFIELDS_BIGENDIAN
 # undef  ALLOW_UNALIGNED_ACCESS
+#elif defined(__AARCH64EB__)
+# define WORDS_BIGENDIAN
+# define BITFIELDS_BIGENDIAN
+# undef  ALLOW_UNALIGNED_ACCESS
+#elif defined(__AARCH64EL__) || defined(__aarch64__)
+# undef  WORDS_BIGENDIAN
+# undef  BITFIELDS_BIGENDIAN
+# undef  ALLOW_UNALIGNED_ACCESS
 #elif defined(__MIPSEB__)
 # define WORDS_BIGENDIAN
 # define BITFIELDS_BIGENDIAN
diff --git a/mingw-w64-tools/widl/include/winnt.h b/mingw-w64-tools/widl/include/winnt.h
index 467b427..f2bf990 100644
--- a/mingw-w64-tools/widl/include/winnt.h
+++ b/mingw-w64-tools/widl/include/winnt.h
@@ -1672,6 +1672,75 @@
 
 #endif /* __arm__ */
 
+#ifdef __aarch64__
+/*
+ * FIXME:
+ *
+ * There is not yet an official CONTEXT structure defined for the AArch64
+ * architecture, so I just made one up.
+ *
+ */
+
+#define CONTEXT_ARM64           0x2000000
+#define CONTEXT_CONTROL         (CONTEXT_ARM64 | 0x00000001)
+#define CONTEXT_INTEGER         (CONTEXT_ARM64 | 0x00000002)
+#define CONTEXT_FLOATING_POINT  (CONTEXT_ARM64 | 0x00000004)
+#define CONTEXT_DEBUG_REGISTERS (CONTEXT_ARM64 | 0x00000008)
+
+#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER)
+
+#define EXCEPTION_READ_FAULT    0
+#define EXCEPTION_WRITE_FAULT   1
+#define EXCEPTION_EXECUTE_FAULT 8
+
+typedef struct _CONTEXT {
+    ULONG ContextFlags;
+
+    /* This section is specified/returned if the ContextFlags word contains
+       the flag CONTEXT_INTEGER. */
+    ULONGLONG X0;
+    ULONGLONG X1;
+    ULONGLONG X2;
+    ULONGLONG X3;
+    ULONGLONG X4;
+    ULONGLONG X5;
+    ULONGLONG X6;
+    ULONGLONG X7;
+    ULONGLONG X8;
+    ULONGLONG X9;
+    ULONGLONG X10;
+    ULONGLONG X11;
+    ULONGLONG X12;
+    ULONGLONG X13;
+    ULONGLONG X14;
+    ULONGLONG X15;
+    ULONGLONG X16;
+    ULONGLONG X17;
+    ULONGLONG X18;
+    ULONGLONG X19;
+    ULONGLONG X20;
+    ULONGLONG X21;
+    ULONGLONG X22;
+    ULONGLONG X23;
+    ULONGLONG X24;
+    ULONGLONG X25;
+    ULONGLONG X26;
+    ULONGLONG X27;
+    ULONGLONG X28;
+    ULONGLONG X29;
+    ULONGLONG X30;
+
+    /* These are selected by CONTEXT_CONTROL */
+    ULONGLONG Sp;
+    ULONGLONG Pc;
+    ULONGLONG PState;
+
+    /* These are selected by CONTEXT_FLOATING_POINT */
+    /* FIXME */
+} CONTEXT;
+
+#endif /* __aarch64__ */
+
 
 /* Mips context definitions */
 #if defined(_MIPS_) || defined(__MIPS__) || defined(__mips__)
@@ -2449,6 +2518,7 @@
 
 /* Wine extension */
 #define	IMAGE_FILE_MACHINE_SPARC	0x2000
+#define	IMAGE_FILE_MACHINE_ARM64	0x01c5
 
 #define	IMAGE_SIZEOF_FILE_HEADER		20
 #define IMAGE_SIZEOF_ROM_OPTIONAL_HEADER	56
diff --git a/mingw-w64-tools/widl/src/parser.tab.c b/mingw-w64-tools/widl/src/parser.tab.c
index 34691d6..2f69130 100644
--- a/mingw-w64-tools/widl/src/parser.tab.c
+++ b/mingw-w64-tools/widl/src/parser.tab.c
@@ -6609,7 +6609,7 @@
     /* ATTR_HELPSTRINGCONTEXT */   { 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, "helpstringcontext" },
     /* ATTR_HELPSTRINGDLL */       { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, "helpstringdll" },
     /* ATTR_HIDDEN */              { 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, "hidden" },
-    /* ATTR_ID */                  { 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, "id" },
+    /* ATTR_ID */                  { 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, "id" },
     /* ATTR_IDEMPOTENT */          { 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "idempotent" },
     /* ATTR_IGNORE */              { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, "ignore" },
     /* ATTR_IIDIS */               { 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, "iid_is" },
diff --git a/mingw-w64-tools/widl/src/parser.y b/mingw-w64-tools/widl/src/parser.y
index 9c2281f..d8435b9 100644
--- a/mingw-w64-tools/widl/src/parser.y
+++ b/mingw-w64-tools/widl/src/parser.y
@@ -2057,7 +2057,7 @@
     /* ATTR_HELPSTRINGCONTEXT */   { 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 1, 1, 1, 1, "helpstringcontext" },
     /* ATTR_HELPSTRINGDLL */       { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, "helpstringdll" },
     /* ATTR_HIDDEN */              { 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, "hidden" },
-    /* ATTR_ID */                  { 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, "id" },
+    /* ATTR_ID */                  { 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, "id" },
     /* ATTR_IDEMPOTENT */          { 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "idempotent" },
     /* ATTR_IGNORE */              { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, "ignore" },
     /* ATTR_IIDIS */               { 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, "iid_is" },
diff --git a/mingw-w64-tools/widl/src/parser.yy.c b/mingw-w64-tools/widl/src/parser.yy.c
index 1b7041f..9f5be6c 100644
--- a/mingw-w64-tools/widl/src/parser.yy.c
+++ b/mingw-w64-tools/widl/src/parser.yy.c
@@ -28,7 +28,7 @@
 #define FLEX_SCANNER
 #define YY_FLEX_MAJOR_VERSION 2
 #define YY_FLEX_MINOR_VERSION 5
-#define YY_FLEX_SUBMINOR_VERSION 35
+#define YY_FLEX_SUBMINOR_VERSION 37
 #if YY_FLEX_SUBMINOR_VERSION > 0
 #define FLEX_BETA
 #endif
@@ -161,15 +161,7 @@
 
 /* Size of default input buffer. */
 #ifndef YY_BUF_SIZE
-#ifdef __ia64__
-/* On IA-64, the buffer size is 16k, not 8k.
- * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
- * Ditto for the __ia64__ case accordingly.
- */
-#define YY_BUF_SIZE 32768
-#else
 #define YY_BUF_SIZE 16384
-#endif /* __ia64__ */
 #endif
 
 /* The state buf must be large enough to hold one state per character in the main buffer.
@@ -181,7 +173,12 @@
 typedef struct yy_buffer_state *YY_BUFFER_STATE;
 #endif
 
-extern int parser_leng;
+#ifndef YY_TYPEDEF_YY_SIZE_T
+#define YY_TYPEDEF_YY_SIZE_T
+typedef size_t yy_size_t;
+#endif
+
+extern yy_size_t parser_leng;
 
 extern FILE *parser_in, *parser_out;
 
@@ -207,11 +204,6 @@
 
 #define unput(c) yyunput( c, (yytext_ptr)  )
 
-#ifndef YY_TYPEDEF_YY_SIZE_T
-#define YY_TYPEDEF_YY_SIZE_T
-typedef size_t yy_size_t;
-#endif
-
 #ifndef YY_STRUCT_YY_BUFFER_STATE
 #define YY_STRUCT_YY_BUFFER_STATE
 struct yy_buffer_state
@@ -229,7 +221,7 @@
 	/* Number of characters read into yy_ch_buf, not including EOB
 	 * characters.
 	 */
-	int yy_n_chars;
+	yy_size_t yy_n_chars;
 
 	/* Whether we "own" the buffer - i.e., we know we created it,
 	 * and can realloc() it to grow it, and should free() it to
@@ -299,8 +291,8 @@
 
 /* yy_hold_char holds the character lost when parser_text is formed. */
 static char yy_hold_char;
-static int yy_n_chars;		/* number of characters read into yy_ch_buf */
-int parser_leng;
+static yy_size_t yy_n_chars;		/* number of characters read into yy_ch_buf */
+yy_size_t parser_leng;
 
 /* Points to current character in buffer. */
 static char *yy_c_buf_p = (char *) 0;
@@ -328,7 +320,7 @@
 
 YY_BUFFER_STATE parser__scan_buffer (char *base,yy_size_t size  );
 YY_BUFFER_STATE parser__scan_string (yyconst char *yy_str  );
-YY_BUFFER_STATE parser__scan_bytes (yyconst char *bytes,int len  );
+YY_BUFFER_STATE parser__scan_bytes (yyconst char *bytes,yy_size_t len  );
 
 void *parser_alloc (yy_size_t  );
 void *parser_realloc (void *,yy_size_t  );
@@ -750,7 +742,7 @@
  * The flexer starts here
  **************************************************************************
  */
-#line 754 "parser.yy.c"
+#line 746 "parser.yy.c"
 
 #define INITIAL 0
 #define QUOTE 1
@@ -794,7 +786,7 @@
 
 void parser_set_out  (FILE * out_str  );
 
-int parser_get_leng (void );
+yy_size_t parser_get_leng (void );
 
 char *parser_get_text (void );
 
@@ -842,12 +834,7 @@
     
 /* Amount of stuff to slurp up with each read. */
 #ifndef YY_READ_BUF_SIZE
-#ifdef __ia64__
-/* On IA-64, the buffer size is 16k, not 8k */
-#define YY_READ_BUF_SIZE 16384
-#else
 #define YY_READ_BUF_SIZE 8192
-#endif /* __ia64__ */
 #endif
 
 /* Copy whatever the last rule matched to the standard output. */
@@ -953,7 +940,7 @@
     
 #line 127 "parser.l"
 
-#line 957 "parser.yy.c"
+#line 944 "parser.yy.c"
 
 	if ( !(yy_init) )
 		{
@@ -1268,7 +1255,7 @@
 #line 209 "parser.l"
 ECHO;
 	YY_BREAK
-#line 1272 "parser.yy.c"
+#line 1259 "parser.yy.c"
 
 	case YY_END_OF_BUFFER:
 		{
@@ -1453,21 +1440,21 @@
 
 	else
 		{
-			int num_to_read =
+			yy_size_t num_to_read =
 			YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
 
 		while ( num_to_read <= 0 )
 			{ /* Not enough room in the buffer - grow it. */
 
 			/* just a shorter name for the current buffer */
-			YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
+			YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
 
 			int yy_c_buf_p_offset =
 				(int) ((yy_c_buf_p) - b->yy_ch_buf);
 
 			if ( b->yy_is_our_buffer )
 				{
-				int new_size = b->yy_buf_size * 2;
+				yy_size_t new_size = b->yy_buf_size * 2;
 
 				if ( new_size <= 0 )
 					b->yy_buf_size += b->yy_buf_size / 8;
@@ -1498,7 +1485,7 @@
 
 		/* Read in more data. */
 		YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
-			(yy_n_chars), (size_t) num_to_read );
+			(yy_n_chars), num_to_read );
 
 		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
 		}
@@ -1594,7 +1581,7 @@
 	yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
 	yy_is_jam = (yy_current_state == 147);
 
-	return yy_is_jam ? 0 : yy_current_state;
+		return yy_is_jam ? 0 : yy_current_state;
 }
 
 #ifndef YY_NO_INPUT
@@ -1621,7 +1608,7 @@
 
 		else
 			{ /* need more input */
-			int offset = (yy_c_buf_p) - (yytext_ptr);
+			yy_size_t offset = (yy_c_buf_p) - (yytext_ptr);
 			++(yy_c_buf_p);
 
 			switch ( yy_get_next_buffer(  ) )
@@ -1895,7 +1882,7 @@
  */
 static void parser_ensure_buffer_stack (void)
 {
-	int num_to_alloc;
+	yy_size_t num_to_alloc;
     
 	if (!(yy_buffer_stack)) {
 
@@ -1992,7 +1979,7 @@
  * 
  * @return the newly allocated buffer state object.
  */
-YY_BUFFER_STATE parser__scan_bytes  (yyconst char * yybytes, int  _yybytes_len )
+YY_BUFFER_STATE parser__scan_bytes  (yyconst char * yybytes, yy_size_t  _yybytes_len )
 {
 	YY_BUFFER_STATE b;
 	char *buf;
@@ -2111,7 +2098,7 @@
 /** Get the length of the current token.
  * 
  */
-int parser_get_leng  (void)
+yy_size_t parser_get_leng  (void)
 {
         return parser_leng;
 }
diff --git a/mingw-w64-tools/widl/src/port/getopt.c b/mingw-w64-tools/widl/src/port/getopt.c
index e38d137..fb1e315 100644
--- a/mingw-w64-tools/widl/src/port/getopt.c
+++ b/mingw-w64-tools/widl/src/port/getopt.c
@@ -203,22 +203,8 @@
 /* Value of POSIXLY_CORRECT environment variable.  */
 static char *posixly_correct;
 
-#ifdef	__GNU_LIBRARY__
-/* We want to avoid inclusion of string.h with non-GNU libraries
-   because there are many ways it can cause trouble.
-   On some systems, it contains special magic macros that don't work
-   in GCC.  */
-# include <string.h>
-# define my_index	strchr
-#else
-
-# ifdef HAVE_STRING_H
-#  include <string.h>
-# else
-#  include <strings.h>
-# endif
-
-# define my_index strchr
+#include <string.h>
+#define my_index strchr
 
 /* If using GCC, we can safely declare strlen this way.
    If not using GCC, it is ok not to declare it.  */
@@ -232,8 +218,6 @@
 # endif /* not __STDC__ */
 #endif /* __GNUC__ */
 
-#endif /* not __GNU_LIBRARY__ */
-
 /* Handle permutation of arguments.  */
 
 /* Describe the part of ARGV that contains non-options that have
diff --git a/mingw-w64-tools/widl/src/widl.c b/mingw-w64-tools/widl/src/widl.c
index 1718247..5626d13 100644
--- a/mingw-w64-tools/widl/src/widl.c
+++ b/mingw-w64-tools/widl/src/widl.c
@@ -266,7 +266,8 @@
         { "sparc",   SYS_WIN32 },
         { "alpha",   SYS_WIN32 },
         { "powerpc", SYS_WIN32 },
-        { "arm",     SYS_WIN32 }
+        { "arm",     SYS_WIN32 },
+        { "aarch64", SYS_WIN64 }
     };
 
     unsigned int i;
diff --git a/mingw-w64-tools/widl/src/wpp/ppl.yy.c b/mingw-w64-tools/widl/src/wpp/ppl.yy.c
index 50f00af..f81ce8a 100644
--- a/mingw-w64-tools/widl/src/wpp/ppl.yy.c
+++ b/mingw-w64-tools/widl/src/wpp/ppl.yy.c
@@ -33,7 +33,7 @@
 #define FLEX_SCANNER
 #define YY_FLEX_MAJOR_VERSION 2
 #define YY_FLEX_MINOR_VERSION 5
-#define YY_FLEX_SUBMINOR_VERSION 35
+#define YY_FLEX_SUBMINOR_VERSION 37
 #if YY_FLEX_SUBMINOR_VERSION > 0
 #define FLEX_BETA
 #endif
@@ -166,15 +166,7 @@
 
 /* Size of default input buffer. */
 #ifndef YY_BUF_SIZE
-#ifdef __ia64__
-/* On IA-64, the buffer size is 16k, not 8k.
- * Moreover, YY_BUF_SIZE is 2*YY_READ_BUF_SIZE in the general case.
- * Ditto for the __ia64__ case accordingly.
- */
-#define YY_BUF_SIZE 32768
-#else
 #define YY_BUF_SIZE 16384
-#endif /* __ia64__ */
 #endif
 
 /* The state buf must be large enough to hold one state per character in the main buffer.
@@ -186,7 +178,12 @@
 typedef struct yy_buffer_state *YY_BUFFER_STATE;
 #endif
 
-extern int ppy_leng;
+#ifndef YY_TYPEDEF_YY_SIZE_T
+#define YY_TYPEDEF_YY_SIZE_T
+typedef size_t yy_size_t;
+#endif
+
+extern yy_size_t ppy_leng;
 
 extern FILE *ppy_in, *ppy_out;
 
@@ -212,11 +209,6 @@
 
 #define unput(c) yyunput( c, (yytext_ptr)  )
 
-#ifndef YY_TYPEDEF_YY_SIZE_T
-#define YY_TYPEDEF_YY_SIZE_T
-typedef size_t yy_size_t;
-#endif
-
 #ifndef YY_STRUCT_YY_BUFFER_STATE
 #define YY_STRUCT_YY_BUFFER_STATE
 struct yy_buffer_state
@@ -234,7 +226,7 @@
 	/* Number of characters read into yy_ch_buf, not including EOB
 	 * characters.
 	 */
-	int yy_n_chars;
+	yy_size_t yy_n_chars;
 
 	/* Whether we "own" the buffer - i.e., we know we created it,
 	 * and can realloc() it to grow it, and should free() it to
@@ -304,8 +296,8 @@
 
 /* yy_hold_char holds the character lost when ppy_text is formed. */
 static char yy_hold_char;
-static int yy_n_chars;		/* number of characters read into yy_ch_buf */
-int ppy_leng;
+static yy_size_t yy_n_chars;		/* number of characters read into yy_ch_buf */
+yy_size_t ppy_leng;
 
 /* Points to current character in buffer. */
 static char *yy_c_buf_p = (char *) 0;
@@ -333,7 +325,7 @@
 
 YY_BUFFER_STATE ppy__scan_buffer (char *base,yy_size_t size  );
 YY_BUFFER_STATE ppy__scan_string (yyconst char *yy_str  );
-YY_BUFFER_STATE ppy__scan_bytes (yyconst char *bytes,int len  );
+YY_BUFFER_STATE ppy__scan_bytes (yyconst char *bytes,yy_size_t len  );
 
 void *ppy_alloc (yy_size_t  );
 void *ppy_realloc (void *,yy_size_t  );
@@ -1398,7 +1390,7 @@
  * The scanner starts here
  **************************************************************************
  */
-#line 1402 "ppl.yy.c"
+#line 1394 "ppl.yy.c"
 
 #define INITIAL 0
 #define pp_pp 1
@@ -1458,7 +1450,7 @@
 
 void ppy_set_out  (FILE * out_str  );
 
-int ppy_get_leng (void );
+yy_size_t ppy_get_leng (void );
 
 char *ppy_get_text (void );
 
@@ -1508,12 +1500,7 @@
     
 /* Amount of stuff to slurp up with each read. */
 #ifndef YY_READ_BUF_SIZE
-#ifdef __ia64__
-/* On IA-64, the buffer size is 16k, not 8k */
-#define YY_READ_BUF_SIZE 16384
-#else
 #define YY_READ_BUF_SIZE 8192
-#endif /* __ia64__ */
 #endif
 
 /* Copy whatever the last rule matched to the standard output. */
@@ -1631,7 +1618,7 @@
 	/*
 	 * Detect the leading # of a preprocessor directive.
 	 */
-#line 1635 "ppl.yy.c"
+#line 1622 "ppl.yy.c"
 
 	if ( !(yy_init) )
 		{
@@ -2735,7 +2722,7 @@
 #line 792 "ppl.l"
 ECHO;
 	YY_BREAK
-#line 2739 "ppl.yy.c"
+#line 2726 "ppl.yy.c"
 
 	case YY_END_OF_BUFFER:
 		{
@@ -2920,21 +2907,21 @@
 
 	else
 		{
-			int num_to_read =
+			yy_size_t num_to_read =
 			YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
 
 		while ( num_to_read <= 0 )
 			{ /* Not enough room in the buffer - grow it. */
 
 			/* just a shorter name for the current buffer */
-			YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
+			YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
 
 			int yy_c_buf_p_offset =
 				(int) ((yy_c_buf_p) - b->yy_ch_buf);
 
 			if ( b->yy_is_our_buffer )
 				{
-				int new_size = b->yy_buf_size * 2;
+				yy_size_t new_size = b->yy_buf_size * 2;
 
 				if ( new_size <= 0 )
 					b->yy_buf_size += b->yy_buf_size / 8;
@@ -2965,7 +2952,7 @@
 
 		/* Read in more data. */
 		YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
-			(yy_n_chars), (size_t) num_to_read );
+			(yy_n_chars), num_to_read );
 
 		YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
 		}
@@ -3061,7 +3048,7 @@
 	yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
 	yy_is_jam = (yy_current_state == 415);
 
-	return yy_is_jam ? 0 : yy_current_state;
+		return yy_is_jam ? 0 : yy_current_state;
 }
 
 #ifndef YY_NO_INPUT
@@ -3088,7 +3075,7 @@
 
 		else
 			{ /* need more input */
-			int offset = (yy_c_buf_p) - (yytext_ptr);
+			yy_size_t offset = (yy_c_buf_p) - (yytext_ptr);
 			++(yy_c_buf_p);
 
 			switch ( yy_get_next_buffer(  ) )
@@ -3362,7 +3349,7 @@
  */
 static void ppy_ensure_buffer_stack (void)
 {
-	int num_to_alloc;
+	yy_size_t num_to_alloc;
     
 	if (!(yy_buffer_stack)) {
 
@@ -3459,7 +3446,7 @@
  * 
  * @return the newly allocated buffer state object.
  */
-YY_BUFFER_STATE ppy__scan_bytes  (yyconst char * yybytes, int  _yybytes_len )
+YY_BUFFER_STATE ppy__scan_bytes  (yyconst char * yybytes, yy_size_t  _yybytes_len )
 {
 	YY_BUFFER_STATE b;
 	char *buf;
@@ -3583,7 +3570,7 @@
 /** Get the length of the current token.
  * 
  */
-int ppy_get_leng  (void)
+yy_size_t ppy_get_leng  (void)
 {
         return ppy_leng;
 }
diff --git a/mingw-w64-tools/widl/src/write_msft.c b/mingw-w64-tools/widl/src/write_msft.c
index 918923b..53e1feb 100644
--- a/mingw-w64-tools/widl/src/write_msft.c
+++ b/mingw-w64-tools/widl/src/write_msft.c
@@ -2547,7 +2547,12 @@
 
     if (strendswith( typelib_name, ".res" ))  /* create a binary resource file */
     {
-        add_output_to_resources( "TYPELIB", "#1" );
+        char typelib_id[13] = "#1";
+
+        expr_t *expr = get_attrp( typelib->typelib->attrs, ATTR_ID );
+        if (expr)
+            sprintf( typelib_id, "#%d", expr->cval );
+        add_output_to_resources( "TYPELIB", typelib_id );
         output_typelib_regscript( typelib->typelib );
         flush_output_resources( typelib_name );
     }