On Thursday 16 December 2010, Ralf Wildenhues wrote: > > --- /dev/null > > +++ b/tests/canon7.test > > @@ -0,0 +1,93 @@ > > > +# Stress test on canonicalization. > [...] > > +cat > Makefile.am << 'END' > > +noinst_PROGRAMS = dummy_static dummy_dynamic ,foo-bar > > +noinst_LIBRARIES = libb.az+baz.a > > +noinst_LTLIBRARIES = lib~zardoz,,.la > > + > > +dummy_static_SOURCES = dummy.c lib.h > > +dummy_dynamic_SOURCES = $(dummy_static_SOURCES) > > + > > +dummy_static_LDADD = $(noinst_LIBRARIES) > > +dummy_dynamic_LDADD = $(noinst_LTLIBRARIES) > > + > > +_foo_bar_SOURCES = libs.c > > +libb_az_baz_a_SOURCES = libs.c > > +lib_zardoz___la_SOURCES = libd.c > > + > > +check-local: > > + ls -l > > + ./,foo-bar > > + ./dummy_static > > + ./dummy_dynamic > > + ./,foo-bar | grep 'Hello, FooBar!' > > + ./dummy_static | grep 'Hello from Static!' > > + ./dummy_dynamic | grep 'Hello from Dynamic!' > > +END > > + > > +cat > foobar.c << 'END' > > +#include <stdio.h> > > +int main(void) > > +{ > > + printf("Hello, FooBar!\n"); > > + return 0; > > +} > > +END > > + > > +cat > dummy.c << 'END' > > +#include <stdio.h> > > +#include "lib.h" > > +int main(void) > > +{ > > + printf("Hello from %s!\n", dummy_func()); > > + return 0; > > +} > > +END > > + > > +echo 'char *dummy_func(void);' > lib.h > > +echo 'char *dummy_func(void) { return "Dynamic"; }' > libd.c > > +echo 'char *dummy_func(void) { return "Static"; }' > libs.c > > I'm not sure how you tested this, but ',foo-bar' fails to link for me on > GNU/Linux (and supposedly everywhere else, lacking a 'main' symbol). > Yes, and I cant' understand how I could have missed that. I mean, I clearly remember running the tests after the squashed-in amendaments... (asking to self) What kind of blunder did I do?
Anyway, sorry for the noise and thanks for fixing this. Just a nit below (inlined in your patch) ... > Also, the code passes pointers to read-only memory (literal strings) in > non-const pointers (literal strings may not be modifiable). > Sorry again. My C-fu is not very strong :-( > I'm pushing the fix below. > > Note that you're lucky using convenience archives here. With shared > libraries, the const data would need special handling in order to work > on w32. (See the Libtool documentation, git version, for details.) > > Thanks, > Ralf > > Fix canon7.test failure. > > * tests/canon7.test (_foo_bar_SOURCES): Add foobar.c. > (lib.h, libd.c, libs.c): Use const for constant strings. > > diff --git a/tests/canon7.test b/tests/canon7.test > index 9b3d8d0..3f25d6f 100755 > --- a/tests/canon7.test > +++ b/tests/canon7.test > @@ -43,7 +43,7 @@ dummy_dynamic_SOURCES = $(dummy_static_SOURCES) > dummy_static_LDADD = $(noinst_LIBRARIES) > dummy_dynamic_LDADD = $(noinst_LTLIBRARIES) > > -_foo_bar_SOURCES = libs.c > +_foo_bar_SOURCES = libs.c foobar.c > "_foo_bar_SOURCES = foobar.c" should suffice here. > libb_az_baz_a_SOURCES = libs.c > lib_zardoz___la_SOURCES = libd.c > > @@ -76,9 +76,9 @@ int main(void) > } > END > > -echo 'char *dummy_func(void);' > lib.h > -echo 'char *dummy_func(void) { return "Dynamic"; }' > libd.c > -echo 'char *dummy_func(void) { return "Static"; }' > libs.c > +echo 'const char *dummy_func(void);' > lib.h > +echo 'const char *dummy_func(void) { return "Dynamic"; }' > libd.c > +echo 'const char *dummy_func(void) { return "Static"; }' > libs.c > > libtoolize > $ACLOCAL > Thanks, Stefano