Index: BOOK/introduction/common/changelog.xml
===================================================================
--- BOOK/introduction/common/changelog.xml (revision 3f5a2661fdd2a5710cb25ab7423406def37956a0)
+++ BOOK/introduction/common/changelog.xml (revision 96139fafe3eec3a173c5d4b68366d6241dc650d8)
@@ -36,4 +36,14 @@
-->
+
+
+ August 12, 2009
+
+
+ [jim] - Added patch to Flex to ensure proper GCC 4.4.x
+ code generation.
+
+
+
Index: patches/flex-2.5.35-gcc44-1.patch
===================================================================
--- patches/flex-2.5.35-gcc44-1.patch (revision 96139fafe3eec3a173c5d4b68366d6241dc650d8)
+++ patches/flex-2.5.35-gcc44-1.patch (revision 96139fafe3eec3a173c5d4b68366d6241dc650d8)
@@ -0,0 +1,403 @@
+Submitted By: Jim Gifford (jim at cross-lfs dot org)
+Date: 2009-08-12
+Initial Package Version: 2.5.35
+Origin: Debian
+Upstream Status: Unknown
+Description: Corrects code generation for GCC 4.4.x
+
+diff -Naur flex-2.5.35.orig/flexint.h flex-2.5.35/flexint.h
+--- flex-2.5.35.orig/flexint.h 2006-03-20 18:17:56.000000000 -0800
++++ flex-2.5.35/flexint.h 2009-08-12 18:25:23.000000000 -0700
+@@ -28,7 +28,6 @@
+ typedef unsigned char flex_uint8_t;
+ typedef unsigned short int flex_uint16_t;
+ typedef unsigned int flex_uint32_t;
+-#endif /* ! C99 */
+
+ /* Limits of integral types. */
+ #ifndef INT8_MIN
+@@ -59,5 +58,6 @@
+ #define UINT32_MAX (4294967295U)
+ #endif
+
++#endif /* ! C99 */
+
+ #endif /* ! FLEXINT_H */
+diff -Naur flex-2.5.35.orig/flex.skl flex-2.5.35/flex.skl
+--- flex-2.5.35.orig/flex.skl 2008-02-09 10:54:56.000000000 -0800
++++ flex-2.5.35/flex.skl 2009-08-12 18:25:23.000000000 -0700
+@@ -218,6 +218,7 @@
+ #include
+ #include
+ #include
++#include
+ #include
+ /* end standard C++ headers. */
+ %endif
+@@ -443,7 +444,15 @@
+
+ /* 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
+
+ m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
+@@ -1063,7 +1072,12 @@
+
+ /* 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
+
+ m4_ifdef( [[M4_YY_NOT_IN_HEADER]],
+@@ -1074,7 +1088,7 @@
+ /* This used to be an fputs(), but since the string might contain NUL's,
+ * we now use fwrite().
+ */
+-#define ECHO fwrite( yytext, yyleng, 1, yyout )
++#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
+ %endif
+ %if-c++-only C++ definition
+ #define ECHO LexerOutput( yytext, yyleng )
+@@ -2348,8 +2362,8 @@
+ %if-c-only
+ /** Setup the input buffer state to scan the given bytes. The next call to yylex() will
+ * scan from a @e copy of @a bytes.
+- * @param bytes the byte buffer to scan
+- * @param len the number of bytes in the buffer pointed to by @a bytes.
++ * @param yybytes the byte buffer to scan
++ * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
+ * M4_YY_DOC_PARAM
+ * @return the newly allocated buffer state object.
+ */
+diff -Naur flex-2.5.35.orig/gen.c flex-2.5.35/gen.c
+--- flex-2.5.35.orig/gen.c 2007-05-30 23:21:57.000000000 -0700
++++ flex-2.5.35/gen.c 2009-08-12 18:25:23.000000000 -0700
+@@ -1890,7 +1890,7 @@
+ outn ("\tif ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \\");
+ outn ("\t\t{ \\");
+ outn ("\t\tint c = '*'; \\");
+- outn ("\t\tint n; \\");
++ outn ("\t\tsize_t n; \\");
+ outn ("\t\tfor ( n = 0; n < max_size && \\");
+ outn ("\t\t\t (c = getc( yyin )) != EOF && c != '\\n'; ++n ) \\");
+ outn ("\t\t\tbuf[n] = (char) c; \\");
+diff -Naur flex-2.5.35.orig/scan.c flex-2.5.35/scan.c
+--- flex-2.5.35.orig/scan.c 2008-02-26 13:34:23.000000000 -0800
++++ flex-2.5.35/scan.c 2009-08-12 18:41:52.000000000 -0700
+@@ -1,5 +1,6 @@
++#line 2 "scan.c"
+
+-#line 3 "scan.c"
++#line 4 "scan.c"
+
+ #define YY_INT_ALIGNED short int
+
+@@ -53,7 +54,6 @@
+ typedef unsigned char flex_uint8_t;
+ typedef unsigned short int flex_uint16_t;
+ typedef unsigned int flex_uint32_t;
+-#endif /* ! C99 */
+
+ /* Limits of integral types. */
+ #ifndef INT8_MIN
+@@ -84,6 +84,8 @@
+ #define UINT32_MAX (4294967295U)
+ #endif
+
++#endif /* ! C99 */
++
+ #endif /* ! FLEXINT_H */
+
+ #ifdef __cplusplus
+@@ -140,7 +142,15 @@
+
+ /* 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.
+@@ -2085,7 +2095,12 @@
+
+ /* 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. */
+@@ -2093,7 +2108,7 @@
+ /* This used to be an fputs(), but since the string might contain NUL's,
+ * we now use fwrite().
+ */
+-#define ECHO fwrite( yytext, yyleng, 1, yyout )
++#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
+ #endif
+
+ /* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
+@@ -2104,7 +2119,7 @@
+ if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
+ { \
+ int c = '*'; \
+- int n; \
++ size_t n; \
+ for ( n = 0; n < max_size && \
+ (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
+ buf[n] = (char) c; \
+@@ -4639,9 +4654,19 @@
+ yyfree((void *) b );
+ }
+
+-#ifndef __cplusplus
++#ifndef _UNISTD_H /* assume unistd.h has isatty() for us */
++#ifdef __cplusplus
++extern "C" {
++#endif
++#ifdef __THROW /* this is a gnuism */
++extern int isatty (int ) __THROW;
++#else
+ extern int isatty (int );
+-#endif /* __cplusplus */
++#endif
++#ifdef __cplusplus
++}
++#endif
++#endif
+
+ /* Initializes or reinitializes a buffer.
+ * This function is sometimes called more than once on the same buffer,
+@@ -4847,8 +4872,8 @@
+
+ /** Setup the input buffer state to scan the given bytes. The next call to yylex() will
+ * scan from a @e copy of @a bytes.
+- * @param bytes the byte buffer to scan
+- * @param len the number of bytes in the buffer pointed to by @a bytes.
++ * @param yybytes the byte buffer to scan
++ * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
+ *
+ * @return the newly allocated buffer state object.
+ */
+diff -Naur flex-2.5.35.orig/skel.c flex-2.5.35/skel.c
+--- flex-2.5.35.orig/skel.c 2008-02-26 13:34:19.000000000 -0800
++++ flex-2.5.35/skel.c 2009-08-12 18:41:52.000000000 -0700
+@@ -244,7 +244,6 @@
+ "typedef unsigned char flex_uint8_t; ",
+ "typedef unsigned short int flex_uint16_t;",
+ "typedef unsigned int flex_uint32_t;",
+- "#endif /* ! C99 */",
+ "",
+ "/* Limits of integral types. */",
+ "#ifndef INT8_MIN",
+@@ -275,6 +274,7 @@
+ "#define UINT32_MAX (4294967295U)",
+ "#endif",
+ "",
++ "#endif /* ! C99 */",
+ "",
+ "#endif /* ! FLEXINT_H */",
+ "",
+@@ -285,6 +285,7 @@
+ "#include ",
+ "#include ",
+ "#include ",
++ "#include ",
+ "#include ",
+ "/* end standard C++ headers. */",
+ "%endif",
+@@ -510,7 +511,15 @@
+ "",
+ "/* 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",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+@@ -1130,7 +1139,12 @@
+ "",
+ "/* 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",
+ "",
+ "m4_ifdef( [[M4_YY_NOT_IN_HEADER]],",
+@@ -1141,7 +1155,7 @@
+ "/* This used to be an fputs(), but since the string might contain NUL's,",
+ " * we now use fwrite().",
+ " */",
+- "#define ECHO fwrite( yytext, yyleng, 1, yyout )",
++ "#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)",
+ "%endif",
+ "%if-c++-only C++ definition",
+ "#define ECHO LexerOutput( yytext, yyleng )",
+@@ -2266,9 +2280,19 @@
+ "[[",
+ " m4_ifdef( [[M4_YY_NEVER_INTERACTIVE]],,",
+ " [[",
+- "#ifndef __cplusplus",
++ "#ifndef _UNISTD_H /* assume unistd.h has isatty() for us */",
++ "#ifdef __cplusplus",
++ "extern \"C\" {",
++ "#endif",
++ "#ifdef __THROW /* this is a gnuism */",
++ "extern int isatty M4_YY_PARAMS( int ) __THROW;",
++ "#else",
+ "extern int isatty M4_YY_PARAMS( int );",
+- "#endif /* __cplusplus */",
++ "#endif",
++ "#ifdef __cplusplus",
++ "}",
++ "#endif",
++ "#endif",
+ " ]])",
+ "]])",
+ "%endif",
+@@ -2559,8 +2583,8 @@
+ "%if-c-only",
+ "/** Setup the input buffer state to scan the given bytes. The next call to yylex() will",
+ " * scan from a @e copy of @a bytes.",
+- " * @param bytes the byte buffer to scan",
+- " * @param len the number of bytes in the buffer pointed to by @a bytes.",
++ " * @param yybytes the byte buffer to scan",
++ " * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.",
+ " * M4_YY_DOC_PARAM",
+ " * @return the newly allocated buffer state object.",
+ " */",
+diff -Naur flex-2.5.35.orig/tests/test-bison-nr/Makefile.am flex-2.5.35/tests/test-bison-nr/Makefile.am
+--- flex-2.5.35.orig/tests/test-bison-nr/Makefile.am 2006-11-09 12:14:46.000000000 -0800
++++ flex-2.5.35/tests/test-bison-nr/Makefile.am 2009-08-12 18:25:23.000000000 -0700
+@@ -34,7 +34,7 @@
+
+ testname = test-bison-nr
+
+-scanner.c: $(srcdir)/scanner.l
++scanner.c scanner.h: $(srcdir)/scanner.l
+ $(FLEX) $<
+
+ parser.c: $(srcdir)/parser.y
+@@ -50,4 +50,5 @@
+ $(CC) -c -o $@ $(AM_CPPFLAGS) $(CPPFLAGS) $(CFLAGS) $<
+
+ parser.h: parser.c
+-scanner.c main.o: parser.h
++scanner.o: parser.h
++main.o: parser.h scanner.h
+diff -Naur flex-2.5.35.orig/tests/test-bison-nr/Makefile.in flex-2.5.35/tests/test-bison-nr/Makefile.in
+--- flex-2.5.35.orig/tests/test-bison-nr/Makefile.in 2008-02-26 13:34:05.000000000 -0800
++++ flex-2.5.35/tests/test-bison-nr/Makefile.in 2009-08-12 18:36:31.000000000 -0700
+@@ -343,7 +343,7 @@
+ uninstall-info-am
+
+
+-scanner.c: $(srcdir)/scanner.l
++scanner.c scanner.h: $(srcdir)/scanner.l
+ $(FLEX) $<
+
+ parser.c: $(srcdir)/parser.y
+@@ -359,7 +359,8 @@
+ $(CC) -c -o $@ $(AM_CPPFLAGS) $(CPPFLAGS) $(CFLAGS) $<
+
+ parser.h: parser.c
+-scanner.c main.o: parser.h
++scanner.o: parser.h
++main.o: parser.h scanner.h
+ # Tell versions [3.59,3.63) of GNU make to not export all variables.
+ # Otherwise a system limit (for SysV at least) may be exceeded.
+ .NOEXPORT:
+diff -Naur flex-2.5.35.orig/tests/test-bison-yylloc/Makefile.am flex-2.5.35/tests/test-bison-yylloc/Makefile.am
+--- flex-2.5.35.orig/tests/test-bison-yylloc/Makefile.am 2006-11-09 12:14:46.000000000 -0800
++++ flex-2.5.35/tests/test-bison-yylloc/Makefile.am 2009-08-12 18:25:23.000000000 -0700
+@@ -34,7 +34,7 @@
+
+ testname = test-bison-yylloc
+
+-scanner.c: $(srcdir)/scanner.l
++scanner.c scanner.h: $(srcdir)/scanner.l
+ $(FLEX) $<
+
+ parser.c: $(srcdir)/parser.y
+@@ -50,4 +50,5 @@
+ $(CC) -c -o $@ $(AM_CPPFLAGS) $(CPPFLAGS) $(CFLAGS) $<
+
+ parser.h: parser.c
+-scanner.c main.o: parser.h
++scanner.o: parser.h
++main.o: parser.h scanner.h
+diff -Naur flex-2.5.35.orig/tests/test-bison-yylloc/Makefile.in flex-2.5.35/tests/test-bison-yylloc/Makefile.in
+--- flex-2.5.35.orig/tests/test-bison-yylloc/Makefile.in 2008-02-26 13:34:06.000000000 -0800
++++ flex-2.5.35/tests/test-bison-yylloc/Makefile.in 2009-08-12 18:32:20.000000000 -0700
+@@ -343,7 +343,7 @@
+ uninstall-info-am
+
+
+-scanner.c: $(srcdir)/scanner.l
++scanner.c scanner.h: $(srcdir)/scanner.l
+ $(FLEX) $<
+
+ parser.c: $(srcdir)/parser.y
+@@ -359,7 +359,8 @@
+ $(CC) -c -o $@ $(AM_CPPFLAGS) $(CPPFLAGS) $(CFLAGS) $<
+
+ parser.h: parser.c
+-scanner.c main.o: parser.h
++scanner.o: parser.h
++main.o: parser.h scanner.h
+ # Tell versions [3.59,3.63) of GNU make to not export all variables.
+ # Otherwise a system limit (for SysV at least) may be exceeded.
+ .NOEXPORT:
+diff -Naur flex-2.5.35.orig/tests/test-bison-yylval/Makefile.am flex-2.5.35/tests/test-bison-yylval/Makefile.am
+--- flex-2.5.35.orig/tests/test-bison-yylval/Makefile.am 2006-11-09 12:14:46.000000000 -0800
++++ flex-2.5.35/tests/test-bison-yylval/Makefile.am 2009-08-12 18:25:23.000000000 -0700
+@@ -34,7 +34,7 @@
+
+ testname = test-bison-yylval
+
+-scanner.c: $(srcdir)/scanner.l
++scanner.c scanner.h: $(srcdir)/scanner.l
+ $(FLEX) $<
+
+ parser.c: $(srcdir)/parser.y
+@@ -50,4 +50,4 @@
+ $(CC) -c -o $@ $(AM_CPPFLAGS) $(CPPFLAGS) $(CFLAGS) $<
+
+ parser.h: parser.c
+-main.o: parser.h
++main.o: parser.h scanner.h