]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
snprintf_lite.cc (__concat_size_t): Use unsigned long long conditionally.
authorPaul Pluzhnikov <ppluzhnikov@google.com>
Mon, 23 Sep 2013 16:36:11 +0000 (09:36 -0700)
committerPaul Pluzhnikov <ppluzhnikov@gcc.gnu.org>
Mon, 23 Sep 2013 16:36:11 +0000 (09:36 -0700)
2013-09-23  Paul Pluzhnikov  <ppluzhnikov@google.com>

* src/c++11/snprintf_lite.cc (__concat_size_t): Use
unsigned long long conditionally.

From-SVN: r202836

libstdc++-v3/ChangeLog
libstdc++-v3/src/c++11/snprintf_lite.cc

index ab960e7ffeb287f505965e65416e0bdf5cb5032d..8c201f1c3f08dbb101b8166acbf3ef41877cd453 100644 (file)
@@ -1,3 +1,8 @@
+2013-09-23  Paul Pluzhnikov  <ppluzhnikov@google.com>
+
+       * src/c++11/snprintf_lite.cc (__concat_size_t): Use
+       unsigned long long conditionally.
+
 2013-09-23  Paul Pluzhnikov  <ppluzhnikov@google.com>
 
        * src/c++11/snprintf_lite.cc (__concat_size_t): Use only
index 02a818744cb391a49e61c3861a969c349b80702d..1e0ccec813aabc0f0bd160d84ce2f4411a369a65 100644 (file)
@@ -69,11 +69,17 @@ namespace __gnu_cxx {
   // Returns number of characters appended, or -1 if BUFSIZE is too small.
   int __concat_size_t(char *__buf, size_t __bufsize, size_t __val)
   {
+    // __int_to_char is explicitly instantiated and available only for
+    // some, but not all, types. See locale-inst.cc.
+#ifdef _GLIBCXX_USE_LONG_LONG
+    unsigned long long __val2 = __val;
+#else
+    unsigned long __val2 = __val;
+#endif
     // Long enough for decimal representation.
-    unsigned long long __val_ull = __val;
-    int __ilen = 3 * sizeof(__val_ull);
+    int __ilen = 3 * sizeof(__val2);
     char *__cs = static_cast<char*>(__builtin_alloca(__ilen));
-    size_t __len = std::__int_to_char(__cs + __ilen, __val_ull,
+    size_t __len = std::__int_to_char(__cs + __ilen, __val2,
                                      std::__num_base::_S_atoms_out,
                                      std::ios_base::dec, true);
     if (__bufsize < __len)