Author: sebor
Date: Fri Oct 14 12:02:01 2005
New Revision: 321182
URL: http://svn.apache.org/viewcvs?rev=321182&view=rev
Log:
2005-10-14 Martin Sebor <[EMAIL PROTECTED]>
STDCXX-46
* DIV_OVERLOADS.cpp: New config test to determine the presence
of the C++ overloads of the div() function in <stdlib.h> and
the rest of the C standard library headers.
Added:
incubator/stdcxx/trunk/etc/config/src/DIV_OVERLOADS.cpp (with props)
Added: incubator/stdcxx/trunk/etc/config/src/DIV_OVERLOADS.cpp
URL:
http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/etc/config/src/DIV_OVERLOADS.cpp?rev=321182&view=auto
==============================================================================
--- incubator/stdcxx/trunk/etc/config/src/DIV_OVERLOADS.cpp (added)
+++ incubator/stdcxx/trunk/etc/config/src/DIV_OVERLOADS.cpp Fri Oct 14 12:02:01
2005
@@ -0,0 +1,62 @@
+// checking for overloads of div()
+
+// determine whether the div() function (including
+// any overloads) is defined in the usual libc headers
+
+#include <math.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#if defined (_RWSTD_USE_CONFIG)
+# include "config.h"
+#endif // _RWSTD_USE_CONFIG
+
+#ifndef _RWSTD_NO_LONG_LONG
+# if defined _MSC_VER
+# define LONG_LONG __int64
+# else
+# define LONG_LONG long long
+# endif
+#endif // _RWSTD_NO_LONG_LONG
+
+
+int template_used;
+
+template <class T>
+ldiv_t div (T, T)
+{
+ ++template_used;
+
+ return ldiv_t ();
+}
+
+template <class T>
+void check_div (T t, const char *tname)
+{
+ template_used = 0;
+
+ div (t, t);
+
+ if (0 == template_used)
+ printf ("%s", "// ");
+
+ printf ("#define _RWSTD_NO_DIV_%s\n", tname);
+}
+
+int main ()
+{
+#if !defined (_RWSTD_USE_CONFIG)
+
+ printf ("/**/\n#undef _RWSTD_DIV_OVERLOADS\n");
+
+#endif // _RWSTD_USE_CONFIG
+
+ check_div ((int)0, "INT");
+ check_div ((long)0, "LONG");
+
+#if defined (LONG_LONG)
+ check_div ((LONG_LONG)0, "LLONG");
+#endif // LONG_LONG
+
+ return 0;
+}
Propchange: incubator/stdcxx/trunk/etc/config/src/DIV_OVERLOADS.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: incubator/stdcxx/trunk/etc/config/src/DIV_OVERLOADS.cpp
------------------------------------------------------------------------------
svn:keywords = Id