[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] [cygwin|mingw] Fix compile warnings when -std=c89.
From: |
Charles Wilson |
Subject: |
Re: [PATCH] [cygwin|mingw] Fix compile warnings when -std=c89. |
Date: |
Wed, 21 Jan 2009 22:14:51 -0500 |
User-agent: |
Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.19) Gecko/20081209 Thunderbird/2.0.0.19 Mnenhy/0.7.5.666 |
Ralf Wildenhues wrote:
> I don't see a need to skip the test elsewhere. Here's what I'd do:
> transform $LIBTOOL to have CFLAGS and LTCFLAGS also contain -std=c89
> -Werror. (The test would be even cleaner with a re-configured libtool,
> but let's not go overboard here.)
Being a total novice with autotest, I couldn't figure out how to do the
former, so I did the latter. Attached is my first attempt. It probably
should be named something other than 'c89 test' because that name
implies building all of libtool (including libltdl) with -std=c89. But I
couldn't think of anything else to call it.
If you'd like to knock it into better shape, I wouldn't mind...
--
Chuck
diff --git a/Makefile.am b/Makefile.am
index 7000090..726b898 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -467,6 +467,7 @@ TESTSUITE_AT = tests/testsuite.at \
tests/indirect_deps.at \
tests/archive-in-archive.at \
tests/execute-mode.at \
+ tests/c89.at \
tests/infer-tag.at \
tests/localization.at \
tests/install.at \
--- a/tests/c89.at 2006-11-30 19:00:00.000000000 -0500
+++ b/tests/c89.at 2009-01-21 21:32:01.792100000 -0500
@@ -0,0 +1,85 @@
+# c89.at -- test compliance with c89 standard -*- Autotest -*-
+
+# Copyright (C) 2009 Free Software Foundation, Inc.
+# Written by Charles Wilson, 2009
+#
+# This file is part of GNU Libtool.
+#
+# GNU Libtool is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# GNU Libtool is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Libtool; see the file COPYING. If not, a copy
+# can be downloaded from http://www.gnu.org/licenses/gpl.html,
+# or obtained by writing to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+####
+
+AT_SETUP([c89 test])
+AT_KEYWORDS([libtool])
+
+# make sure existing libtool is configured for shared libraries
+AT_CHECK([$LIBTOOL --features | grep 'disable shared libraries' && (exit 77)],
+ [1], [ignore])
+
+# make sure CFLAGS -std=c89 -Werror do not cause a failure
+# themselves (e.g. because a non-gcc compiler doesn't support
+# those flags).
+AT_DATA([trivial.c],
+[[
+int main (void)
+{
+ return 0;
+}
+]])
+AT_CHECK([$LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -std=c89 -Werror -c
trivial.c || exit 77],[0],[ignore],[ignore])
+
+AT_DATA([configure.ac],
+[[AC_INIT([app-uses-sharedlib-demo], ]AT_PACKAGE_VERSION[,
]AT_PACKAGE_BUGREPORT[)
+AC_CONFIG_AUX_DIR([config])
+AC_CONFIG_MACRO_DIR([m4])
+AM_INIT_AUTOMAKE([foreign])
+LT_INIT([win32-dll disable-static])
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
+]])
+AT_DATA([Makefile.am],
+[[ACLOCAL_AMFLAGS = -I m4
+AUTOMAKE_OPTIONS = 1.7
+lib_LTLIBRARIES = liba.la
+liba_la_LDFLAGS = -version-info 0:0:0 -no-undefined
+liba_la_SOURCES = liba.c
+bin_PROGRAMS = usea
+usea_SOURCES = usea.c
+usea_LDADD = liba.la
+]])
+AT_DATA([liba.c],
+[[int liba_func1 (int arg)
+{
+ return arg + 1;
+}
+]])
+AT_DATA([usea.c],
+[[extern int liba_func1(int arg);
+int main (void)
+{
+ int a = 2;
+ int b = liba_func1 (a);
+ if (b == 3) return 0;
+ return 1;
+}
+]])
+
+LT_AT_BOOTSTRAP([--copy --force], [-I m4 --force], [ignore],
+ [--add-missing --copy --force-missing], [--force], [CFLAGS='-std=c89
-Werror'], [])
+AT_CHECK([test -f liba.la])
+LT_AT_EXEC_CHECK([./usea], [0], [ignore], [ignore], [])
+
+AT_CLEANUP
- Re: [PATCH] [cygwin|mingw] Fix compile warnings when -std=c89., (continued)
- Re: [PATCH] [cygwin|mingw] Fix compile warnings when -std=c89., Charles Wilson, 2009/01/21
- Re: [PATCH] [cygwin|mingw] Fix compile warnings when -std=c89., Ralf Wildenhues, 2009/01/21
- Re: [PATCH] [cygwin|mingw] Fix compile warnings when -std=c89., Charles Wilson, 2009/01/21
- Re: [PATCH] [cygwin|mingw] Fix compile warnings when -std=c89., Ralf Wildenhues, 2009/01/21
- Re: [PATCH] [cygwin|mingw] Fix compile warnings when -std=c89., Charles Wilson, 2009/01/21
- testsuite performance (was: [PATCH] [cygwin|mingw] Fix compile warnings when -std=c89.), Ralf Wildenhues, 2009/01/22
- Re: testsuite performance, Charles Wilson, 2009/01/22
- Re: testsuite performance, Roumen Petrov, 2009/01/23
- Re: [PATCH] [cygwin|mingw] Fix compile warnings when -std=c89., Charles Wilson, 2009/01/21
- Re: [PATCH] [cygwin|mingw] Fix compile warnings when -std=c89., Ralf Wildenhues, 2009/01/21
- Re: [PATCH] [cygwin|mingw] Fix compile warnings when -std=c89.,
Charles Wilson <=
- Re: [PATCH] [cygwin|mingw] Fix compile warnings when -std=c89., Ralf Wildenhues, 2009/01/22
- Re: [PATCH] [cygwin|mingw] Fix compile warnings when -std=c89., Charles Wilson, 2009/01/22
- Re: [PATCH] [cygwin|mingw] Fix compile warnings when -std=c89., Charles Wilson, 2009/01/22