Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(955)

Unified Diff: ppapi/c/pp_macros.h

Issue 4310002: Make PPAPI headers compile with C compilers (gcc on Linux & Mac and MSVS on W... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ppapi/c/pp_input_event.h ('k') | ppapi/c/pp_point.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/c/pp_macros.h
===================================================================
--- ppapi/c/pp_macros.h (revision 0)
+++ ppapi/c/pp_macros.h (revision 0)
@@ -0,0 +1,46 @@
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef PPAPI_C_PP_MACROS_H_
+#define PPAPI_C_PP_MACROS_H_
+
+/**
+ * @file
+ * Defines the API ...
+ *
+ * @addtogroup PP
+ * @{
+ */
+
+/* Use PP_INLINE to tell the compiler to inline functions. The main purpose of
+ * inline functions in ppapi is to allow us to define convenience functions in
+ * the ppapi header files, without requiring clients or implementers to link a
+ * PPAPI C library. The "inline" keyword is not supported by pre-C99 C
+ * compilers (such as MS Visual Studio 2008 and older versions of GCC). MSVS
+ * supports __forceinline and GCC supports __inline__. Use of the static
+ * keyword ensures (in C) that the function is not compiled on its own, which
+ * could cause multiple definition errors.
+ * http://msdn.microsoft.com/en-us/library/z8y1yy88.aspx
+ * http://gcc.gnu.org/onlinedocs/gcc/Inline.html
+ */
+#if defined(__cplusplus)
+/* The inline keyword is part of C++ and guarantees we won't get multiple
+ * definition errors.
+ */
+# define PP_INLINE inline
+#else
+# if defined(_MSC_VER)
+# define PP_INLINE static __forceinline
+# else
+# define PP_INLINE static __inline__
+# endif
+#endif
+
+/**
+ * @}
+ * End of addtogroup PP
+ */
+
+#endif // PPAPI_C_PP_MACROS_H_
+
Property changes on: ppapi/c/pp_macros.h
___________________________________________________________________
Added: svn:eol-style
+ LF
« no previous file with comments | « ppapi/c/pp_input_event.h ('k') | ppapi/c/pp_point.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698