Open MPI logo

Hardware Locality Development Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Hardware Locality Development mailing list

Subject: [hwloc-devel] [PATCH] Use plain "inline" in C++
From: Jeff Squyres (jsquyres_at_[hidden])
Date: 2012-05-09 16:59:17


When hwloc.h is included in C++ source, we should just set __hwloc_inline__ to "inline" (not __inline__ or otherwise), because "inline" is part of the C++ language.

We found this in testing OMPI with the Solaris Studio compilers -- their C++ compiler doesn't recognize __inline__. This is a new issue because the OMPI C++ bindings are now including <hwloc.h> (due to some lengthy header dependency chains...).

Samuel -- does this look right to you? If so, I can apply to 1.3, 1.4, and trunk.

Index: include/hwloc/autogen/config.h.in
===================================================================
--- include/hwloc/autogen/config.h.in (revision 26414)
+++ include/hwloc/autogen/config.h.in (working copy)
@@ -2,7 +2,7 @@
  * Copyright © 2009 CNRS
  * Copyright © 2009-2010 inria. All rights reserved.
  * Copyright © 2009-2012 Université Bordeaux 1
- * Copyright © 2009-2011 Cisco Systems, Inc. All rights reserved.
+ * Copyright © 2009-2012 Cisco Systems, Inc. All rights reserved.
  * See COPYING in top-level directory.
  */
 
@@ -21,7 +21,11 @@
 # endif
 #endif
 
-#if defined(_MSC_VER) || defined(__HP_cc)
+/* Note that if we're compiling C++, then just use the "inline"
+ keyword, since it's part of C++ */
+#if defined(c_plusplus) || defined(__cplusplus)
+# define __hwloc_inline inline
+#elif defined(_MSC_VER) || defined(__HP_cc)
 # define __hwloc_inline __inline
 #else
 # define __hwloc_inline __inline__

-- 
Jeff Squyres
jsquyres_at_[hidden]
For corporate legal information go to: http://www.cisco.com/web/about/doing_business/legal/cri/