From 17c3d539f008c3ad4179e520511b6a64fb4ba969 Mon Sep 17 00:00:00 2001 From: matz Date: Mon, 31 Jul 2006 06:34:10 +0000 Subject: [PATCH] * ruby.h: use ifdef (or defined) for macro constants that may or may not be defined to shut up gcc's -Wundef warnings. [ruby-core:08447] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@10648 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 6 ++++++ eval.c | 2 +- io.c | 2 +- lib/readbytes.rb | 5 +++++ lib/weakref.rb | 18 ++++++++++++++---- ruby.h | 8 ++++---- st.c | 2 +- string.c | 4 ++-- 8 files changed, 34 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index a110268414..2ca4d6e166 100644 --- a/ChangeLog +++ b/ChangeLog @@ -3,6 +3,12 @@ Mon Jul 31 13:38:22 2006 GOTOU Yuuzou * lib/webrick/httprequest.rb (WEBrick::HTTPReuqest#parse_uri): improve for the value of IPv6 address in the Host: header field. +Mon Jul 31 09:22:12 2006 Yukihiro Matsumoto + + * ruby.h: use ifdef (or defined) for macro constants that may or + may not be defined to shut up gcc's -Wundef warnings. + [ruby-core:08447] + Sun Jul 30 23:26:22 2006 Nobuyoshi Nakada * eval.c (rb_call0): trace call/return of method defined from block. diff --git a/eval.c b/eval.c index 60d2b46a3c..d00891aa13 100644 --- a/eval.c +++ b/eval.c @@ -10296,7 +10296,7 @@ rb_thread_switch(n) NORETURN(static void rb_thread_restore_context _((rb_thread_t,int))); -# if _MSC_VER >= 1300 +# if defined(_MSC_VER) && _MSC_VER >= 1300 __declspec(noinline) static void stack_extend(rb_thread_t, int); # endif static void diff --git a/io.c b/io.c index 1d34632e3b..d454d33edd 100644 --- a/io.c +++ b/io.c @@ -267,7 +267,7 @@ rb_io_check_readable(fptr) if (!(fptr->mode & FMODE_READABLE)) { rb_raise(rb_eIOError, "not opened for reading"); } -#if NEED_IO_SEEK_BETWEEN_RW +#ifdef NEED_IO_SEEK_BETWEEN_RW if (((fptr->mode & FMODE_WBUF) || (fptr->mode & (FMODE_SYNCWRITE|FMODE_RBUF)) == FMODE_SYNCWRITE) && !feof(fptr->f) && diff --git a/lib/readbytes.rb b/lib/readbytes.rb index d6a3b10afe..08b92da73c 100644 --- a/lib/readbytes.rb +++ b/lib/readbytes.rb @@ -12,6 +12,11 @@ class TruncatedDataError SIZEOF_LONG +#if defined(HAVE_LONG_LONG) && SIZEOF_OFF_T > SIZEOF_LONG # define NUM2OFFT(x) ((off_t)NUM2LL(x)) #else # define NUM2OFFT(x) NUM2LONG(x) diff --git a/st.c b/st.c index ced1f9196a..c16c3109a8 100644 --- a/st.c +++ b/st.c @@ -537,7 +537,7 @@ strhash(string) h &= ~g; } return h; -#elif HASH_PERL +#elif defined(HASH_PERL) register int val = 0; while ((c = *string++) != '\0') { diff --git a/string.c b/string.c index fb8be9dca4..83ac1e486c 100644 --- a/string.c +++ b/string.c @@ -856,7 +856,7 @@ rb_str_hash(str) register char *p = RSTRING(str)->ptr; register int key = 0; -#ifdef HASH_ELFHASH +#if defined(HASH_ELFHASH) register unsigned int g; while (len--) { @@ -865,7 +865,7 @@ rb_str_hash(str) key ^= g >> 24; key &= ~g; } -#elif HASH_PERL +#elif defined(HASH_PERL) while (len--) { key += *p++; key += (key << 10);