On Solaris 10, linking of lex-generated programs was failing in a couple of lex tests with errors like this: g++ -g -O2 -o joe joe.o -ll Undefined symbol first referenced in file yywrap() joe.o ld: fatal: Symbol referencing errors. No output written to joe collect2: ld returned 1 exit status This change fixes it, also fixing at once potential problems for systems that don't have a "lex library" (this happens for example when cross-compiling from GNU/Linux to MinGW).
* tests/lex-depend-cxx.test (joe.ll, moe.l++): Define a dummy `yywrap()' function. * tests/lex-clean-cxx.test (mainfoo.cc, mainbar.cpp, mainbaz.c++, mainqux.cxx): Likewise. --- ChangeLog | 18 ++++++++++++++++++ tests/lex-clean-cxx.test | 4 ++++ tests/lex-depend-cxx.test | 4 ++++ 3 files changed, 26 insertions(+), 0 deletions(-) diff --git a/ChangeLog b/ChangeLog index 611126d..0553c95 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,21 @@ +2011-06-28 Stefano Lattarini <stefano.lattar...@gmail.com> + + lex tests: fix spurious link errors on Solaris + On Solaris 10, linking of lex-generated programs was failing in a + couple of lex tests with errors like this: + g++ -g -O2 -o joe joe.o -ll + Undefined symbol first referenced in file + yywrap() joe.o + ld: fatal: Symbol referencing errors. No output written to joe + collect2: ld returned 1 exit status + This change fixes it, also fixing at once potential problems for + systems that don't have a "lex library" (this happens for example + when cross-compiling from GNU/Linux to MinGW). + * tests/lex-depend-cxx.test (joe.ll, moe.l++): Define a dummy + `yywrap()' function. + * tests/lex-clean-cxx.test (mainfoo.cc, mainbar.cpp, mainbaz.c++, + mainqux.cxx): Likewise. + 2011-06-23 Stefano Lattarini <stefano.lattar...@gmail.com> docs: avoid a footnote, some related rewordings and improvements diff --git a/tests/lex-clean-cxx.test b/tests/lex-clean-cxx.test index 3400977..3f566c4 100755 --- a/tests/lex-clean-cxx.test +++ b/tests/lex-clean-cxx.test @@ -64,6 +64,10 @@ cp parsefoo.lxx parsebar.ll cat > mainfoo.cc << 'END' // This file should contain valid C++ but invalid C. using namespace std; +int yywrap (void) +{ + return 1; +} int main (int argc, char **argv) { extern int yylex (void); diff --git a/tests/lex-depend-cxx.test b/tests/lex-depend-cxx.test index 860a96f..9b5416d 100755 --- a/tests/lex-depend-cxx.test +++ b/tests/lex-depend-cxx.test @@ -53,6 +53,10 @@ cat > joe.ll << 'END' . %% #include "my-hdr.hxx" +int yywrap (void) +{ + return 1; +} int main (int argc, char **argv) { printf("Hello, World!\n"); -- 1.7.2.3