1
1

- Eliminate icc warning w/ regard to __attribute__((__format__)) on

function pointers... Needed checking in opal_check_attributes.m4

This commit was SVN r21254.
This commit is contained in:
Rainer Keller 2009-05-20 00:39:22 +00:00
parent 7bd97ac17b
commit 5c80033aa2
3 changed files with 47 additions and 5 deletions

View File

@ -26,7 +26,8 @@
AC_DEFUN([_OMPI_ATTRIBUTE_FAIL_SEARCH],[
AC_REQUIRE([AC_PROG_GREP])
if test -s conftest.err ; then
for i in ignore skip ; do
# icc uses 'invalid attribute' and 'attribute "__XXX__" ignored'
for i in invalid ignore skip ; do
$GREP -iq $i conftest.err
if test "$?" = "0" ; then
opal_cv___attribute__[$1]=0
@ -78,7 +79,7 @@ AC_DEFUN([_OMPI_CHECK_SPECIFIC_ATTRIBUTE], [
],[opal_cv___attribute__[$1]=0])
AC_LANG_POP(C++)
fi
#
# If the attribute is supported by both compilers,
# try to recompile a *cross-check*, IFF defined.
@ -189,6 +190,7 @@ AC_DEFUN([OMPI_CHECK_ATTRIBUTES], [
opal_cv___attribute__const=0
opal_cv___attribute__deprecated=0
opal_cv___attribute__format=0
opal_cv___attribute__format_funcptr=0
opal_cv___attribute__hot=0
opal_cv___attribute__malloc=0
opal_cv___attribute__may_alias=0
@ -270,6 +272,32 @@ AC_DEFUN([OMPI_CHECK_ATTRIBUTES], [
],
[$ATTRIBUTE_CFLAGS])
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
_OMPI_CHECK_SPECIFIC_ATTRIBUTE([format_funcptr],
[
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])
_OMPI_CHECK_SPECIFIC_ATTRIBUTE([hot],
[
int foo(int arg1, int arg2) __attribute__ ((__hot__));
@ -488,6 +516,8 @@ AC_DEFUN([OMPI_CHECK_ATTRIBUTES], [
[Whether your compiler has __attribute__ deprecated or not])
AC_DEFINE_UNQUOTED(OPAL_HAVE_ATTRIBUTE_FORMAT, [$opal_cv___attribute__format],
[Whether your compiler has __attribute__ format or not])
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])
AC_DEFINE_UNQUOTED(OPAL_HAVE_ATTRIBUTE_HOT, [$opal_cv___attribute__hot],
[Whether your compiler has __attribute__ hot or not])
AC_DEFINE_UNQUOTED(OPAL_HAVE_ATTRIBUTE_MALLOC, [$opal_cv___attribute__malloc],

View File

@ -130,7 +130,11 @@ typedef int (*orte_errmgr_base_module_register_cb_fn_t)(orte_jobid_t job,
* itself, and then exit - it takes no other actions. The intent here is to provide
* a last-ditch exit procedure that attempts to clean up a little.
*/
typedef void (*orte_errmgr_base_module_abort_fn_t)(int error_code, char *fmt, ...) __opal_attribute_noreturn__ __opal_attribute_format__(__printf__, 2, 3);
typedef void (*orte_errmgr_base_module_abort_fn_t)(int error_code, char *fmt, ...) __opal_attribute_noreturn__
# if OPAL_HAVE_ATTRIBUTE_FORMAT_FUNCPTR
__opal_attribute_format__(__printf__, 2, 3);
# endif
;
/*
*

View File

@ -70,13 +70,21 @@ typedef int (*orte_notifier_base_module_init_fn_t)(void);
typedef void (*orte_notifier_base_module_finalize_fn_t)(void);
/* Log a failure message */
typedef void (*orte_notifier_base_module_log_fn_t)(int severity, int errcode, const char *msg, ...) __opal_attribute_format__(__printf__, 3, 4);
typedef void (*orte_notifier_base_module_log_fn_t)(int severity, int errcode, const char *msg, ...)
# if OPAL_HAVE_ATTRIBUTE_FORMAT_FUNCPTR
__opal_attribute_format__(__printf__, 3, 4)
# endif
;
/* Log a failure that is based upon a show_help message */
typedef void (*orte_notifier_base_module_log_show_help_fn_t)(int severity, int errcode, const char *file, const char *topic, ...);
/* Log a failure related to a peer */
typedef void (*orte_notifier_base_module_log_peer_fn_t)(int severity, int errcode, orte_process_name_t *peer_proc, const char *msg, ...) __opal_attribute_format__(__printf__, 4, 5);
typedef void (*orte_notifier_base_module_log_peer_fn_t)(int severity, int errcode, orte_process_name_t *peer_proc, const char *msg, ...)
# if OPAL_HAVE_ATTRIBUTE_FORMAT_FUNCPTR
__opal_attribute_format__(__printf__, 4, 5)
# endif
;
/*
* Ver 1.0