From 490d8a6e4f17f8cf77f246cad1c1555285afc669 Mon Sep 17 00:00:00 2001 From: Ralf Wildenhues Date: Thu, 14 Dec 2006 20:59:26 +0000 Subject: [PATCH] * tests/link-order2.at: Define our override `sin' function with C binding even if $CC is a C++ compiler. Skip the test with g++ as its command line driver reorders `-lm'. * tests/search-path.at: Declare `inflate' with C binding. * tests/stresstest.at: Avoid unused variable warnings. --- ChangeLog | 8 ++++++++ tests/link-order2.at | 18 +++++++++++++++++- tests/search-path.at | 6 +++++- tests/stresstest.at | 4 ++-- 4 files changed, 32 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0d33fe1ff..545a51d27 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2006-12-14 Ralf Wildenhues + + * tests/link-order2.at: Define our override `sin' function with + C binding even if $CC is a C++ compiler. Skip the test with g++ + as its command line driver reorders `-lm'. + * tests/search-path.at: Declare `inflate' with C binding. + * tests/stresstest.at: Avoid unused variable warnings. + 2006-11-07 Ralf Wildenhues * tests/link-order2.at: Simplify logic to be a bit more self diff --git a/tests/link-order2.at b/tests/link-order2.at index ac54edb4b..ec2acf5f3 100644 --- a/tests/link-order2.at +++ b/tests/link-order2.at @@ -24,6 +24,16 @@ AT_SETUP([Link order of deplibs.]) AT_KEYWORDS([libtool]) + +# g++ reorders `-lm' on the command line. :-( +AT_DATA([t.c], [[ +#if defined(__cplusplus) && defined(__GNUC__) +choke me +#endif +int t = 42; +]]) +AT_CHECK([$CC $CPPFLAGS $CFLAGS -c t.c || exit 77], [], [ignore], [ignore]) + LDFLAGS="$LDFLAGS -no-undefined" libdir=`pwd`/inst/lib bindir=`pwd`/inst/bin @@ -31,11 +41,17 @@ mkdir inst inst/bin inst/lib cat >a.c <<\EOF /* pretend we have a better sine function */ +#ifdef __cplusplus +extern "C" +#endif double sin (double x) { return 0.0; } EOF cat >b.c <<\EOF -extern double sin (double); +#ifdef __cplusplus +extern "C" +#endif +double sin (double); double b (double x) { return sin (x); } EOF diff --git a/tests/search-path.at b/tests/search-path.at index ab0eca04e..f45ec0b99 100644 --- a/tests/search-path.at +++ b/tests/search-path.at @@ -21,7 +21,11 @@ AT_KEYWORDS([libtool]) LDFLAGS="$LDFLAGS -no-undefined" AT_DATA([main.c], -[[extern int inflate (); +[[extern +#ifdef __cplusplus +"C" +#endif +int inflate (); int main() { return inflate (); diff --git a/tests/stresstest.at b/tests/stresstest.at index 4f7abaf65..19a1cb902 100644 --- a/tests/stresstest.at +++ b/tests/stresstest.at @@ -45,7 +45,7 @@ const int v5 = 0; const int v6 = 1; const char* v7 = "\01foo"; const char v8[] = "\01bar"; -int v9(void) { return 1; } +int v9(void) { return v2 + 1; } int (*v10) (void); int (*v11) (void) = v9; int (*const v12) (void) = v9; @@ -165,7 +165,7 @@ const int w5 = 0; const int w6 = 1; const char* w7 = "\01foo"; const char w8[] = "\01bar"; -int w9(void) { return 1; } +int w9(void) { return w2 + 1; } int (*w10) (void); int (*w11) (void) = w9; int (*const w12) (void) = w9; -- 2.47.3