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
This commit is contained in:
Zack Weinberg 2004-09-24 21:39:06 +00:00 committed by Zack Weinberg
parent dd3017e4e5
commit 018a478506
8 changed files with 306 additions and 13 deletions

View File

@ -1,3 +1,7 @@
2004-09-24 Zack Weinberg <zack@codesourcery.com>
* warnings.m4: New file.
2004-09-23 H.J. Lu <hongjiu.lu@intel.com>
PR bootstrap/17369

97
config/warnings.m4 Normal file
View File

@ -0,0 +1,97 @@
# Autoconf include file defining macros related to compile-time warnings.
# Copyright 2004 Free Software Foundation, Inc.
#This file is part of GCC.
#GCC 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, or (at your option) any later
#version.
#GCC 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 GCC; see the file COPYING. If not, write to the Free
#Software Foundation, 59 Temple Place - Suite 330, Boston, MA
#02111-1307, USA.
# ACX_PROG_CC_WARNING_OPTS([-Wfoo -Wbar -Wbaz])
# Sets @WARN_CFLAGS@ to the subset of the given options which the
# compiler accepts.
AC_DEFUN([ACX_PROG_CC_WARNING_OPTS],
[AC_REQUIRE([AC_PROG_CC])dnl
AC_SUBST([WARN_CFLAGS])dnl
WARN_CFLAGS=
save_CFLAGS="$CFLAGS"
for option in $1; do
AS_VAR_PUSHDEF([acx_Woption], [acx_cv_prog_cc_warning_$option])
AC_CACHE_CHECK([whether $CC supports $option], acx_Woption,
[CFLAGS="$option"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
[AS_VAR_SET(acx_Woption, yes)],
[AS_VAR_SET(acx_Woption, no)])
])
AS_IF([test AS_VAR_GET(acx_Woption) = yes],
[WARN_CFLAGS="$WARN_CFLAGS${WARN_CFLAGS:+ }$option"])
AS_VAR_POPDEF([acx_Woption])dnl
done
CFLAGS="$save_CFLAGS"
])# ACX_PROG_CC_WARNING_OPTS
# ACX_PROG_CC_WARNING_ALMOST_PEDANTIC([-Wno-long-long ...])
# Sets WARN_PEDANTIC to "-pedantic" + the argument, if the compiler
# accepts all of those options simultaneously, otherwise to nothing.
AC_DEFUN([ACX_PROG_CC_WARNING_ALMOST_PEDANTIC],
[AC_REQUIRE([AC_PROG_CC])dnl
AC_SUBST([WARN_PEDANTIC])dnl
AS_VAR_PUSHDEF([acx_Pedantic], [acx_cv_prog_cc_pedantic_$1])dnl
WARN_PEDANTIC=
AC_CACHE_CHECK([whether $CC supports -pedantic $1], acx_Pedantic,
[save_CFLAGS="$CFLAGS"
CFLAGS="-pedantic $1"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([],[])],
[AS_VAR_SET(acx_Pedantic, yes)],
[AS_VAR_SET(acx_Pedantic, no)])
CFLAGS="$save_CFLAGS"])
AS_IF([test AS_VAR_GET(acx_Pedantic) = yes],
[WARN_PEDANTIC="-pedantic $1"])
AS_VAR_POPDEF([acx_Pedantic])dnl
])# ACX_PROG_CC_WARNING_ALMOST_PEDANTIC
# ACX_PROG_CC_WARNINGS_ARE_ERRORS([x.y.z])
# sets WERROR to "-Werror" if the compiler is GCC >=x.y.z, or if
# --enable-werror-always was given on the command line, otherwise
# to nothing.
# If the argument is the word "manual" instead of a version number,
# then WERROR will be set to -Werror only if --enable-werror-always
# appeared on the configure command line.
AC_DEFUN([ACX_PROG_CC_WARNINGS_ARE_ERRORS],
[AC_REQUIRE([AC_PROG_CC])dnl
AC_SUBST([WERROR])dnl
WERROR=
AC_ARG_ENABLE(werror-always,
AS_HELP_STRING([--enable-werror-always],
[enable -Werror despite compiler version]),
[], [enable_werror_always=no])
AS_IF([test $enable_werror_always = yes],
[WERROR=-Werror],
m4_if($1, [manual],,
[AS_VAR_PUSHDEF([acx_GCCvers], [acx_cv_prog_cc_gcc_$1_or_newer])dnl
AC_CACHE_CHECK([whether $CC is GCC >=$1], acx_GCCvers,
[set fnord `echo $1 | tr '.' ' '`
shift
AC_PREPROC_IFELSE(
[#if __GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__ \
< [$]1 * 10000 + [$]2 * 100 + [$]3
#error insufficient
#endif],
[AS_VAR_SET(acx_GCCvers, yes)],
[AS_VAR_SET(acx_GCCvers, no)])])
AS_IF([test AS_VAR_GET(acx_GCCvers) = yes],
[WERROR=-WerrorB])
AS_VAR_POPDEF([acx_GCCvers])]))
])# ACX_PROG_CC_WARNINGS_ARE_ERRORS

View File

@ -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.

View File

@ -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)

1
libcpp/aclocal.m4 vendored
View File

@ -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])

162
libcpp/configure vendored
View File

@ -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

View File

@ -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

View File

@ -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 *);