2008-10-28 20:22:29 +03:00
|
|
|
# -*- shell-script -*-
|
|
|
|
#
|
|
|
|
# Copyright (c) 2004-2007 The Trustees of Indiana University and Indiana
|
|
|
|
# University Research and Technology
|
|
|
|
# Corporation. All rights reserved.
|
|
|
|
# Copyright (c) 2004-2005 The University of Tennessee and The University
|
|
|
|
# of Tennessee Research Foundation. All rights
|
|
|
|
# reserved.
|
|
|
|
# Copyright (c) 2004-2007 High Performance Computing Center Stuttgart,
|
|
|
|
# University of Stuttgart. All rights reserved.
|
|
|
|
# Copyright (c) 2004-2005 The Regents of the University of California.
|
|
|
|
# All rights reserved.
|
- As proposed in RFC and telcon, warn the user about deprecated
functionality (per MPI-2.1). This warning can be toggled using
--enable-mpi-interface-warning (default OFF), but can be
selectively turned on passing
mpicc -DOMPI_WANT_MPI_INTERFACE_WARNING
Using icc, gcc < 4.5, warnings (such as in mpi2basic_tests) show:
type_vector.c:83: warning: ‘MPI_Type_hvector’ is deprecated
(declared at /home/../usr/include/mpi.h:1379)
Using gcc-4.5 (gcc-svn) these show up as:
type_vector.c:83: warning: ‘MPI_Type_hvector’ is deprecated
(declared at /home/../usr/include/mpi.h:1379):
MPI_Type_hvector is superseded by MPI_Type_create_hvector in MPI-2.0
Jeff and I propose to turn such warnings on with Open MPI-1.7 by default.
- Detection of user-level compiler is handled using the preprocessor
checks of GASnet's other/portable_platform.h (thanks to Paul Hargrove
and Dan Bonachea) adapted into ompi/include/mpi_portable_platform.h
(see comments).
The OMPI-build time detection is output (Familyname and Version)
with ompi_info.
This functionality (actually any upcoming __attribute__) are turned
off, if a different compiler (and version) is being detected.
- Note, that any warnings regarding (user-compiler!=build-compiler)
as discussed in the RFC are _not_ included for now.
- Tested on Linux with --enable-mpi-interface-warning on
Linux, gcc-4.5 (deprecated w/ specific msg)
Linux, gcc-4.3 (deprecated w/o specific msg)
Linux, pathscale 3.1 (deprecated w/o specific msg)
Linux, icc-11.0 (deprecated w/o specific msg)
Linux, PGI-8.0.6 accepts __deprecated__ but does not issue a warning,
further investigation needed...
This commit was SVN r21262.
2009-05-22 08:39:43 +04:00
|
|
|
# Copyright (c) 2009 Oak Ridge National Labs. All rights reserved.
|
2010-06-12 07:15:47 +04:00
|
|
|
# Copyright (c) 2010 Cisco Systems, Inc. All rights reserved.
|
2008-10-28 20:22:29 +03:00
|
|
|
# $COPYRIGHT$
|
|
|
|
#
|
|
|
|
# Additional copyrights may follow
|
|
|
|
#
|
|
|
|
# $HEADER$
|
|
|
|
#
|
|
|
|
|
|
|
|
#
|
|
|
|
# Search the generated warnings for
|
|
|
|
# keywords regarding skipping or ignoring certain attributes
|
|
|
|
# Intel: ignore
|
|
|
|
# Sun C++: skip
|
|
|
|
#
|
2010-06-12 07:15:47 +04:00
|
|
|
AC_DEFUN([_OPAL_ATTRIBUTE_FAIL_SEARCH],[
|
2008-10-28 20:22:29 +03:00
|
|
|
AC_REQUIRE([AC_PROG_GREP])
|
|
|
|
if test -s conftest.err ; then
|
2009-05-20 04:39:22 +04:00
|
|
|
# icc uses 'invalid attribute' and 'attribute "__XXX__" ignored'
|
|
|
|
for i in invalid ignore skip ; do
|
2008-10-28 20:22:29 +03:00
|
|
|
$GREP -iq $i conftest.err
|
|
|
|
if test "$?" = "0" ; then
|
2009-05-07 00:11:28 +04:00
|
|
|
opal_cv___attribute__[$1]=0
|
2008-10-28 20:22:29 +03:00
|
|
|
break;
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
|
|
|
#
|
|
|
|
# Check for one specific attribute by compiling with C and C++
|
|
|
|
# and possibly using a cross-check.
|
|
|
|
#
|
|
|
|
# If the cross-check is defined, a static function "usage" should be
|
|
|
|
# defined, which is to be called from main (to circumvent warnings
|
|
|
|
# regarding unused function in main file)
|
|
|
|
# static int usage (int * argument);
|
|
|
|
#
|
|
|
|
# The last argument is for specific CFLAGS, that need to be set
|
|
|
|
# for the compiler to generate a warning on the cross-check.
|
|
|
|
# This may need adaption for future compilers / CFLAG-settings.
|
|
|
|
#
|
2010-06-12 07:15:47 +04:00
|
|
|
AC_DEFUN([_OPAL_CHECK_SPECIFIC_ATTRIBUTE], [
|
2008-10-28 20:22:29 +03:00
|
|
|
AC_MSG_CHECKING([for __attribute__([$1])])
|
2009-05-07 00:11:28 +04:00
|
|
|
AC_CACHE_VAL(opal_cv___attribute__[$1], [
|
2008-10-28 20:22:29 +03:00
|
|
|
#
|
|
|
|
# Try to compile using the C compiler, then C++
|
|
|
|
#
|
|
|
|
AC_TRY_COMPILE([$2],[],
|
|
|
|
[
|
|
|
|
#
|
|
|
|
# In case we did succeed: Fine, but was this due to the
|
|
|
|
# attribute being ignored/skipped? Grep for IgNoRe/skip in conftest.err
|
|
|
|
# and if found, reset the ompi_cv__attribute__var=0
|
|
|
|
#
|
2009-05-07 00:11:28 +04:00
|
|
|
opal_cv___attribute__[$1]=1
|
2010-06-12 07:15:47 +04:00
|
|
|
_OPAL_ATTRIBUTE_FAIL_SEARCH([$1])
|
2008-10-28 20:22:29 +03:00
|
|
|
],
|
2009-05-07 00:11:28 +04:00
|
|
|
[opal_cv___attribute__[$1]=0])
|
2010-06-12 07:15:47 +04:00
|
|
|
|
|
|
|
# Only test C++ if we're building Open MPI (i.e.,
|
|
|
|
# project_ompi). OPAL and ORTE do not use C++ at all, so
|
|
|
|
# let's not add a C++ compiler into their requirement list.
|
|
|
|
m4_ifdef([project_ompi],
|
|
|
|
[if test "$opal_cv___attribute__[$1]" = "1" ; then
|
|
|
|
AC_LANG_PUSH(C++)
|
|
|
|
AC_TRY_COMPILE([
|
2008-10-28 20:22:29 +03:00
|
|
|
extern "C" {
|
|
|
|
$2
|
|
|
|
}],[],
|
|
|
|
[
|
2009-05-07 00:11:28 +04:00
|
|
|
opal_cv___attribute__[$1]=1
|
2010-06-12 07:15:47 +04:00
|
|
|
_OPAL_ATTRIBUTE_FAIL_SEARCH([$1])
|
2009-05-07 00:11:28 +04:00
|
|
|
],[opal_cv___attribute__[$1]=0])
|
2010-06-12 07:15:47 +04:00
|
|
|
AC_LANG_POP(C++)
|
|
|
|
fi])
|
2009-05-20 04:39:22 +04:00
|
|
|
|
2008-10-28 20:22:29 +03:00
|
|
|
#
|
|
|
|
# If the attribute is supported by both compilers,
|
|
|
|
# try to recompile a *cross-check*, IFF defined.
|
|
|
|
#
|
2009-05-07 00:11:28 +04:00
|
|
|
if test '(' "$opal_cv___attribute__[$1]" = "1" -a "[$3]" != "" ')' ; then
|
2008-10-28 20:22:29 +03:00
|
|
|
ac_c_werror_flag_safe=$ac_c_werror_flag
|
|
|
|
ac_c_werror_flag="yes"
|
|
|
|
CFLAGS_safe=$CFLAGS
|
|
|
|
CFLAGS="$CFLAGS [$4]"
|
|
|
|
|
|
|
|
AC_TRY_COMPILE([$3],
|
|
|
|
[
|
|
|
|
int i=4711;
|
|
|
|
i=usage(&i);
|
|
|
|
],
|
2009-05-07 00:11:28 +04:00
|
|
|
[opal_cv___attribute__[$1]=0],
|
2008-10-28 20:22:29 +03:00
|
|
|
[
|
|
|
|
#
|
|
|
|
# In case we did NOT succeed: Fine, but was this due to the
|
|
|
|
# attribute being ignored? Grep for IgNoRe in conftest.err
|
|
|
|
# and if found, reset the ompi_cv__attribute__var=0
|
|
|
|
#
|
2009-05-07 00:11:28 +04:00
|
|
|
opal_cv___attribute__[$1]=1
|
2010-06-12 07:15:47 +04:00
|
|
|
_OPAL_ATTRIBUTE_FAIL_SEARCH([$1])
|
2008-10-28 20:22:29 +03:00
|
|
|
])
|
|
|
|
|
|
|
|
ac_c_werror_flag=$ac_c_werror_flag_safe
|
|
|
|
CFLAGS=$CFLAGS_safe
|
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
2009-05-07 00:11:28 +04:00
|
|
|
if test "$opal_cv___attribute__[$1]" = "1" ; then
|
2008-10-28 20:22:29 +03:00
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
else
|
|
|
|
AC_MSG_RESULT([no])
|
|
|
|
fi
|
|
|
|
])
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# Test the availability of __attribute__ and with the help
|
2010-06-12 07:15:47 +04:00
|
|
|
# of _OPAL_CHECK_SPECIFIC_ATTRIBUTE for the support of
|
2008-10-28 20:22:29 +03:00
|
|
|
# particular attributes. Compilers, that do not support an
|
|
|
|
# attribute most often fail with a warning (when the warning
|
|
|
|
# level is set).
|
2010-06-12 07:15:47 +04:00
|
|
|
# The compilers output is parsed in _OPAL_ATTRIBUTE_FAIL_SEARCH
|
2008-10-28 20:22:29 +03:00
|
|
|
#
|
|
|
|
# To add a new attributes __NAME__ add the
|
2009-05-07 00:11:28 +04:00
|
|
|
# opal_cv___attribute__NAME
|
2010-06-12 07:15:47 +04:00
|
|
|
# add a new check with _OPAL_CHECK_SPECIFIC_ATTRIBUTE (possibly with a cross-check)
|
|
|
|
# _OPAL_CHECK_SPECIFIC_ATTRIBUTE([name], [int foo (int arg) __attribute__ ((__name__));], [], [])
|
2008-10-28 20:22:29 +03:00
|
|
|
# and define the corresponding
|
2009-05-07 00:11:28 +04:00
|
|
|
# AC_DEFINE_UNQUOTED(OPAL_HAVE_ATTRIBUTE_NAME, [$opal_cv___attribute__NAME],
|
2008-10-28 20:22:29 +03:00
|
|
|
# [Whether your compiler has __attribute__ NAME or not])
|
|
|
|
# and decide on a correct macro (in opal/include/opal_config_bottom.h):
|
|
|
|
# # define __opal_attribute_NAME(x) __attribute__(__NAME__)
|
|
|
|
#
|
|
|
|
# Please use the "__"-notation of the attribute in order not to
|
|
|
|
# clash with predefined names or macros (e.g. const, which some compilers
|
|
|
|
# do not like..)
|
|
|
|
#
|
|
|
|
|
|
|
|
|
2010-06-12 07:15:47 +04:00
|
|
|
AC_DEFUN([OPAL_CHECK_ATTRIBUTES], [
|
2009-10-21 03:44:20 +04:00
|
|
|
AC_LANG(C)
|
2008-10-28 20:22:29 +03:00
|
|
|
AC_MSG_CHECKING(for __attribute__)
|
|
|
|
|
2009-05-07 00:11:28 +04:00
|
|
|
AC_CACHE_VAL(opal_cv___attribute__, [
|
2008-10-28 20:22:29 +03:00
|
|
|
AC_TRY_COMPILE(
|
|
|
|
[#include <stdlib.h>
|
|
|
|
/* Check for the longest available __attribute__ (since gcc-2.3) */
|
|
|
|
struct foo {
|
|
|
|
char a;
|
|
|
|
int x[2] __attribute__ ((__packed__));
|
|
|
|
};
|
|
|
|
],
|
|
|
|
[],
|
2009-05-07 00:11:28 +04:00
|
|
|
[opal_cv___attribute__=1],
|
|
|
|
[opal_cv___attribute__=0],
|
2008-10-28 20:22:29 +03:00
|
|
|
)
|
|
|
|
|
2009-05-07 00:11:28 +04:00
|
|
|
if test "$opal_cv___attribute__" = "1" ; then
|
2008-10-28 20:22:29 +03:00
|
|
|
AC_TRY_COMPILE(
|
|
|
|
[#include <stdlib.h>
|
|
|
|
/* Check for the longest available __attribute__ (since gcc-2.3) */
|
|
|
|
struct foo {
|
|
|
|
char a;
|
|
|
|
int x[2] __attribute__ ((__packed__));
|
|
|
|
};
|
|
|
|
],
|
|
|
|
[],
|
2009-05-07 00:11:28 +04:00
|
|
|
[opal_cv___attribute__=1],
|
|
|
|
[opal_cv___attribute__=0],
|
2008-10-28 20:22:29 +03:00
|
|
|
)
|
|
|
|
fi
|
|
|
|
])
|
2009-05-07 00:11:28 +04:00
|
|
|
AC_DEFINE_UNQUOTED(OPAL_HAVE_ATTRIBUTE, [$opal_cv___attribute__],
|
2008-10-28 20:22:29 +03:00
|
|
|
[Whether your compiler has __attribute__ or not])
|
|
|
|
|
|
|
|
#
|
|
|
|
# Now that we know the compiler support __attribute__ let's check which kind of
|
|
|
|
# attributed are supported.
|
|
|
|
#
|
2009-05-07 00:11:28 +04:00
|
|
|
if test "$opal_cv___attribute__" = "0" ; then
|
2008-10-28 20:22:29 +03:00
|
|
|
AC_MSG_RESULT([no])
|
2009-05-07 00:11:28 +04:00
|
|
|
opal_cv___attribute__aligned=0
|
|
|
|
opal_cv___attribute__always_inline=0
|
|
|
|
opal_cv___attribute__cold=0
|
|
|
|
opal_cv___attribute__const=0
|
|
|
|
opal_cv___attribute__deprecated=0
|
- As proposed in RFC and telcon, warn the user about deprecated
functionality (per MPI-2.1). This warning can be toggled using
--enable-mpi-interface-warning (default OFF), but can be
selectively turned on passing
mpicc -DOMPI_WANT_MPI_INTERFACE_WARNING
Using icc, gcc < 4.5, warnings (such as in mpi2basic_tests) show:
type_vector.c:83: warning: ‘MPI_Type_hvector’ is deprecated
(declared at /home/../usr/include/mpi.h:1379)
Using gcc-4.5 (gcc-svn) these show up as:
type_vector.c:83: warning: ‘MPI_Type_hvector’ is deprecated
(declared at /home/../usr/include/mpi.h:1379):
MPI_Type_hvector is superseded by MPI_Type_create_hvector in MPI-2.0
Jeff and I propose to turn such warnings on with Open MPI-1.7 by default.
- Detection of user-level compiler is handled using the preprocessor
checks of GASnet's other/portable_platform.h (thanks to Paul Hargrove
and Dan Bonachea) adapted into ompi/include/mpi_portable_platform.h
(see comments).
The OMPI-build time detection is output (Familyname and Version)
with ompi_info.
This functionality (actually any upcoming __attribute__) are turned
off, if a different compiler (and version) is being detected.
- Note, that any warnings regarding (user-compiler!=build-compiler)
as discussed in the RFC are _not_ included for now.
- Tested on Linux with --enable-mpi-interface-warning on
Linux, gcc-4.5 (deprecated w/ specific msg)
Linux, gcc-4.3 (deprecated w/o specific msg)
Linux, pathscale 3.1 (deprecated w/o specific msg)
Linux, icc-11.0 (deprecated w/o specific msg)
Linux, PGI-8.0.6 accepts __deprecated__ but does not issue a warning,
further investigation needed...
This commit was SVN r21262.
2009-05-22 08:39:43 +04:00
|
|
|
opal_cv___attribute__deprecated_argument=0
|
2009-05-07 00:11:28 +04:00
|
|
|
opal_cv___attribute__format=0
|
2009-05-20 04:39:22 +04:00
|
|
|
opal_cv___attribute__format_funcptr=0
|
2009-05-07 00:11:28 +04:00
|
|
|
opal_cv___attribute__hot=0
|
|
|
|
opal_cv___attribute__malloc=0
|
|
|
|
opal_cv___attribute__may_alias=0
|
|
|
|
opal_cv___attribute__no_instrument_function=0
|
|
|
|
opal_cv___attribute__nonnull=0
|
|
|
|
opal_cv___attribute__noreturn=0
|
|
|
|
opal_cv___attribute__packed=0
|
|
|
|
opal_cv___attribute__pure=0
|
|
|
|
opal_cv___attribute__sentinel=0
|
|
|
|
opal_cv___attribute__unused=0
|
|
|
|
opal_cv___attribute__visibility=0
|
|
|
|
opal_cv___attribute__warn_unused_result=0
|
|
|
|
opal_cv___attribute__weak_alias=0
|
2008-10-28 20:22:29 +03:00
|
|
|
else
|
|
|
|
AC_MSG_RESULT([yes])
|
|
|
|
|
2010-06-12 07:15:47 +04:00
|
|
|
_OPAL_CHECK_SPECIFIC_ATTRIBUTE([aligned],
|
2008-10-28 20:22:29 +03:00
|
|
|
[struct foo { char text[4]; } __attribute__ ((__aligned__(8)));],
|
|
|
|
[],
|
|
|
|
[])
|
|
|
|
|
|
|
|
#
|
|
|
|
# Ignored by PGI-6.2.5; -- recognized by output-parser
|
|
|
|
#
|
2010-06-12 07:15:47 +04:00
|
|
|
_OPAL_CHECK_SPECIFIC_ATTRIBUTE([always_inline],
|
2008-10-28 20:22:29 +03:00
|
|
|
[int foo (int arg) __attribute__ ((__always_inline__));],
|
|
|
|
[],
|
|
|
|
[])
|
|
|
|
|
2010-06-12 07:15:47 +04:00
|
|
|
_OPAL_CHECK_SPECIFIC_ATTRIBUTE([cold],
|
2008-10-28 20:22:29 +03:00
|
|
|
[
|
|
|
|
int foo(int arg1, int arg2) __attribute__ ((__cold__));
|
|
|
|
int foo(int arg1, int arg2) { return arg1 * arg2 + arg1; }
|
|
|
|
],
|
|
|
|
[],
|
|
|
|
[])
|
|
|
|
|
2010-06-12 07:15:47 +04:00
|
|
|
_OPAL_CHECK_SPECIFIC_ATTRIBUTE([const],
|
2008-10-28 20:22:29 +03:00
|
|
|
[
|
|
|
|
int foo(int arg1, int arg2) __attribute__ ((__const__));
|
|
|
|
int foo(int arg1, int arg2) { return arg1 * arg2 + arg1; }
|
|
|
|
],
|
|
|
|
[],
|
|
|
|
[])
|
|
|
|
|
2010-06-12 07:15:47 +04:00
|
|
|
_OPAL_CHECK_SPECIFIC_ATTRIBUTE([deprecated],
|
2008-10-28 20:22:29 +03:00
|
|
|
[
|
|
|
|
int foo(int arg1, int arg2) __attribute__ ((__deprecated__));
|
|
|
|
int foo(int arg1, int arg2) { return arg1 * arg2 + arg1; }
|
|
|
|
],
|
|
|
|
[],
|
|
|
|
[])
|
|
|
|
|
2010-06-12 07:15:47 +04:00
|
|
|
_OPAL_CHECK_SPECIFIC_ATTRIBUTE([deprecated_argument],
|
- As proposed in RFC and telcon, warn the user about deprecated
functionality (per MPI-2.1). This warning can be toggled using
--enable-mpi-interface-warning (default OFF), but can be
selectively turned on passing
mpicc -DOMPI_WANT_MPI_INTERFACE_WARNING
Using icc, gcc < 4.5, warnings (such as in mpi2basic_tests) show:
type_vector.c:83: warning: ‘MPI_Type_hvector’ is deprecated
(declared at /home/../usr/include/mpi.h:1379)
Using gcc-4.5 (gcc-svn) these show up as:
type_vector.c:83: warning: ‘MPI_Type_hvector’ is deprecated
(declared at /home/../usr/include/mpi.h:1379):
MPI_Type_hvector is superseded by MPI_Type_create_hvector in MPI-2.0
Jeff and I propose to turn such warnings on with Open MPI-1.7 by default.
- Detection of user-level compiler is handled using the preprocessor
checks of GASnet's other/portable_platform.h (thanks to Paul Hargrove
and Dan Bonachea) adapted into ompi/include/mpi_portable_platform.h
(see comments).
The OMPI-build time detection is output (Familyname and Version)
with ompi_info.
This functionality (actually any upcoming __attribute__) are turned
off, if a different compiler (and version) is being detected.
- Note, that any warnings regarding (user-compiler!=build-compiler)
as discussed in the RFC are _not_ included for now.
- Tested on Linux with --enable-mpi-interface-warning on
Linux, gcc-4.5 (deprecated w/ specific msg)
Linux, gcc-4.3 (deprecated w/o specific msg)
Linux, pathscale 3.1 (deprecated w/o specific msg)
Linux, icc-11.0 (deprecated w/o specific msg)
Linux, PGI-8.0.6 accepts __deprecated__ but does not issue a warning,
further investigation needed...
This commit was SVN r21262.
2009-05-22 08:39:43 +04:00
|
|
|
[
|
|
|
|
int foo(int arg1, int arg2) __attribute__ ((__deprecated__("compiler allows argument")));
|
|
|
|
int foo(int arg1, int arg2) { return arg1 * arg2 + arg1; }
|
|
|
|
],
|
|
|
|
[],
|
|
|
|
[])
|
2008-10-28 20:22:29 +03:00
|
|
|
|
|
|
|
ATTRIBUTE_CFLAGS=
|
|
|
|
case "$ompi_c_vendor" in
|
|
|
|
gnu)
|
|
|
|
ATTRIBUTE_CFLAGS="-Wall"
|
|
|
|
;;
|
|
|
|
intel)
|
|
|
|
# we want specifically the warning on format string conversion
|
|
|
|
ATTRIBUTE_CFLAGS="-we181"
|
|
|
|
;;
|
|
|
|
esac
|
2010-06-12 07:15:47 +04:00
|
|
|
_OPAL_CHECK_SPECIFIC_ATTRIBUTE([format],
|
2008-10-28 20:22:29 +03:00
|
|
|
[
|
|
|
|
int this_printf (void *my_object, const char *my_format, ...) __attribute__ ((__format__ (__printf__, 2, 3)));
|
|
|
|
],
|
|
|
|
[
|
|
|
|
static int usage (int * argument);
|
|
|
|
extern int this_printf (int arg1, const char *my_format, ...) __attribute__ ((__format__ (__printf__, 2, 3)));
|
|
|
|
|
|
|
|
static int usage (int * argument) {
|
|
|
|
return this_printf (*argument, "%d", argument); /* This should produce a format warning */
|
|
|
|
}
|
|
|
|
/* The autoconf-generated main-function is int main(), which produces a warning by itself */
|
|
|
|
int main(void);
|
|
|
|
],
|
|
|
|
[$ATTRIBUTE_CFLAGS])
|
|
|
|
|
2009-05-20 04:39:22 +04:00
|
|
|
ATTRIBUTE_CFLAGS=
|
|
|
|
case "$ompi_c_vendor" in
|
|
|
|
gnu)
|
|
|
|
ATTRIBUTE_CFLAGS="-Wall"
|
|
|
|
;;
|
|
|
|
intel)
|
|
|
|
# we want specifically the warning on format string conversion
|
|
|
|
ATTRIBUTE_CFLAGS="-we181"
|
|
|
|
;;
|
|
|
|
esac
|
2010-06-12 07:15:47 +04:00
|
|
|
_OPAL_CHECK_SPECIFIC_ATTRIBUTE([format_funcptr],
|
2009-05-20 04:39:22 +04:00
|
|
|
[
|
|
|
|
int (*this_printf)(void *my_object, const char *my_format, ...) __attribute__ ((__format__ (__printf__, 2, 3)));
|
|
|
|
],
|
|
|
|
[
|
|
|
|
static int usage (int * argument);
|
|
|
|
extern int (*this_printf) (int arg1, const char *my_format, ...) __attribute__ ((__format__ (__printf__, 2, 3)));
|
|
|
|
|
|
|
|
static int usage (int * argument) {
|
|
|
|
return (*this_printf) (*argument, "%d", argument); /* This should produce a format warning */
|
|
|
|
}
|
|
|
|
/* The autoconf-generated main-function is int main(), which produces a warning by itself */
|
|
|
|
int main(void);
|
|
|
|
],
|
|
|
|
[$ATTRIBUTE_CFLAGS])
|
|
|
|
|
2010-06-12 07:15:47 +04:00
|
|
|
_OPAL_CHECK_SPECIFIC_ATTRIBUTE([hot],
|
2008-10-28 20:22:29 +03:00
|
|
|
[
|
|
|
|
int foo(int arg1, int arg2) __attribute__ ((__hot__));
|
|
|
|
int foo(int arg1, int arg2) { return arg1 * arg2 + arg1; }
|
|
|
|
],
|
|
|
|
[],
|
|
|
|
[])
|
|
|
|
|
2010-06-12 07:15:47 +04:00
|
|
|
_OPAL_CHECK_SPECIFIC_ATTRIBUTE([malloc],
|
2008-10-28 20:22:29 +03:00
|
|
|
[
|
|
|
|
#ifdef HAVE_STDLIB_H
|
|
|
|
# include <stdlib.h>
|
|
|
|
#endif
|
|
|
|
int * foo(int arg1) __attribute__ ((__malloc__));
|
|
|
|
int * foo(int arg1) { return (int*) malloc(arg1); }
|
|
|
|
],
|
|
|
|
[],
|
|
|
|
[])
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# Attribute may_alias: No suitable cross-check available, that works for non-supporting compilers
|
|
|
|
# Ignored by intel-9.1.045 -- turn off with -wd1292
|
|
|
|
# Ignored by PGI-6.2.5; ignore not detected due to missing cross-check
|
|
|
|
#
|
2010-06-12 07:15:47 +04:00
|
|
|
_OPAL_CHECK_SPECIFIC_ATTRIBUTE([may_alias],
|
2008-10-28 20:22:29 +03:00
|
|
|
[int * p_value __attribute__ ((__may_alias__));],
|
|
|
|
[],
|
|
|
|
[])
|
|
|
|
|
|
|
|
|
2010-06-12 07:15:47 +04:00
|
|
|
_OPAL_CHECK_SPECIFIC_ATTRIBUTE([no_instrument_function],
|
2008-10-28 20:22:29 +03:00
|
|
|
[int * foo(int arg1) __attribute__ ((__no_instrument_function__));],
|
|
|
|
[],
|
|
|
|
[])
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# Attribute nonnull:
|
|
|
|
# Ignored by intel-compiler 9.1.045 -- recognized by cross-check
|
|
|
|
# Ignored by PGI-6.2.5 (pgCC) -- recognized by cross-check
|
|
|
|
#
|
|
|
|
ATTRIBUTE_CFLAGS=
|
|
|
|
case "$ompi_c_vendor" in
|
|
|
|
gnu)
|
|
|
|
ATTRIBUTE_CFLAGS="-Wall"
|
|
|
|
;;
|
|
|
|
intel)
|
|
|
|
# we do not want to get ignored attributes warnings, but rather real warnings
|
|
|
|
ATTRIBUTE_CFLAGS="-wd1292"
|
|
|
|
;;
|
|
|
|
esac
|
2010-06-12 07:15:47 +04:00
|
|
|
_OPAL_CHECK_SPECIFIC_ATTRIBUTE([nonnull],
|
2008-10-28 20:22:29 +03:00
|
|
|
[
|
|
|
|
int square(int *arg) __attribute__ ((__nonnull__));
|
|
|
|
int square(int *arg) { return *arg; }
|
|
|
|
],
|
|
|
|
[
|
|
|
|
static int usage(int * argument);
|
|
|
|
int square(int * argument) __attribute__ ((__nonnull__));
|
|
|
|
int square(int * argument) { return (*argument) * (*argument); }
|
|
|
|
|
|
|
|
static int usage(int * argument) {
|
|
|
|
return square( ((void*)0) ); /* This should produce an argument must be nonnull warning */
|
|
|
|
}
|
|
|
|
/* The autoconf-generated main-function is int main(), which produces a warning by itself */
|
|
|
|
int main(void);
|
|
|
|
],
|
|
|
|
[$ATTRIBUTE_CFLAGS])
|
|
|
|
|
|
|
|
|
2010-06-12 07:15:47 +04:00
|
|
|
_OPAL_CHECK_SPECIFIC_ATTRIBUTE([noreturn],
|
2008-10-28 20:22:29 +03:00
|
|
|
[
|
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
# include <unistd.h>
|
|
|
|
#endif
|
|
|
|
#ifdef HAVE_STDLIB_H
|
|
|
|
# include <stdlib.h>
|
|
|
|
#endif
|
|
|
|
void fatal(int arg1) __attribute__ ((__noreturn__));
|
|
|
|
void fatal(int arg1) { exit(arg1); }
|
|
|
|
],
|
|
|
|
[],
|
|
|
|
[])
|
|
|
|
|
2010-06-12 07:15:47 +04:00
|
|
|
_OPAL_CHECK_SPECIFIC_ATTRIBUTE([packed],
|
2008-10-28 20:22:29 +03:00
|
|
|
[
|
|
|
|
struct foo {
|
|
|
|
char a;
|
|
|
|
int x[2] __attribute__ ((__packed__));
|
|
|
|
};
|
|
|
|
],
|
|
|
|
[],
|
|
|
|
[])
|
|
|
|
|
2010-06-12 07:15:47 +04:00
|
|
|
_OPAL_CHECK_SPECIFIC_ATTRIBUTE([pure],
|
2008-10-28 20:22:29 +03:00
|
|
|
[
|
|
|
|
int square(int arg) __attribute__ ((__pure__));
|
|
|
|
int square(int arg) { return arg * arg; }
|
|
|
|
],
|
|
|
|
[],
|
|
|
|
[])
|
|
|
|
|
|
|
|
#
|
|
|
|
# Attribute sentinel:
|
|
|
|
# Ignored by the intel-9.1.045 -- recognized by cross-check
|
|
|
|
# intel-10.0beta works fine
|
|
|
|
# Ignored by PGI-6.2.5 (pgCC) -- recognized by output-parser and cross-check
|
|
|
|
# Ignored by pathcc-2.2.1 -- recognized by cross-check (through grep ignore)
|
|
|
|
#
|
|
|
|
ATTRIBUTE_CFLAGS=
|
|
|
|
case "$ompi_c_vendor" in
|
|
|
|
gnu)
|
|
|
|
ATTRIBUTE_CFLAGS="-Wall"
|
|
|
|
;;
|
|
|
|
intel)
|
|
|
|
# we do not want to get ignored attributes warnings
|
|
|
|
ATTRIBUTE_CFLAGS="-wd1292"
|
|
|
|
;;
|
|
|
|
esac
|
2010-06-12 07:15:47 +04:00
|
|
|
_OPAL_CHECK_SPECIFIC_ATTRIBUTE([sentinel],
|
2008-10-28 20:22:29 +03:00
|
|
|
[
|
|
|
|
int my_execlp(const char * file, const char *arg, ...) __attribute__ ((__sentinel__));
|
|
|
|
],
|
|
|
|
[
|
|
|
|
static int usage(int * argument);
|
|
|
|
int my_execlp(const char * file, const char *arg, ...) __attribute__ ((__sentinel__));
|
|
|
|
|
|
|
|
static int usage(int * argument) {
|
|
|
|
void * last_arg_should_be_null = argument;
|
|
|
|
return my_execlp ("lala", "/home/there", last_arg_should_be_null); /* This should produce a warning */
|
|
|
|
}
|
|
|
|
/* The autoconf-generated main-function is int main(), which produces a warning by itself */
|
|
|
|
int main(void);
|
|
|
|
],
|
|
|
|
[$ATTRIBUTE_CFLAGS])
|
|
|
|
|
2010-06-12 07:15:47 +04:00
|
|
|
_OPAL_CHECK_SPECIFIC_ATTRIBUTE([unused],
|
2008-10-28 20:22:29 +03:00
|
|
|
[
|
|
|
|
int square(int arg1 __attribute__ ((__unused__)), int arg2);
|
|
|
|
int square(int arg1, int arg2) { return arg2; }
|
|
|
|
],
|
|
|
|
[],
|
|
|
|
[])
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# Ignored by PGI-6.2.5 (pgCC) -- recognized by the output-parser
|
|
|
|
#
|
2010-06-12 07:15:47 +04:00
|
|
|
_OPAL_CHECK_SPECIFIC_ATTRIBUTE([visibility],
|
2008-10-28 20:22:29 +03:00
|
|
|
[
|
|
|
|
int square(int arg1) __attribute__ ((__visibility__("hidden")));
|
|
|
|
],
|
|
|
|
[],
|
|
|
|
[])
|
|
|
|
|
|
|
|
|
|
|
|
#
|
|
|
|
# Attribute warn_unused_result:
|
|
|
|
# Ignored by the intel-compiler 9.1.045 -- recognized by cross-check
|
|
|
|
# Ignored by pathcc-2.2.1 -- recognized by cross-check (through grep ignore)
|
|
|
|
#
|
|
|
|
ATTRIBUTE_CFLAGS=
|
|
|
|
case "$ompi_c_vendor" in
|
|
|
|
gnu)
|
|
|
|
ATTRIBUTE_CFLAGS="-Wall"
|
|
|
|
;;
|
|
|
|
intel)
|
|
|
|
# we do not want to get ignored attributes warnings
|
|
|
|
ATTRIBUTE_CFLAGS="-wd1292"
|
|
|
|
;;
|
|
|
|
esac
|
2010-06-12 07:15:47 +04:00
|
|
|
_OPAL_CHECK_SPECIFIC_ATTRIBUTE([warn_unused_result],
|
2008-10-28 20:22:29 +03:00
|
|
|
[
|
|
|
|
int foo(int arg) __attribute__ ((__warn_unused_result__));
|
|
|
|
int foo(int arg) { return arg + 3; }
|
|
|
|
],
|
|
|
|
[
|
|
|
|
static int usage(int * argument);
|
|
|
|
int foo(int arg) __attribute__ ((__warn_unused_result__));
|
|
|
|
|
|
|
|
int foo(int arg) { return arg + 3; }
|
|
|
|
static int usage(int * argument) {
|
|
|
|
foo (*argument); /* Should produce an unused result warning */
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* The autoconf-generated main-function is int main(), which produces a warning by itself */
|
|
|
|
int main(void);
|
|
|
|
],
|
|
|
|
[$ATTRIBUTE_CFLAGS])
|
|
|
|
|
|
|
|
|
2010-06-12 07:15:47 +04:00
|
|
|
_OPAL_CHECK_SPECIFIC_ATTRIBUTE([weak_alias],
|
2008-10-28 20:22:29 +03:00
|
|
|
[
|
|
|
|
int foo(int arg);
|
|
|
|
int foo(int arg) { return arg + 3; }
|
|
|
|
int foo2(int arg) __attribute__ ((__weak__, __alias__("foo")));
|
|
|
|
],
|
|
|
|
[],
|
|
|
|
[])
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Now that all the values are set, define them
|
|
|
|
|
2009-05-07 00:11:28 +04:00
|
|
|
AC_DEFINE_UNQUOTED(OPAL_HAVE_ATTRIBUTE_ALIGNED, [$opal_cv___attribute__aligned],
|
2008-10-28 20:22:29 +03:00
|
|
|
[Whether your compiler has __attribute__ aligned or not])
|
2009-05-07 00:11:28 +04:00
|
|
|
AC_DEFINE_UNQUOTED(OPAL_HAVE_ATTRIBUTE_ALWAYS_INLINE, [$opal_cv___attribute__always_inline],
|
2008-10-28 20:22:29 +03:00
|
|
|
[Whether your compiler has __attribute__ always_inline or not])
|
2009-05-07 00:11:28 +04:00
|
|
|
AC_DEFINE_UNQUOTED(OPAL_HAVE_ATTRIBUTE_COLD, [$opal_cv___attribute__cold],
|
2008-10-28 20:22:29 +03:00
|
|
|
[Whether your compiler has __attribute__ cold or not])
|
2009-05-07 00:11:28 +04:00
|
|
|
AC_DEFINE_UNQUOTED(OPAL_HAVE_ATTRIBUTE_CONST, [$opal_cv___attribute__const],
|
2008-10-28 20:22:29 +03:00
|
|
|
[Whether your compiler has __attribute__ const or not])
|
2009-05-07 00:11:28 +04:00
|
|
|
AC_DEFINE_UNQUOTED(OPAL_HAVE_ATTRIBUTE_DEPRECATED, [$opal_cv___attribute__deprecated],
|
2008-10-28 20:22:29 +03:00
|
|
|
[Whether your compiler has __attribute__ deprecated or not])
|
- As proposed in RFC and telcon, warn the user about deprecated
functionality (per MPI-2.1). This warning can be toggled using
--enable-mpi-interface-warning (default OFF), but can be
selectively turned on passing
mpicc -DOMPI_WANT_MPI_INTERFACE_WARNING
Using icc, gcc < 4.5, warnings (such as in mpi2basic_tests) show:
type_vector.c:83: warning: ‘MPI_Type_hvector’ is deprecated
(declared at /home/../usr/include/mpi.h:1379)
Using gcc-4.5 (gcc-svn) these show up as:
type_vector.c:83: warning: ‘MPI_Type_hvector’ is deprecated
(declared at /home/../usr/include/mpi.h:1379):
MPI_Type_hvector is superseded by MPI_Type_create_hvector in MPI-2.0
Jeff and I propose to turn such warnings on with Open MPI-1.7 by default.
- Detection of user-level compiler is handled using the preprocessor
checks of GASnet's other/portable_platform.h (thanks to Paul Hargrove
and Dan Bonachea) adapted into ompi/include/mpi_portable_platform.h
(see comments).
The OMPI-build time detection is output (Familyname and Version)
with ompi_info.
This functionality (actually any upcoming __attribute__) are turned
off, if a different compiler (and version) is being detected.
- Note, that any warnings regarding (user-compiler!=build-compiler)
as discussed in the RFC are _not_ included for now.
- Tested on Linux with --enable-mpi-interface-warning on
Linux, gcc-4.5 (deprecated w/ specific msg)
Linux, gcc-4.3 (deprecated w/o specific msg)
Linux, pathscale 3.1 (deprecated w/o specific msg)
Linux, icc-11.0 (deprecated w/o specific msg)
Linux, PGI-8.0.6 accepts __deprecated__ but does not issue a warning,
further investigation needed...
This commit was SVN r21262.
2009-05-22 08:39:43 +04:00
|
|
|
AC_DEFINE_UNQUOTED(OPAL_HAVE_ATTRIBUTE_DEPRECATED_ARGUMENT, [$opal_cv___attribute__deprecated_argument],
|
|
|
|
[Whether your compiler has __attribute__ deprecated with optional argument])
|
2009-05-07 00:11:28 +04:00
|
|
|
AC_DEFINE_UNQUOTED(OPAL_HAVE_ATTRIBUTE_FORMAT, [$opal_cv___attribute__format],
|
2008-10-28 20:22:29 +03:00
|
|
|
[Whether your compiler has __attribute__ format or not])
|
2009-05-20 04:39:22 +04:00
|
|
|
AC_DEFINE_UNQUOTED(OPAL_HAVE_ATTRIBUTE_FORMAT_FUNCPTR, [$opal_cv___attribute__format_funcptr],
|
|
|
|
[Whether your compiler has __attribute__ format and it works on function pointers])
|
2009-05-07 00:11:28 +04:00
|
|
|
AC_DEFINE_UNQUOTED(OPAL_HAVE_ATTRIBUTE_HOT, [$opal_cv___attribute__hot],
|
2008-10-28 20:22:29 +03:00
|
|
|
[Whether your compiler has __attribute__ hot or not])
|
2009-05-07 00:11:28 +04:00
|
|
|
AC_DEFINE_UNQUOTED(OPAL_HAVE_ATTRIBUTE_MALLOC, [$opal_cv___attribute__malloc],
|
2008-10-28 20:22:29 +03:00
|
|
|
[Whether your compiler has __attribute__ malloc or not])
|
2009-05-07 00:11:28 +04:00
|
|
|
AC_DEFINE_UNQUOTED(OPAL_HAVE_ATTRIBUTE_MAY_ALIAS, [$opal_cv___attribute__may_alias],
|
2008-10-28 20:22:29 +03:00
|
|
|
[Whether your compiler has __attribute__ may_alias or not])
|
2009-05-07 00:11:28 +04:00
|
|
|
AC_DEFINE_UNQUOTED(OPAL_HAVE_ATTRIBUTE_NO_INSTRUMENT_FUNCTION, [$opal_cv___attribute__no_instrument_function],
|
2008-10-28 20:22:29 +03:00
|
|
|
[Whether your compiler has __attribute__ no_instrument_function or not])
|
2009-05-07 00:11:28 +04:00
|
|
|
AC_DEFINE_UNQUOTED(OPAL_HAVE_ATTRIBUTE_NONNULL, [$opal_cv___attribute__nonnull],
|
2008-10-28 20:22:29 +03:00
|
|
|
[Whether your compiler has __attribute__ nonnull or not])
|
2009-05-07 00:11:28 +04:00
|
|
|
AC_DEFINE_UNQUOTED(OPAL_HAVE_ATTRIBUTE_NORETURN, [$opal_cv___attribute__noreturn],
|
2008-10-28 20:22:29 +03:00
|
|
|
[Whether your compiler has __attribute__ noreturn or not])
|
2009-05-07 00:11:28 +04:00
|
|
|
AC_DEFINE_UNQUOTED(OPAL_HAVE_ATTRIBUTE_PACKED, [$opal_cv___attribute__packed],
|
2008-10-28 20:22:29 +03:00
|
|
|
[Whether your compiler has __attribute__ packed or not])
|
2009-05-07 00:11:28 +04:00
|
|
|
AC_DEFINE_UNQUOTED(OPAL_HAVE_ATTRIBUTE_PURE, [$opal_cv___attribute__pure],
|
2008-10-28 20:22:29 +03:00
|
|
|
[Whether your compiler has __attribute__ pure or not])
|
2009-05-07 00:11:28 +04:00
|
|
|
AC_DEFINE_UNQUOTED(OPAL_HAVE_ATTRIBUTE_SENTINEL, [$opal_cv___attribute__sentinel],
|
2008-10-28 20:22:29 +03:00
|
|
|
[Whether your compiler has __attribute__ sentinel or not])
|
2009-05-07 00:11:28 +04:00
|
|
|
AC_DEFINE_UNQUOTED(OPAL_HAVE_ATTRIBUTE_UNUSED, [$opal_cv___attribute__unused],
|
2008-10-28 20:22:29 +03:00
|
|
|
[Whether your compiler has __attribute__ unused or not])
|
2009-05-07 00:11:28 +04:00
|
|
|
AC_DEFINE_UNQUOTED(OPAL_HAVE_ATTRIBUTE_VISIBILITY, [$opal_cv___attribute__visibility],
|
2008-10-28 20:22:29 +03:00
|
|
|
[Whether your compiler has __attribute__ visibility or not])
|
2009-05-07 00:11:28 +04:00
|
|
|
AC_DEFINE_UNQUOTED(OPAL_HAVE_ATTRIBUTE_WARN_UNUSED_RESULT, [$opal_cv___attribute__warn_unused_result],
|
2008-10-28 20:22:29 +03:00
|
|
|
[Whether your compiler has __attribute__ warn unused result or not])
|
2009-05-07 00:11:28 +04:00
|
|
|
AC_DEFINE_UNQUOTED(OPAL_HAVE_ATTRIBUTE_WEAK_ALIAS, [$opal_cv___attribute__weak_alias],
|
2008-10-28 20:22:29 +03:00
|
|
|
[Whether your compiler has __attribute__ weak alias or not])
|
|
|
|
])
|