aboutsummaryrefslogtreecommitdiff
path: root/libcpp
diff options
context:
space:
mode:
authorZack Weinberg <zack@codesourcery.com>2004-09-24 21:39:06 +0000
committerZack Weinberg <zack@gcc.gnu.org>2004-09-24 21:39:06 +0000
commit018a4785065ba0b5164d5aae330613e42c5653ac (patch)
tree1e2296a88dcd34dc7b721373b3b5ad6c97217196 /libcpp
parentdd3017e4e5c8d9d102fb11330cba5fe87e0eda65 (diff)
downloadgcc-018a4785065ba0b5164d5aae330613e42c5653ac.zip
gcc-018a4785065ba0b5164d5aae330613e42c5653ac.tar.gz
gcc-018a4785065ba0b5164d5aae330613e42c5653ac.tar.bz2
warnings.m4: New file.
config: * warnings.m4: New file. libcpp: * configure.ac: Move AC_PROG_MAKE_SET, AC_PROG_INSTALL to programs cluster. Use ACX_PROG_CC_WARNING_OPTS, ACX_PROG_CC_WARNING_ALMOST_PEDANTIC, ACX_PROG_CC_WARNINGS_ARE_ERRORS. * aclocal.m4, configure: Regenerate. * init.c: Include localedir.h. * Makefile.in (WARN_CFLAGS, ALL_CFLAGS): New variables. (DEFS): Delete. (.c.o): Use $(ALL_CFLAGS). (localedir.h, localedir.hs): New rules. (clean): Use rm -rf to remove directories. (distclean): Also delete localedir.h and localedir.hs. (init.o): Update dependencies. From-SVN: r88074
Diffstat (limited to 'libcpp')
-rw-r--r--libcpp/ChangeLog15
-rw-r--r--libcpp/Makefile.in24
-rw-r--r--libcpp/aclocal.m41
-rwxr-xr-xlibcpp/configure162
-rw-r--r--libcpp/configure.ac15
-rw-r--r--libcpp/init.c1
6 files changed, 205 insertions, 13 deletions
diff --git a/libcpp/ChangeLog b/libcpp/ChangeLog
index 9203c5b..839b559 100644
--- a/libcpp/ChangeLog
+++ b/libcpp/ChangeLog
@@ -1,3 +1,18 @@
+2004-09-24 Zack Weinberg <zack@codesourcery.com>
+
+ * configure.ac: Move AC_PROG_MAKE_SET, AC_PROG_INSTALL to
+ programs cluster. Use ACX_PROG_CC_WARNING_OPTS,
+ ACX_PROG_CC_WARNING_ALMOST_PEDANTIC, ACX_PROG_CC_WARNINGS_ARE_ERRORS.
+ * aclocal.m4, configure: Regenerate.
+ * init.c: Include localedir.h.
+ * Makefile.in (WARN_CFLAGS, ALL_CFLAGS): New variables.
+ (DEFS): Delete.
+ (.c.o): Use $(ALL_CFLAGS).
+ (localedir.h, localedir.hs): New rules.
+ (clean): Use rm -rf to remove directories.
+ (distclean): Also delete localedir.h and localedir.hs.
+ (init.o): Update dependencies.
+
2004-09-22 Kelley Cook <kcook@gcc.gnu.org>
* Makefile.in (aclocal.m4): Update dependencies.
diff --git a/libcpp/Makefile.in b/libcpp/Makefile.in
index 9158d67..9c89a25 100644
--- a/libcpp/Makefile.in
+++ b/libcpp/Makefile.in
@@ -34,6 +34,7 @@ AUTOHEADER = @AUTOHEADER@
CATALOGS = @CATALOGS@
CC = @CC@
CFLAGS = @CFLAGS@
+WARN_CFLAGS = @WARN_CFLAGS@ @WARN_PEDANTIC@ @WERROR@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
EXEEXT = @EXEEXT@
@@ -59,10 +60,11 @@ prefix = @prefix@
MSGMERGE = msgmerge
mkinstalldirs = $(SHELL) $(srcdir)/../mkinstalldirs
-DEFS = -DLOCALEDIR="\"$(localedir)\""
INCLUDES = -I$(srcdir) -I. -I$(srcdir)/../include @INCINTL@ \
-I$(srcdir)/include
+ALL_CFLAGS = $(CFLAGS) $(WARN_CFLAGS) $(INCLUDES) $(CPPFLAGS)
+
libcpp_a_OBJS = charset.o directives.o errors.o expr.o files.o \
identifiers.o init.o lex.o line-map.o macro.o mkdeps.o \
pch.o symtab.o traditional.o
@@ -116,7 +118,15 @@ stamp-h1: $(srcdir)/config.in config.status
$(srcdir)/config.in: @MAINT@ $(srcdir)/configure
cd $(srcdir) && $(AUTOHEADER)
-rm -f stamp-h1
-
+
+# It is not possible to get LOCALEDIR defined in config.h because
+# the value it needs to be defined to is only determined in the
+# Makefile. Hence we do this instead.
+localedir.h: localedir.hs; @true
+localedir.hs: Makefile
+ echo "#define LOCALEDIR \"$(localedir)\"" > localedir.new
+ $(srcdir)/../move-if-change localedir.new localedir.h
+ echo timestamp > localedir.hs
# Installation rules and other phony targets
@@ -150,11 +160,12 @@ mostlyclean:
-rm -f *.o
clean: mostlyclean
- -rm -f makedepend$(EXEEXT) libcpp.a $(srcdir)/autom4te.cache
+ -rm -rf makedepend$(EXEEXT) libcpp.a $(srcdir)/autom4te.cache
distclean: clean
-rm -f config.h stamp-h1 config.status config.cache config.log \
- configure.lineno configure.status.lineno Makefile
+ configure.lineno configure.status.lineno Makefile localedir.h \
+ localedir.hs
maintainer-clean: distclean
@echo "This command is intended for maintainers to use"
@@ -178,7 +189,7 @@ update-po: $(CATALOGS:.gmo=.pox)
# Implicit rules and I18N
.c.o:
- $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) -c $<
+ $(CC) $(DEFS) $(INCLUDES) $(CPPFLAGS) $(ALL_CFLAGS) -c $<
# N.B. We do not attempt to copy these into $(srcdir).
.po.gmo:
@@ -230,9 +241,8 @@ expr.o: $(srcdir)/expr.c $(COMMON_DEPS)
files.o: $(srcdir)/files.c $(COMMON_DEPS) $(libcpp_incdir)/mkdeps.h \
$(top_incdir)/hashtab.h $(top_incdir)/md5.h
-
identifiers.o: $(srcdir)/identifiers.c $(COMMON_DEPS)
-init.o: $(srcdir)/init.c $(COMMON_DEPS) $(libcpp_incdir)/mkdeps.h
+init.o: $(srcdir)/init.c $(COMMON_DEPS) $(libcpp_incdir)/mkdeps.h localedir.h
lex.o: $(srcdir)/lex.c $(COMMON_DEPS)
line-map.o: $(srcdir)/line-map.c $(COMMON_DEPS)
macro.o: $(srcdir)/macro.c $(COMMON_DEPS)
diff --git a/libcpp/aclocal.m4 b/libcpp/aclocal.m4
index 50eb82f..3640760 100644
--- a/libcpp/aclocal.m4
+++ b/libcpp/aclocal.m4
@@ -18,3 +18,4 @@ m4_include([../config/iconv.m4])
m4_include([../config/lib-ld.m4])
m4_include([../config/lib-link.m4])
m4_include([../config/lib-prefix.m4])
+m4_include([../config/warnings.m4])
diff --git a/libcpp/configure b/libcpp/configure
index c23f2f9..7a1bc91 100755
--- a/libcpp/configure
+++ b/libcpp/configure
@@ -311,7 +311,7 @@ ac_includes_default="\
# include <unistd.h>
#endif"
-ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os SET_MAKE INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT RANLIB ac_ct_RANLIB ACLOCAL AUTOCONF AUTOHEADER CPP EGREP LIBOBJS ALLOCA USE_NLS LIBINTL LIBINTL_DEP INCINTL XGETTEXT GMSGFMT POSUB CATALOGS LIBICONV LTLIBICONV PACKAGE USED_CATALOGS MAINT LTLIBOBJS'
+ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os target target_cpu target_vendor target_os SET_MAKE INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT RANLIB ac_ct_RANLIB ACLOCAL AUTOCONF AUTOHEADER WARN_CFLAGS WARN_PEDANTIC WERROR CPP EGREP LIBOBJS ALLOCA USE_NLS LIBINTL LIBINTL_DEP INCINTL XGETTEXT GMSGFMT POSUB CATALOGS LIBICONV LTLIBICONV PACKAGE USED_CATALOGS MAINT LTLIBOBJS'
ac_subst_files=''
# Initialize some variables set by options.
@@ -849,6 +849,7 @@ if test -n "$ac_init_help"; then
Optional Features:
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --enable-werror-always enable -Werror despite compiler version
--disable-rpath do not hardcode runtime library paths
--enable-maintainer-mode enable rules only needed by maintainers
--enable-checking enable expensive run-time checks
@@ -1437,6 +1438,8 @@ test -n "$target_alias" &&
test "$program_prefix$program_suffix$program_transform_name" = \
NONENONEs,x,x, &&
program_prefix=${target_alias}-
+
+# Checks for programs.
echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6
set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,:./+-,___p_,'`
@@ -1545,8 +1548,6 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
-
-# Checks for programs.
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -2683,8 +2684,158 @@ done
test -n "$AUTOHEADER" || AUTOHEADER="$MISSING autoheader"
-# Checks for header files.
+# Figure out what compiler warnings we can enable.
+# See config/warnings.m4 for details.
+
+
+WARN_CFLAGS=
+save_CFLAGS="$CFLAGS"
+for option in -W -Wall -Wwrite-strings -Wstrict-prototypes \
+ -Wmissing-prototypes -Wold-style-definition; do
+ as_acx_Woption=`echo "acx_cv_prog_cc_warning_$option" | $as_tr_sh`
+
+ echo "$as_me:$LINENO: checking whether $CC supports $option" >&5
+echo $ECHO_N "checking whether $CC supports $option... $ECHO_C" >&6
+if eval "test \"\${$as_acx_Woption+set}\" = set"; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ CFLAGS="$option"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ eval "$as_acx_Woption=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+eval "$as_acx_Woption=no"
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+echo "$as_me:$LINENO: result: `eval echo '${'$as_acx_Woption'}'`" >&5
+echo "${ECHO_T}`eval echo '${'$as_acx_Woption'}'`" >&6
+ if test `eval echo '${'$as_acx_Woption'}'` = yes; then
+ WARN_CFLAGS="$WARN_CFLAGS${WARN_CFLAGS:+ }$option"
+fi
+
+ done
+CFLAGS="$save_CFLAGS"
+WARN_PEDANTIC=
+echo "$as_me:$LINENO: checking whether $CC supports -pedantic -Wno-long-long" >&5
+echo $ECHO_N "checking whether $CC supports -pedantic -Wno-long-long... $ECHO_C" >&6
+if test "${acx_cv_prog_cc_pedantic__Wno_long_long+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ save_CFLAGS="$CFLAGS"
+CFLAGS="-pedantic -Wno-long-long"
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } &&
+ { ac_try='test -z "$ac_c_werror_flag"
+ || test ! -s conftest.err'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } &&
+ { ac_try='test -s conftest.$ac_objext'
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+ (eval $ac_try) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ acx_cv_prog_cc_pedantic__Wno_long_long=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+acx_cv_prog_cc_pedantic__Wno_long_long=no
+fi
+rm -f conftest.err conftest.$ac_objext conftest.$ac_ext
+CFLAGS="$save_CFLAGS"
+fi
+echo "$as_me:$LINENO: result: $acx_cv_prog_cc_pedantic__Wno_long_long" >&5
+echo "${ECHO_T}$acx_cv_prog_cc_pedantic__Wno_long_long" >&6
+if test $acx_cv_prog_cc_pedantic__Wno_long_long = yes; then
+ WARN_PEDANTIC="-pedantic -Wno-long-long"
+fi
+
+
+
+# Only enable with --enable-werror-always until existing warnings are
+# corrected.
+WERROR=
+# Check whether --enable-werror-always or --disable-werror-always was given.
+if test "${enable_werror_always+set}" = set; then
+ enableval="$enable_werror_always"
+
+else
+ enable_werror_always=no
+fi;
+if test $enable_werror_always = yes; then
+ WERROR=-Werror
+fi
+
+
+
+# Checks for header files.
echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5
echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6
if test "${ac_cv_header_time+set}" = set; then
@@ -7564,6 +7715,9 @@ s,@ac_ct_RANLIB@,$ac_ct_RANLIB,;t t
s,@ACLOCAL@,$ACLOCAL,;t t
s,@AUTOCONF@,$AUTOCONF,;t t
s,@AUTOHEADER@,$AUTOHEADER,;t t
+s,@WARN_CFLAGS@,$WARN_CFLAGS,;t t
+s,@WARN_PEDANTIC@,$WARN_PEDANTIC,;t t
+s,@WERROR@,$WERROR,;t t
s,@CPP@,$CPP,;t t
s,@EGREP@,$EGREP,;t t
s,@LIBOBJS@,$LIBOBJS,;t t
diff --git a/libcpp/configure.ac b/libcpp/configure.ac
index 60d00392..0bcf171 100644
--- a/libcpp/configure.ac
+++ b/libcpp/configure.ac
@@ -6,10 +6,10 @@ AC_INIT(cpplib, [ ], gcc-bugs@gcc.gnu.org, cpplib)
AC_CONFIG_SRCDIR(ucnid.h)
AC_CONFIG_MACRO_DIR(../config)
AC_CANONICAL_SYSTEM
-AC_PROG_MAKE_SET
-AC_PROG_INSTALL
# Checks for programs.
+AC_PROG_MAKE_SET
+AC_PROG_INSTALL
AC_PROG_CC
AC_PROG_RANLIB
@@ -18,6 +18,17 @@ AC_CHECK_PROGS([ACLOCAL], [aclocal], [$MISSING aclocal])
AC_CHECK_PROGS([AUTOCONF], [autoconf], [$MISSING autoconf])
AC_CHECK_PROGS([AUTOHEADER], [autoheader], [$MISSING autoheader])
+# Figure out what compiler warnings we can enable.
+# See config/warnings.m4 for details.
+
+ACX_PROG_CC_WARNING_OPTS([-W -Wall -Wwrite-strings -Wstrict-prototypes \
+ -Wmissing-prototypes -Wold-style-definition])
+ACX_PROG_CC_WARNING_ALMOST_PEDANTIC([-Wno-long-long])
+
+# Only enable with --enable-werror-always until existing warnings are
+# corrected.
+ACX_PROG_CC_WARNINGS_ARE_ERRORS([manual])
+
# Checks for header files.
AC_HEADER_TIME
ACX_HEADER_STRING
diff --git a/libcpp/init.c b/libcpp/init.c
index aaf1d6b..b2be19a 100644
--- a/libcpp/init.c
+++ b/libcpp/init.c
@@ -24,6 +24,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include "cpplib.h"
#include "internal.h"
#include "mkdeps.h"
+#include "localedir.h"
static void init_library (void);
static void mark_named_operators (cpp_reader *);