Skip to content
Browse files

* internal.h, vm_core.h: move LIKELY/UNLIKELY/UNINITIALIZED_VAR()

  macros from vm_core.h to internal.h.
* string.c: remove dependency to "vm_core.h".
* common.mk: ditto.



git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44831 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information...
1 parent 135bbdc commit 1ccaa4756aff30afdaa4f9a565c69722a6f6ebe8 @ko1 ko1 committed
Showing with 31 additions and 23 deletions.
  1. +9 −0 ChangeLog
  2. +1 −1 common.mk
  3. +21 −0 internal.h
  4. +0 −1 string.c
  5. +0 −21 vm_core.h
View
9 ChangeLog
@@ -1,3 +1,12 @@
+Wed Feb 5 13:51:33 2014 Koichi Sasada <ko1@atdot.net>
+
+ * internal.h, vm_core.h: move LIKELY/UNLIKELY/UNINITIALIZED_VAR()
+ macros from vm_core.h to internal.h.
+
+ * string.c: remove dependency to "vm_core.h".
+
+ * common.mk: ditto.
+
Wed Feb 5 13:29:01 2014 Koichi Sasada <ko1@atdot.net>
* string.c (rb_str_free): use FL_TEST(str, STR_SHARED) directly
View
2 common.mk
@@ -751,7 +751,7 @@ st.$(OBJEXT): {$(VPATH)}st.c $(RUBY_H_INCLUDES)
strftime.$(OBJEXT): {$(VPATH)}strftime.c $(RUBY_H_INCLUDES) \
{$(VPATH)}timev.h $(ENCODING_H_INCLUDES)
string.$(OBJEXT): {$(VPATH)}string.c $(RUBY_H_INCLUDES) {$(VPATH)}re.h \
- {$(VPATH)}regex.h $(ENCODING_H_INCLUDES) {$(VPATH)}internal.h $(PROBES_H_INCLUDES) {$(VPATH)}vm_opts.h {$(VPATH)}node.h {$(VPATH)}ruby_atomic.h {$(VPATH)}vm_core.h {$(VPATH)}vm_debug.h {$(VPATH)}id.h {$(VPATH)}method.h {$(VPATH)}thread_$(THREAD_MODEL).h {$(VPATH)}thread_native.h
+ {$(VPATH)}regex.h $(ENCODING_H_INCLUDES) {$(VPATH)}internal.h $(PROBES_H_INCLUDES)
struct.$(OBJEXT): {$(VPATH)}struct.c $(RUBY_H_INCLUDES) {$(VPATH)}internal.h
thread.$(OBJEXT): {$(VPATH)}thread.c {$(VPATH)}eval_intern.h \
$(RUBY_H_INCLUDES) {$(VPATH)}gc.h $(VM_CORE_H_INCLUDES) \
View
21 internal.h
@@ -19,6 +19,27 @@ extern "C" {
#endif
#endif
+/* likely */
+#if __GNUC__ >= 3
+#define LIKELY(x) (__builtin_expect((x), 1))
+#define UNLIKELY(x) (__builtin_expect((x), 0))
+#else /* __GNUC__ >= 3 */
+#define LIKELY(x) (x)
+#define UNLIKELY(x) (x)
+#endif /* __GNUC__ >= 3 */
+
+#ifndef __has_attribute
+# define __has_attribute(x) 0
+#endif
+
+#if __has_attribute(unused)
+#define UNINITIALIZED_VAR(x) x __attribute__((unused))
+#elif defined(__GNUC__) && __GNUC__ >= 3
+#define UNINITIALIZED_VAR(x) x = x
+#else
+#define UNINITIALIZED_VAR(x) x
+#endif
+
#ifdef HAVE_VALGRIND_MEMCHECK_H
# include <valgrind/memcheck.h>
# ifndef VALGRIND_MAKE_MEM_DEFINED
View
1 string.c
@@ -14,7 +14,6 @@
#include "ruby/ruby.h"
#include "ruby/re.h"
#include "ruby/encoding.h"
-#include "vm_core.h"
#include "internal.h"
#include "probes.h"
#include <assert.h>
View
21 vm_core.h
@@ -100,27 +100,6 @@
#endif /* OPT_STACK_CACHING */
#endif /* OPT_CALL_THREADED_CODE */
-/* likely */
-#if __GNUC__ >= 3
-#define LIKELY(x) (__builtin_expect((x), 1))
-#define UNLIKELY(x) (__builtin_expect((x), 0))
-#else /* __GNUC__ >= 3 */
-#define LIKELY(x) (x)
-#define UNLIKELY(x) (x)
-#endif /* __GNUC__ >= 3 */
-
-#ifndef __has_attribute
-# define __has_attribute(x) 0
-#endif
-
-#if __has_attribute(unused)
-#define UNINITIALIZED_VAR(x) x __attribute__((unused))
-#elif defined(__GNUC__) && __GNUC__ >= 3
-#define UNINITIALIZED_VAR(x) x = x
-#else
-#define UNINITIALIZED_VAR(x) x
-#endif
-
typedef unsigned long rb_num_t;
/* iseq data type */

0 comments on commit 1ccaa47

Please sign in to comment.
Something went wrong with that request. Please try again.