[m-rev.] diff: fix a build problem on Mac OS X
Julien Fischer
jfischer at opturion.com
Tue Mar 26 13:07:19 AEDT 2013
Fix a build problem on Mac OS X.
library/int.m:
LLONG_{MIN,MAX} are the standard (C99) names for the limits
of the long long int type; use them in preference to LONG_LONG_{MIN,MAX},
which are a GNU C thing.
Make the use of the above macros conditional on them actually being
defined since we cannot guarantee that they will be defined if the
C compiler is not in C99 mode (or something similar to it).
Julien.
diff --git a/library/int.m b/library/int.m
index d3f5a7c..2530b70 100644
--- a/library/int.m
+++ b/library/int.m
@@ -671,8 +671,10 @@ int.max_int = X :-
Max = INT_MAX;
} else if (sizeof(MR_Integer) == sizeof(long)) {
Max = LONG_MAX;
+ #if defined(LLONG_MAX)
} else if (sizeof(MR_Integer) == sizeof(long long)) {
- Max = LONG_LONG_MAX;
+ Max = LLONG_MAX;
+ #endif
} else {
MR_fatal_error(""Unable to figure out max integer size"");
}
@@ -690,8 +692,10 @@ int.min_int = X :-
Min = INT_MIN;
} else if (sizeof(MR_Integer) == sizeof(long)) {
Min = LONG_MIN;
+ #if defined(LLONG_MIN)
} else if (sizeof(MR_Integer) == sizeof(long long)) {
- Min = LONG_LONG_MIN;
+ Min = LLONG_MIN;
+ #endif
} else {
MR_fatal_error(""Unable to figure out min integer size"");
}
More information about the reviews
mailing list