summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2018-12-23 22:18:07 +0900
committerGitHub <[email protected]>2018-12-23 22:18:07 +0900
commit2fbea74de5bdda32cdc99f8336fc3296e2c3b933 (patch)
treeec681815d3f3cdbe5646cb711021b44bddbbd7e6
parentf6c07b883550b4e78e0922eec08458307d623b8c (diff)
parent0bfeefad2ab4094ce0ff2cf38a17c8a256e121d6 (diff)
downloadmruby-2fbea74de5bdda32cdc99f8336fc3296e2c3b933.tar.gz
mruby-2fbea74de5bdda32cdc99f8336fc3296e2c3b933.zip
Merge pull request #4198 from dearblue/missing-macros
Suppress missing macro warns
-rw-r--r--include/mruby.h2
-rw-r--r--include/mruby/common.h2
-rw-r--r--mrbgems/mruby-io/src/io.c8
-rw-r--r--mrbgems/mruby-math/src/math.c4
-rw-r--r--mrbgems/mruby-time/src/time.c2
5 files changed, 11 insertions, 7 deletions
diff --git a/include/mruby.h b/include/mruby.h
index 171f47126..8c8360784 100644
--- a/include/mruby.h
+++ b/include/mruby.h
@@ -57,7 +57,7 @@
#define mrb_assert_int_fit(t1,n,t2,max) ((void)0)
#endif
-#if __STDC_VERSION__ >= 201112L
+#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 201112L
#define mrb_static_assert(exp, str) _Static_assert(exp, str)
#else
#define mrb_static_assert(exp, str) mrb_assert(exp)
diff --git a/include/mruby/common.h b/include/mruby/common.h
index 4c7d9384a..4eaac9af7 100644
--- a/include/mruby/common.h
+++ b/include/mruby/common.h
@@ -34,7 +34,7 @@
MRB_BEGIN_DECL
/** Declare a function that never returns. */
-#if __STDC_VERSION__ >= 201112L
+#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 201112L
# define mrb_noreturn _Noreturn
#elif defined __GNUC__ && !defined __STRICT_ANSI__
# define mrb_noreturn __attribute__((noreturn))
diff --git a/mrbgems/mruby-io/src/io.c b/mrbgems/mruby-io/src/io.c
index 1ac15aab3..e5b83e923 100644
--- a/mrbgems/mruby-io/src/io.c
+++ b/mrbgems/mruby-io/src/io.c
@@ -209,7 +209,7 @@ mrb_fd_cloexec(mrb_state *mrb, int fd)
#endif
}
-#if !defined(_WIN32) && !TARGET_OS_IPHONE
+#if !defined(_WIN32) && !(defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE)
static int
mrb_cloexec_pipe(mrb_state *mrb, int fildes[2])
{
@@ -403,7 +403,7 @@ mrb_io_s_popen(mrb_state *mrb, mrb_value klass)
DATA_PTR(io) = fptr;
return io;
}
-#elif TARGET_OS_IPHONE
+#elif defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE
mrb_value
mrb_io_s_popen(mrb_state *mrb, mrb_value klass)
{
@@ -1011,7 +1011,7 @@ mrb_io_read_data_pending(mrb_state *mrb, mrb_value io)
return 0;
}
-#if !defined(_WIN32) && !TARGET_OS_IPHONE
+#if !defined(_WIN32) && !(defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE)
static mrb_value
mrb_io_s_pipe(mrb_state *mrb, mrb_value klass)
{
@@ -1313,7 +1313,7 @@ mrb_init_io(mrb_state *mrb)
mrb_define_class_method(mrb, io, "for_fd", mrb_io_s_for_fd, MRB_ARGS_ANY());
mrb_define_class_method(mrb, io, "select", mrb_io_s_select, MRB_ARGS_ANY());
mrb_define_class_method(mrb, io, "sysopen", mrb_io_s_sysopen, MRB_ARGS_ANY());
-#if !defined(_WIN32) && !TARGET_OS_IPHONE
+#if !defined(_WIN32) && !(defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE)
mrb_define_class_method(mrb, io, "_pipe", mrb_io_s_pipe, MRB_ARGS_NONE());
#endif
diff --git a/mrbgems/mruby-math/src/math.c b/mrbgems/mruby-math/src/math.c
index c182debea..c29ba6808 100644
--- a/mrbgems/mruby-math/src/math.c
+++ b/mrbgems/mruby-math/src/math.c
@@ -161,6 +161,10 @@ erfc(double x)
#endif
+#if defined __FreeBSD__ && !defined __FreeBSD_version
+#include <osreldate.h> /* for __FreeBSD_version */
+#endif
+
#if (defined _MSC_VER && _MSC_VER < 1800) || defined __ANDROID__ || (defined __FreeBSD__ && __FreeBSD_version < 803000)
double
diff --git a/mrbgems/mruby-time/src/time.c b/mrbgems/mruby-time/src/time.c
index 4217b897f..2f79617ac 100644
--- a/mrbgems/mruby-time/src/time.c
+++ b/mrbgems/mruby-time/src/time.c
@@ -46,7 +46,7 @@ double round(double x) {
/* #define NO_GMTIME_R */
#ifdef _WIN32
-#if _MSC_VER
+#ifdef _MSC_VER
/* Win32 platform do not provide gmtime_r/localtime_r; emulate them using gmtime_s/localtime_s */
#define gmtime_r(tp, tm) ((gmtime_s((tm), (tp)) == 0) ? (tm) : NULL)
#define localtime_r(tp, tm) ((localtime_s((tm), (tp)) == 0) ? (tm) : NULL)