From 4f6e011e2eececfe5fb2c467da542615f26439bc Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 11 Oct 2005 05:06:16 +0000 Subject: [PATCH] Work around portability problems with Visual Age C compiler (xlc and xlC_r) reported by John P. Hartmann. * data/location.cc (initial_column, initial_line): Remove. All uses replaced by 0 and 1. * src/scan-gram.l (gram_wrap): Redefine to avoid bug in flex 2.5.31 that xlc complains about. * src/scan-skel.l (skel_wrap): Likewise. --- ChangeLog | 10 ++++++++++ data/location.cc | 16 +++++----------- src/scan-gram.l | 5 +++++ src/scan-skel.l | 5 +++++ 4 files changed, 25 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index f1b332cb..2cef5302 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2005-10-10 Paul Eggert + + Work around portability problems with Visual Age C compiler + (xlc and xlC_r) reported by John P. Hartmann. + * data/location.cc (initial_column, initial_line): Remove. + All uses replaced by 0 and 1. + * src/scan-gram.l (gram_wrap): Redefine to avoid bug in flex 2.5.31 + that xlc complains about. + * src/scan-skel.l (skel_wrap): Likewise. + 2005-10-10 Akim Demaille * examples/calc++/test: Be quiet unless VERBOSE. diff --git a/data/location.cc b/data/location.cc index 2226adca..bb701b3e 100644 --- a/data/location.cc +++ b/data/location.cc @@ -43,20 +43,14 @@ namespace yy /// Abstract a position. class position { - public: - /// Initial column number. - static const unsigned int initial_column = 0; - /// Initial line number. - static const unsigned int initial_line = 1; - /** \name Ctor & dtor. ** \{ */ public: /// Construct a position. position () : filename (0), - line (initial_line), - column (initial_column) + line (1), + column (0) { } /** \} */ @@ -68,19 +62,19 @@ namespace yy /// (line related) Advance to the COUNT next lines. inline void lines (int count = 1) { - column = initial_column; + column = 0; line += count; } /// (column related) Advance to the COUNT next columns. inline void columns (int count = 1) { - int leftmost = initial_column; + int leftmost = 0; int current = column; if (leftmost <= current + count) column += count; else - column = initial_column; + column = 0; } /** \} */ diff --git a/src/scan-gram.l b/src/scan-gram.l index 1b44f513..70d56ee9 100644 --- a/src/scan-gram.l +++ b/src/scan-gram.l @@ -24,6 +24,11 @@ %option prefix="gram_" outfile="lex.yy.c" %{ +/* Work around a bug in flex 2.5.31. See Debian bug 333231 + . */ +#undef gram_wrap +#define gram_wrap() 1 + #include "system.h" #include diff --git a/src/scan-skel.l b/src/scan-skel.l index 4f34a6c6..06370fa6 100644 --- a/src/scan-skel.l +++ b/src/scan-skel.l @@ -23,6 +23,11 @@ %option prefix="skel_" outfile="lex.yy.c" %{ +/* Work around a bug in flex 2.5.31. See Debian bug 333231 + . */ +#undef skel_wrap +#define skel_wrap() 1 + #include "system.h" #include -- 2.45.2