Browse Source

Avoid compiler warning about ignored 'flatten' attribute directive.

master
Richard Kreckel 17 years ago
parent
commit
27e3a2ba76
  1. 9
      ChangeLog
  2. 2
      configure.ac
  3. 4
      include/cln/config.h.in
  4. 21
      m4/cc.m4
  5. 4
      src/base/cl_maybe_inline.h

9
ChangeLog

@ -1,3 +1,12 @@
2007-02-09 Alexei Sheplyakov <varg@theor.jinr.ru>
Richard B. Kreckel <kreckel@ginac.de>
Avoid compiler warning about ignored 'flatten' attribute directive:
* m4/cc.m4 (CL_ATTRIBUTE_FLATTEN): New macro...
* configure.ac: ...used here...
* include/cln/config.h.in: ...defining CL_HAVE_ATTRIBUTE_FLATTEN,...
* src/base/cl_maybe_inline.h: ...used to prevent a warning here.
2007-02-07 Richard B. Kreckel <kreckel@ginac.de> 2007-02-07 Richard B. Kreckel <kreckel@ginac.de>
* include/cln/integer.h: Enable modifying operators by default. * include/cln/integer.h: Enable modifying operators by default.

2
configure.ac

@ -147,6 +147,8 @@ CL_RUSAGE
dnl DEFS HAVE_SYS_RESOURCE_H, HAVE_GETRUSAGE, HAVE_SYS_TIMES_H dnl DEFS HAVE_SYS_RESOURCE_H, HAVE_GETRUSAGE, HAVE_SYS_TIMES_H
CL_PERROR CL_PERROR
dnl DEFS HAVE_PERROR_DECL dnl DEFS HAVE_PERROR_DECL
CL_ATTRIBUTE_FLATTEN
dnl DEFS CL_HAVE_ATTRIBUTE_FLATTEN
dnl dnl
dnl checks for compiler characteristics dnl checks for compiler characteristics
dnl dnl

4
include/cln/config.h.in

@ -148,6 +148,10 @@
#ifndef CL_GLOBAL_CONSTRUCTOR_SUFFIX_NOPIC #ifndef CL_GLOBAL_CONSTRUCTOR_SUFFIX_NOPIC
#undef CL_GLOBAL_CONSTRUCTOR_SUFFIX_NOPIC #undef CL_GLOBAL_CONSTRUCTOR_SUFFIX_NOPIC
#endif #endif
/* Define if the compiler knows about __attribute__((flatten)). */
#ifndef CL_HAVE_ATTRIBUTE_FLATTEN
#undef CL_HAVE_ATTRIBUTE_FLATTEN
#endif
/* CL_CHAR_UNSIGNED */ /* CL_CHAR_UNSIGNED */
#ifndef __CHAR_UNSIGNED__ #ifndef __CHAR_UNSIGNED__

21
m4/cc.m4

@ -67,3 +67,24 @@ EOF
fi fi
AC_SUBST(ASMFLAGS) AC_SUBST(ASMFLAGS)
]) ])
dnl Checks whether the compiler supports __attribute__((flatten)).
AC_DEFUN([CL_ATTRIBUTE_FLATTEN],[
AC_REQUIRE([AC_PROG_CXX])
AC_CACHE_CHECK([whether the compiler supports __attribute__((flatten))], cl_cv_have_attr_flatten, [dnl
cat > conftest.cc <<EOF
void f() __attribute__((flatten));
EOF
AC_TRY_COMMAND(${CXX-g++} $CXXFLAGS -c conftest.cc >/dev/null 2>conftest.out)
if grep -i "warning" conftest.out > /dev/null; then
cl_cv_have_attr_flatten=no
else
cl_cv_have_attr_flatten=yes
fi
rm -f conftest*
])
if test $cl_cv_have_attr_flatten = yes; then
AC_DEFINE(CL_HAVE_ATTRIBUTE_FLATTEN)
fi
])

4
src/base/cl_maybe_inline.h

@ -3,6 +3,8 @@
#ifndef _CL_MAYBE_INLINE_H #ifndef _CL_MAYBE_INLINE_H
#define _CL_MAYBE_INLINE_H #define _CL_MAYBE_INLINE_H
#include "cln/config.h"
/* /*
* Selectively inline a function in *some* translation units. * Selectively inline a function in *some* translation units.
* *
@ -100,7 +102,7 @@
* a function. * a function.
* 2. It's ignored if the optimization is switched off. * 2. It's ignored if the optimization is switched off.
*/ */
#ifdef __GNUC__
#if defined(__GNUC__) && defined(CL_ATTRIBUTE_FLATTEN)
#define CL_FLATTEN __attribute__((flatten)) #define CL_FLATTEN __attribute__((flatten))
#else #else
#define CL_FLATTEN #define CL_FLATTEN

Loading…
Cancel
Save