The function has to be marked inline which wasn't the case if STRICT_ANSI.
Compile tested with GCC 4.9 and 5.2, Intel 15.0 and clang 3.8.0 (from trunk). Now builds completely warning free in the default configuration.
Differential D12403
Fix GCC warning 'always_inline function might not be inlinable' Hahnfeld on Aug 27 2015, 4:07 AM. Authored by
Details
The function has to be marked inline which wasn't the case if STRICT_ANSI. Compile tested with GCC 4.9 and 5.2, Intel 15.0 and clang 3.8.0 (from trunk). Now builds completely warning free in the default configuration.
Diff Detail
Event TimelineComment Actions Jonas, I talked to the authors of this code (Intel Tools team) and they suggested to fix the problem in a slightly different way. Could you please check if the following diff solves it? And if yes, I would prefer we follow their change, so that we are in sync with other places (repositories) with ittnotify sources. Thanks, Andrey Index: runtime/src/thirdparty/ittnotify/ittnotify.h =================================================================== --- runtime/src/thirdparty/ittnotify/ittnotify.h (revision 246303) +++ runtime/src/thirdparty/ittnotify/ittnotify.h (working copy) @@ -179,10 +179,11 @@ */ #ifdef __STRICT_ANSI__ #define ITT_INLINE static +#define ITT_INLINE_ATTRIBUTE __attribute__((unused)) #else /* __STRICT_ANSI__ */ #define ITT_INLINE static inline +#define ITT_INLINE_ATTRIBUTE __attribute__((always_inline, unused)) #endif /* __STRICT_ANSI__ */ -#define ITT_INLINE_ATTRIBUTE __attribute__ ((always_inline, unused)) #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ /** @endcond */ Index: runtime/src/thirdparty/ittnotify/ittnotify_config.h =================================================================== --- runtime/src/thirdparty/ittnotify/ittnotify_config.h (revision 246303) +++ runtime/src/thirdparty/ittnotify/ittnotify_config.h (working copy) @@ -113,10 +113,11 @@ */ #ifdef __STRICT_ANSI__ #define ITT_INLINE static +#define ITT_INLINE_ATTRIBUTE __attribute__((unused)) #else /* __STRICT_ANSI__ */ #define ITT_INLINE static inline +#define ITT_INLINE_ATTRIBUTE __attribute__((always_inline, unused)) #endif /* __STRICT_ANSI__ */ -#define ITT_INLINE_ATTRIBUTE __attribute__ ((always_inline, unused)) #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ /** @endcond */ Index: runtime/src/thirdparty/ittnotify/legacy/ittnotify.h =================================================================== --- runtime/src/thirdparty/ittnotify/legacy/ittnotify.h (revision 246303) +++ runtime/src/thirdparty/ittnotify/legacy/ittnotify.h (working copy) @@ -118,10 +118,11 @@ */ #ifdef __STRICT_ANSI__ #define ITT_INLINE static +#define ITT_INLINE_ATTRIBUTE __attribute__((unused)) #else /* __STRICT_ANSI__ */ #define ITT_INLINE static inline +#define ITT_INLINE_ATTRIBUTE __attribute__((always_inline, unused)) #endif /* __STRICT_ANSI__ */ -#define ITT_INLINE_ATTRIBUTE __attribute__ ((always_inline, unused)) #endif /* ITT_PLATFORM==ITT_PLATFORM_WIN */ /** @endcond */ Comment Actions It works and I'm fine with this as well although I don't really understand why there shouldn't be inlining with __STRICT_ANSI__ being defined... Thanks, Comment Actions Jonas,
The GCC documentation for -ansi option says that "For the C compiler, it disables recognition of C++ style ‘//’ comments as well as the inline keyword." So the way it is written now there may be problems with C compilation with -ansi option. The ittnotify team told me they had complaints from at least two customers about the inline keyword while -ansi used, so it is better to avoid using it. Thanks, Comment Actions Thanks for this explanation. Then your diff is without doubt preferable and LGTM. Greetings, |