From 94a6e02b3dfde5a226b124177c33526080d6bb86 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Sat, 18 Jul 2015 00:40:06 -0500 Subject: [svn-r27407] Updated the H5_ATTR_* macros. - Updated the preprocessor logic that defines the H5_ATTR_* macros. The Solaris Studio compiler understands __attribute__ but not the specific attributes that we use. The H5_ATTR_* macros are now defined as blank with that compiler which significantly cleans up the warnings, making debugging easier. - Replaced a few lingering __attribute__ macros with H5_ATTR_* markup. Tested on: h5committest Solaris w/ Solaris Studio (emu) --- src/H5Eprivate.h | 2 +- src/H5api_adpt.h | 5 ++++- test/h5test.h | 2 +- tools/perform/chunk.c | 4 ++-- tools/perform/overhead.c | 3 ++- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/H5Eprivate.h b/src/H5Eprivate.h index 2065b08..ba17ada 100644 --- a/src/H5Eprivate.h +++ b/src/H5Eprivate.h @@ -186,7 +186,7 @@ H5_DLL herr_t H5E_init(void); H5_DLL herr_t H5E_push_stack(H5E_t *estack, const char *file, const char *func, unsigned line, hid_t cls_id, hid_t maj_id, hid_t min_id, const char *desc); H5_DLL herr_t H5E_printf_stack(H5E_t *estack, const char *file, const char *func, - unsigned line, hid_t cls_id, hid_t maj_id, hid_t min_id, const char *fmt, ...)__attribute__((format (printf, 8, 9))); + unsigned line, hid_t cls_id, hid_t maj_id, hid_t min_id, const char *fmt, ...)H5_ATTR_FORMAT(printf, 8, 9); H5_DLL herr_t H5E_clear_stack(H5E_t *estack); H5_DLL herr_t H5E_dump_api_stack(hbool_t is_api); diff --git a/src/H5api_adpt.h b/src/H5api_adpt.h index 52167d0..74066f7 100644 --- a/src/H5api_adpt.h +++ b/src/H5api_adpt.h @@ -24,13 +24,16 @@ /* * Does the compiler support the __attribute__(()) syntax? It's no * big deal if we don't. + * + * Note that Solaris Studio supports attribute, but does not support the + * attributes we use. */ #ifdef __cplusplus # define H5_ATTR_FORMAT(X,Y,Z) /*void*/ # define H5_ATTR_UNUSED /*void*/ # define H5_ATTR_NORETURN /*void*/ #else /* __cplusplus */ -#ifdef H5_HAVE_ATTRIBUTE +#if defined(H5_HAVE_ATTRIBUTE) && !defined(__SUNPRO_C) # define H5_ATTR_FORMAT(X,Y,Z) __attribute__((format(X, Y, Z))) # define H5_ATTR_UNUSED __attribute__((unused)) # define H5_ATTR_NORETURN __attribute__((noreturn)) diff --git a/test/h5test.h b/test/h5test.h index fa0c11b..5b203c6 100644 --- a/test/h5test.h +++ b/test/h5test.h @@ -158,7 +158,7 @@ H5TEST_DLL void ParseTestVerbosity(char *argv); H5TEST_DLL int GetTestNumErrs(void); H5TEST_DLL void IncTestNumErrs(void); H5TEST_DLL const void *GetTestParameters(void); -H5TEST_DLL int TestErrPrintf(const char *format, ...) __attribute__ ((format (printf, 1, 2))); +H5TEST_DLL int TestErrPrintf(const char *format, ...) H5_ATTR_FORMAT(printf, 1, 2); H5TEST_DLL void SetTest(const char *testname, int action); H5TEST_DLL void TestAlarmOn(void); H5TEST_DLL void TestAlarmOff(void); diff --git a/tools/perform/chunk.c b/tools/perform/chunk.c index 625809a..74bcc46 100644 --- a/tools/perform/chunk.c +++ b/tools/perform/chunk.c @@ -33,8 +33,8 @@ # include #endif - -#if !defined(H5_HAVE_ATTRIBUTE) || defined __cplusplus +/* Solaris Studio defines attribute, but for the attributes we need */ +#if !defined(H5_HAVE_ATTRIBUTE) || defined __cplusplus || defined(__SUNPRO_C) # undef __attribute__ # define __attribute__(X) /*void*/ # define H5_ATTR_UNUSED /*void*/ diff --git a/tools/perform/overhead.c b/tools/perform/overhead.c index 0e9166c..0288ffa 100644 --- a/tools/perform/overhead.c +++ b/tools/perform/overhead.c @@ -46,7 +46,8 @@ # include #endif -#ifndef H5_HAVE_ATTRIBUTE +/* Solaris Studio defines attribute, but for the attributes we need */ +#if !defined(H5_HAVE_ATTRIBUTE) || defined __cplusplus || defined(__SUNPRO_C) # undef __attribute__ # define __attribute__(X) /*void*/ # define H5_ATTR_UNUSED /*void*/ -- cgit v0.12