[Openmp-commits] [openmp] r239184 - Fix extern warnings produced by ittnotify_static.c
Jonathan Peyton
jonathan.l.peyton at intel.com
Fri Jun 5 13:24:13 PDT 2015
Author: jlpeyton
Date: Fri Jun 5 15:24:13 2015
New Revision: 239184
URL: http://llvm.org/viewvc/llvm-project?rev=239184&view=rev
Log:
Fix extern warnings produced by ittnotify_static.c
when compiling with gcc or clang numerous warnings concerning the usage
of extern "C" linkage. All the __kmp_itt_sync* variables are declared
like: extern "C" type __kmp_itt_sync... = definition; through various macros.
This note from cppreference.com explains why this is a problem.
// From http://en.cppreference.com/w/cpp/language/language_linkage
extern "C" int x; // a declaration and not a definition
// The above line is equivalent to extern "C" { extern int x; }
extern "C" { int x; } // a declaration and definition
Since the __kmp_itt_* variables are being declared and defined, these variables
should use the bracketed version instead.
Modified:
openmp/trunk/runtime/src/thirdparty/ittnotify/ittnotify_config.h
openmp/trunk/runtime/src/thirdparty/ittnotify/ittnotify_static.c
Modified: openmp/trunk/runtime/src/thirdparty/ittnotify/ittnotify_config.h
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/thirdparty/ittnotify/ittnotify_config.h?rev=239184&r1=239183&r2=239184&view=diff
==============================================================================
--- openmp/trunk/runtime/src/thirdparty/ittnotify/ittnotify_config.h (original)
+++ openmp/trunk/runtime/src/thirdparty/ittnotify/ittnotify_config.h Fri Jun 5 15:24:13 2015
@@ -160,8 +160,12 @@
#ifdef __cplusplus
# define ITT_EXTERN_C extern "C"
+# define ITT_EXTERN_C_BEGIN extern "C" {
+# define ITT_EXTERN_C_END }
#else
# define ITT_EXTERN_C /* nothing */
+# define ITT_EXTERN_C_BEGIN /* nothing */
+# define ITT_EXTERN_C_END /* nothing */
#endif /* __cplusplus */
#define ITT_TO_STR_AUX(x) #x
Modified: openmp/trunk/runtime/src/thirdparty/ittnotify/ittnotify_static.c
URL: http://llvm.org/viewvc/llvm-project/openmp/trunk/runtime/src/thirdparty/ittnotify/ittnotify_static.c?rev=239184&r1=239183&r2=239184&view=diff
==============================================================================
--- openmp/trunk/runtime/src/thirdparty/ittnotify/ittnotify_static.c (original)
+++ openmp/trunk/runtime/src/thirdparty/ittnotify/ittnotify_static.c Fri Jun 5 15:24:13 2015
@@ -119,7 +119,7 @@ static __itt_fini_ittlib_t* __itt_fini_i
#define ITT_STUB(api,type,name,args,params,ptr,group,format) \
static type api ITT_VERSIONIZE(ITT_JOIN(_N_(name),_init)) args;\
typedef type api ITT_JOIN(_N_(name),_t) args; \
-ITT_EXTERN_C ITT_JOIN(_N_(name),_t)* ITTNOTIFY_NAME(name) = ITT_VERSIONIZE(ITT_JOIN(_N_(name),_init)); \
+ITT_EXTERN_C_BEGIN ITT_JOIN(_N_(name),_t)* ITTNOTIFY_NAME(name) = ITT_VERSIONIZE(ITT_JOIN(_N_(name),_init)); ITT_EXTERN_C_END \
static type api ITT_VERSIONIZE(ITT_JOIN(_N_(name),_init)) args \
{ \
__itt_init_ittlib_name(NULL, __itt_group_all); \
@@ -132,7 +132,7 @@ static type api ITT_VERSIONIZE(ITT_JOIN(
#define ITT_STUBV(api,type,name,args,params,ptr,group,format) \
static type api ITT_VERSIONIZE(ITT_JOIN(_N_(name),_init)) args;\
typedef type api ITT_JOIN(_N_(name),_t) args; \
-ITT_EXTERN_C ITT_JOIN(_N_(name),_t)* ITTNOTIFY_NAME(name) = ITT_VERSIONIZE(ITT_JOIN(_N_(name),_init)); \
+ITT_EXTERN_C_BEGIN ITT_JOIN(_N_(name),_t)* ITTNOTIFY_NAME(name) = ITT_VERSIONIZE(ITT_JOIN(_N_(name),_init)); ITT_EXTERN_C_END \
static type api ITT_VERSIONIZE(ITT_JOIN(_N_(name),_init)) args \
{ \
__itt_init_ittlib_name(NULL, __itt_group_all); \
@@ -150,12 +150,12 @@ static type api ITT_VERSIONIZE(ITT_JOIN(
#define ITT_STUB(api,type,name,args,params,ptr,group,format) \
static type api ITT_VERSIONIZE(ITT_JOIN(_N_(name),_init)) args;\
typedef type api ITT_JOIN(_N_(name),_t) args; \
-ITT_EXTERN_C ITT_JOIN(_N_(name),_t)* ITTNOTIFY_NAME(name) = ITT_VERSIONIZE(ITT_JOIN(_N_(name),_init));
+ITT_EXTERN_C_BEGIN ITT_JOIN(_N_(name),_t)* ITTNOTIFY_NAME(name) = ITT_VERSIONIZE(ITT_JOIN(_N_(name),_init)); ITT_EXTERN_C_END
#define ITT_STUBV(api,type,name,args,params,ptr,group,format) \
static type api ITT_VERSIONIZE(ITT_JOIN(_N_(name),_init)) args;\
typedef type api ITT_JOIN(_N_(name),_t) args; \
-ITT_EXTERN_C ITT_JOIN(_N_(name),_t)* ITTNOTIFY_NAME(name) = ITT_VERSIONIZE(ITT_JOIN(_N_(name),_init));
+ITT_EXTERN_C_BEGIN ITT_JOIN(_N_(name),_t)* ITTNOTIFY_NAME(name) = ITT_VERSIONIZE(ITT_JOIN(_N_(name),_init)); ITT_EXTERN_C_END
#define __ITT_INTERNAL_INIT
#include "ittnotify_static.h"
More information about the Openmp-commits
mailing list