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

Unified Diff: native_client_sdk/src/libraries/sdk_util/macros.h

Issue 16325024: Move thread_pool.h into utils so it can be shared by more than one example. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 6 months 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
Index: native_client_sdk/src/libraries/sdk_util/macros.h
===================================================================
--- native_client_sdk/src/libraries/sdk_util/macros.h (revision 0)
+++ native_client_sdk/src/libraries/sdk_util/macros.h (revision 0)
@@ -0,0 +1,50 @@
+/* Copyright (c) 2012 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 LIBRARIES_SDK_UTIL_MACROS_H_
+#define LIBRARIES_SDK_UTIL_MACROS_H_
+
+/**
+ * A macro to disallow the evil copy constructor and operator= functions
+ * This should be used in the private: declarations for a class.
+ */
+#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
+ TypeName(const TypeName&); \
+ void operator=(const TypeName&)
+
+/** returns the size of a member of a struct. */
+#define MEMBER_SIZE(struct_name, member) sizeof(((struct_name*)0)->member)
+
+/**
+ * Macros to prevent name mangling of definitions, allowing them to be
+ * referenced from C.
+ */
+#ifdef __cplusplus
+# define EXTERN_C_BEGIN extern "C" {
+# define EXTERN_C_END }
+#else
+# define EXTERN_C_BEGIN
+# define EXTERN_C_END
+#endif /* __cplusplus */
+
+/**
+ * Macros to help force linkage of symbols that otherwise would not be
+ * included.
+ *
+ * // In a source file that you want to force linkage (file scope):
+ * FORCE_LINK_THIS(myfilename);
+ *
+ * // In a source file that you are sure will be linked (file scope):
+ * FORCE_LINK_THAT(myfilename)
+ *
+ */
+#define FORCE_LINK_THIS(x) int force_link_##x = 0;
+#define FORCE_LINK_THAT(x) \
+ void force_link_function_##x() { \
+ extern int force_link_##x; \
+ force_link_##x = 1; \
+ }
+
+#endif /* LIBRARIES_SDK_UTIL_MACROS_H_ */
+
Property changes on: native_client_sdk/src/libraries/sdk_util/macros.h
___________________________________________________________________
Added: svn:eol-style
+ LF
« no previous file with comments | « native_client_sdk/src/libraries/sdk_util/library.dsc ('k') | native_client_sdk/src/libraries/sdk_util/ref_object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698