diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2008-12-14 23:28:53 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2008-12-14 23:28:53 +0200 |
commit | 47b7a2ab5e6da5582f2a85486dc72ced34c45e18 (patch) | |
tree | 1abede73e8d669d78aa5fd2f215607f2abeb0d89 | |
parent | 2099cf51128f3851fd230f0e5948ef514bb3141c (diff) | |
download | radius-47b7a2ab5e6da5582f2a85486dc72ced34c45e18.tar.gz radius-47b7a2ab5e6da5582f2a85486dc72ced34c45e18.tar.bz2 |
Fix compilation with gcc >= 4.3.0.
* configure.ac, radiusd/Makefile.am: Explicitly disable aliasing if using gcc
* radiusd/rewrite.y: Bugfix: make fmain static.
-rw-r--r-- | configure.ac | 36 | ||||
-rw-r--r-- | radiusd/Makefile.am | 1 | ||||
-rw-r--r-- | radiusd/rewrite.y | 4 |
3 files changed, 39 insertions, 2 deletions
diff --git a/configure.ac b/configure.ac index 44c6540c..1dc5dd1d 100644 --- a/configure.ac +++ b/configure.ac @@ -280,6 +280,42 @@ AC_FUNC_MMAP gl_INIT +# Radius uses code that conflicts with gcc understanding of C aliasing: +# +# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38527 +# +# In particular, when compiling radiusd/rewrite.y gcc >= 4.3.0 generates +# code containing explicit dead loops. According to gcc folks, such code +# generation is correct. I can hardly agree with that. And not only me. +# Quoting Linus Torvalds: +# The gcc people are more interested in trying to find out what can be +# allowed by the c99 specs than about making things actually _work_. The +# aliasing code in particular is not even worth enabling, it's just not +# possible to sanely tell gcc when some things can alias. +# (see http://lkml.org/lkml/2003/2/26/158, for details) +# +# (The code below is borrowed from Python's configure.in) +AC_SUBST(OPTFLAGS) +case $GCC in +yes) + AC_MSG_CHECKING(whether $CC accepts -fno-strict-aliasing) + ac_save_cc="$CC" + CC="$CC -fno-strict-aliasing" + AC_TRY_RUN([int main() { return 0; }], + ac_cv_no_strict_aliasing_ok=yes, + ac_cv_no_strict_aliasing_ok=no, + ac_cv_no_strict_aliasing_ok=no) + CC="$ac_save_cc" + AC_MSG_RESULT($ac_cv_no_strict_aliasing_ok) + if test $ac_cv_no_strict_aliasing_ok = yes + then + OPTFLAGS="$OPTFLAGS -fno-strict-aliasing" + fi + ;; +*) # FIXME + ;; +esac + ## * Check for national language support AM_GNU_GETTEXT([external], [need-ngettext]) AM_GNU_GETTEXT_VERSION(0.15) diff --git a/radiusd/Makefile.am b/radiusd/Makefile.am index 8167694b..b9e1ebda 100644 --- a/radiusd/Makefile.am +++ b/radiusd/Makefile.am @@ -48,6 +48,7 @@ radiusd_LDADD = @LEXLIB@ @SQLLIB@ ../snmplib/libradsnmp.a @RADIUSD_LDADD_LIST@ @ BUILT_SOURCES = config.c rewrite.c MAINTAINERCLEANFILES=config.c rewrite.c y.output INCLUDES = @RADIUS_INCLUDE_PATH@ @GUILE_INCLUDES@ +AM_CFLAGS=@OPTFLAGS@ AM_CPPFLAGS=@PATHFLAGS@ -DRADIUS_DATADIR=\"$(pkgdatadir)/$(VERSION)\" -DRADIUS_LIBDIR=\"$(pkglibdir)/$(VERSION)\" EXTRA_DIST = config.y rewrite.y .gdbinit YLWRAP = $(SHELL) $(top_srcdir)/scripts/gylwrap diff --git a/radiusd/rewrite.y b/radiusd/rewrite.y index e77dc980..0ee2e696 100644 --- a/radiusd/rewrite.y +++ b/radiusd/rewrite.y @@ -661,6 +661,8 @@ static int rw_error_free(char *msg); #define rw_code_unlock() #define AVPLIST(m) ((m)->req ? (m)->req->avlist : NULL) + +static FUNCTION fmain; %} @@ -729,8 +731,6 @@ input : dcllist } | expr { - FUNCTION fmain; - if (errcnt) { YYERROR; } |