]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fix build with GCC 4.7 (and probably other C++11 compilers).
authorDmitry Kurochkin <dmitry.kurochkin@measurement-factory.com>
Sun, 23 Sep 2012 06:30:14 +0000 (00:30 -0600)
committerAmos Jeffries <squid3@treenet.co.nz>
Sun, 23 Sep 2012 06:30:14 +0000 (00:30 -0600)
User-defined literals introduced by C++11 break some previously valid
code, resulting in errors when building with GCC v4.7. For example:

  error: unable to find string literal operator 'operator"" PRIu64'

In particular, whitespace is now needed after a string literal and
before something that could be a valid user-defined literal.  See
"User-defined literals and whitespace" section at [1] for more details.

The patch adds spaces between string literals and macros.

[1] http://gcc.gnu.org/gcc-4.7/porting_to.html

18 files changed:
src/BodyPipe.cc
src/DelaySpec.cc
src/DiskIO/DiskDaemon/diskd.cc
src/HttpHdrContRange.cc
src/HttpHdrRange.cc
src/MemObject.cc
src/SwapDir.cc
src/access_log.cc
src/cache_cf.cc
src/fde.cc
src/fs/coss/store_dir_coss.cc
src/fs/ufs/store_dir_ufs.cc
src/ftp.cc
src/stat.cc
src/store_client.cc
src/store_dir.cc
src/store_log.cc
src/tools.cc

index 417e1bbd4b19059af0c6253e37586857000b6850..34060eb262d25063080f1043fcdf5540b5b1b257 100644 (file)
@@ -423,9 +423,9 @@ const char *BodyPipe::status() const
 
     outputBuffer.append(" [", 2);
 
-    outputBuffer.Printf("%"PRIu64"<=%"PRIu64, theGetSize, thePutSize);
+    outputBuffer.Printf("%" PRIu64 "<=%" PRIu64, theGetSize, thePutSize);
     if (theBodySize >= 0)
-        outputBuffer.Printf("<=%"PRId64, theBodySize);
+        outputBuffer.Printf("<=%" PRId64, theBodySize);
     else
         outputBuffer.append("<=?", 3);
 
index 2718eb23ab44f562509f30c286ef48afe2ce3c3f..80edc2d9d9f459fe0a9356c28b54b3ba1c9faa79 100644 (file)
@@ -57,14 +57,14 @@ DelaySpec::stats (StoreEntry * sentry, char const *label) const
     }
 
     storeAppendPrintf(sentry, "\t%s:\n", label);
-    storeAppendPrintf(sentry, "\t\tMax: %"PRId64"\n", max_bytes);
+    storeAppendPrintf(sentry, "\t\tMax: %" PRId64 "\n", max_bytes);
     storeAppendPrintf(sentry, "\t\tRestore: %d\n", restore_bps);
 }
 
 void
 DelaySpec::dump (StoreEntry *entry) const
 {
-    storeAppendPrintf(entry, " %d/%"PRId64"", restore_bps, max_bytes);
+    storeAppendPrintf(entry, " %d/%" PRId64, restore_bps, max_bytes);
 }
 
 void
index d3e39ac71fed90ec068be00a51445b01b0519fdd..b56a5ef97c37455a9d48e6a1fd3f661858effdd0 100644 (file)
@@ -149,11 +149,11 @@ do_read(diomsg * r, int len, char *buf)
 
     if (r->offset > -1 && r->offset != fs->offset) {
         DEBUG(2)
-        fprintf(stderr, "seeking to %"PRId64"\n", (int64_t)r->offset);
+        fprintf(stderr, "seeking to %" PRId64 "\n", (int64_t)r->offset);
 
         if (lseek(fs->fd, r->offset, SEEK_SET) < 0) {
             DEBUG(1) {
-                fprintf(stderr, "%d FD %d, offset %"PRId64": ", (int) mypid, fs->fd, (int64_t)r->offset);
+                fprintf(stderr, "%d FD %d, offset %" PRId64 ": ", (int) mypid, fs->fd, (int64_t)r->offset);
                 perror("lseek");
             }
         }
@@ -161,7 +161,7 @@ do_read(diomsg * r, int len, char *buf)
 
     x = read(fs->fd, buf, readlen);
     DEBUG(2)
-    fprintf(stderr, "%d READ %d,%d,%"PRId64" ret %d\n", (int) mypid,
+    fprintf(stderr, "%d READ %d,%d,%" PRId64 " ret %d\n", (int) mypid,
             fs->fd, readlen, (int64_t)r->offset, x);
 
     if (x < 0) {
@@ -198,14 +198,14 @@ do_write(diomsg * r, int len, const char *buf)
     if (r->offset > -1 && r->offset != fs->offset) {
         if (lseek(fs->fd, r->offset, SEEK_SET) < 0) {
             DEBUG(1) {
-                fprintf(stderr, "%d FD %d, offset %"PRId64": ", (int) mypid, fs->fd, (int64_t)r->offset);
+                fprintf(stderr, "%d FD %d, offset %" PRId64 ": ", (int) mypid, fs->fd, (int64_t)r->offset);
                 perror("lseek");
             }
         }
     }
 
     DEBUG(2)
-    fprintf(stderr, "%d WRITE %d,%d,%"PRId64"\n", (int) mypid,
+    fprintf(stderr, "%d WRITE %d,%d,%" PRId64 "\n", (int) mypid,
             fs->fd, wrtlen, (int64_t)r->offset);
     x = write(fs->fd, buf, wrtlen);
 
index c0af6ad673cfe1a901d710d4fa9ab41b874acfe9..f2531aa48ac5bd2850f42c613f4d74ee571f1e66 100644 (file)
@@ -129,7 +129,7 @@ httpHdrRangeRespSpecPackInto(const HttpHdrRangeSpec * spec, Packer * p)
     if (!known_spec(spec->offset) || !known_spec(spec->length))
         packerPrintf(p, "*");
     else
-        packerPrintf(p, "bytes %"PRId64"-%"PRId64,
+        packerPrintf(p, "bytes %" PRId64 "-%" PRId64,
                      spec->offset, spec->offset + spec->length - 1);
 }
 
@@ -233,7 +233,7 @@ httpHdrContRangePackInto(const HttpHdrContRange * range, Packer * p)
     if (!known_spec(range->elength))
         packerPrintf(p, "/*");
     else
-        packerPrintf(p, "/%"PRId64, range->elength);
+        packerPrintf(p, "/%" PRId64, range->elength);
 }
 
 void
index 975f2ca4ed906c8ed4bdfc178beaf37451c11fb0..32a67a0a23ac36a38917658abb99c3c7593a78fa 100644 (file)
@@ -132,11 +132,11 @@ void
 HttpHdrRangeSpec::packInto(Packer * packer) const
 {
     if (!known_spec(offset))   /* suffix */
-        packerPrintf(packer, "-%"PRId64,  length);
+        packerPrintf(packer, "-%" PRId64,  length);
     else if (!known_spec(length))              /* trailer */
-        packerPrintf(packer, "%"PRId64"-", offset);
+        packerPrintf(packer, "%" PRId64 "-", offset);
     else                       /* range */
-        packerPrintf(packer, "%"PRId64"-%"PRId64,
+        packerPrintf(packer, "%" PRId64 "-%" PRId64,
                      offset, offset + length - 1);
 }
 
index d0ca9b04196bcc2edb521280702927c1013d2ae8..8f591690735d66380cfec1384d21f8f1c0d3d5e5 100644 (file)
@@ -213,13 +213,13 @@ MemObject::stat(MemBuf * mb) const
                RequestMethodStr(method), log_url);
     if (vary_headers)
         mb->Printf("\tvary_headers: %s\n", vary_headers);
-    mb->Printf("\tinmem_lo: %"PRId64"\n", inmem_lo);
-    mb->Printf("\tinmem_hi: %"PRId64"\n", data_hdr.endOffset());
-    mb->Printf("\tswapout: %"PRId64" bytes queued\n",
+    mb->Printf("\tinmem_lo: %" PRId64 "\n", inmem_lo);
+    mb->Printf("\tinmem_hi: %" PRId64 "\n", data_hdr.endOffset());
+    mb->Printf("\tswapout: %" PRId64 " bytes queued\n",
                swapout.queue_offset);
 
     if (swapout.sio.getRaw())
-        mb->Printf("\tswapout: %"PRId64" bytes written\n",
+        mb->Printf("\tswapout: %" PRId64 " bytes written\n",
                    (int64_t) swapout.sio->offset());
 
     StoreClientStats statsVisitor(mb);
index ff090b6ff58d50e45e9451ea24e04b7bbd1229a7..cc05fd7c7abc3867bb1d64418b142e19f71af7ba 100644 (file)
@@ -258,7 +258,7 @@ void
 SwapDir::optionMaxSizeDump(StoreEntry * e) const
 {
     if (max_objsize != -1)
-        storeAppendPrintf(e, " max-size=%"PRId64, max_objsize);
+        storeAppendPrintf(e, " max-size=%" PRId64, max_objsize);
 }
 
 /* Swapdirs do not have an index of their own - thus they ask their parent..
index cbdd2a7f74edd533e7895a47562ecd9d470ed5a5..3c0e3dbe8298aed9a8f805ff9b6097a3cec1fd7f 100644 (file)
@@ -1778,7 +1778,7 @@ accessLogSquid(AccessLogEntry * al, Logfile * logfile)
         safe_free(user);
 
     if (!Config.onoff.log_mime_hdrs) {
-        logfilePrintf(logfile, "%9ld.%03d %6d %s %s/%03d %"PRId64" %s %s %s %s%s/%s %s\n",
+        logfilePrintf(logfile, "%9ld.%03d %6d %s %s/%03d %" PRId64 " %s %s %s %s%s/%s %s\n",
                       (long int) current_time.tv_sec,
                       (int) current_time.tv_usec / 1000,
                       al->cache.msec,
@@ -1796,7 +1796,7 @@ accessLogSquid(AccessLogEntry * al, Logfile * logfile)
     } else {
         char *ereq = log_quote(al->headers.request);
         char *erep = log_quote(al->headers.reply);
-        logfilePrintf(logfile, "%9ld.%03d %6d %s %s/%03d %"PRId64" %s %s %s %s%s/%s %s [%s] [%s]\n",
+        logfilePrintf(logfile, "%9ld.%03d %6d %s %s/%03d %" PRId64 " %s %s %s %s%s/%s %s [%s] [%s]\n",
                       (long int) current_time.tv_sec,
                       (int) current_time.tv_usec / 1000,
                       al->cache.msec,
@@ -1838,7 +1838,7 @@ accessLogCommon(AccessLogEntry * al, Logfile * logfile)
 
     user2 = accessLogFormatName(al->cache.rfc931);
 
-    logfilePrintf(logfile, "%s %s %s [%s] \"%s %s HTTP/%d.%d\" %d %"PRId64" %s:%s%s",
+    logfilePrintf(logfile, "%s %s %s [%s] \"%s %s HTTP/%d.%d\" %d %" PRId64 " %s:%s%s",
                   client,
                   user2 ? user2 : dash_str,
                   user1 ? user1 : dash_str,
@@ -1900,7 +1900,7 @@ accessLogICAPSquid(AccessLogEntry * al, Logfile * logfile)
     if (user && !*user)
         safe_free(user);
 
-    logfilePrintf(logfile, "%9ld.%03d %6d %s -/%03d %"PRId64" %s %s %s -/%s -\n",
+    logfilePrintf(logfile, "%9ld.%03d %6d %s -/%03d %" PRId64 " %s %s %s -/%s -\n",
                   (long int) current_time.tv_sec,
                   (int) current_time.tv_usec / 1000,
 
index d6d456468bf1bc9d8f8257d50ba5ee2e98386cc1..4e3332f35f73548760b48509744db501030a6370 100644 (file)
@@ -2698,13 +2698,13 @@ dump_kb_size_t(StoreEntry * entry, const char *name, size_t var)
 static void
 dump_b_int64_t(StoreEntry * entry, const char *name, int64_t var)
 {
-    storeAppendPrintf(entry, "%s %"PRId64" %s\n", name, var, B_BYTES_STR);
+    storeAppendPrintf(entry, "%s %" PRId64 " %s\n", name, var, B_BYTES_STR);
 }
 
 static void
 dump_kb_int64_t(StoreEntry * entry, const char *name, int64_t var)
 {
-    storeAppendPrintf(entry, "%s %"PRId64" %s\n", name, var, B_KBYTES_STR);
+    storeAppendPrintf(entry, "%s %" PRId64 " %s\n", name, var, B_KBYTES_STR);
 }
 
 static void
index b66542cf41bf66586b48f1185608cf11dba6c75d..d56d5f1232e990409a4030e493d81b094ea7328a 100644 (file)
@@ -56,11 +56,11 @@ fde::dumpStats (StoreEntry &dumpEntry, int fdNumber)
 
 #ifdef _SQUID_MSWIN_
 
-    storeAppendPrintf(&dumpEntry, "%4d 0x%-8lX %-6.6s %4d %7"PRId64"%c %7"PRId64"%c %-21s %s\n",
+    storeAppendPrintf(&dumpEntry, "%4d 0x%-8lX %-6.6s %4d %7" PRId64 "%c %7" PRId64 "%c %-21s %s\n",
                       fdNumber,
                       win32.handle,
 #else
-    storeAppendPrintf(&dumpEntry, "%4d %-6.6s %4d %7"PRId64"%c %7"PRId64"%c %-21s %s\n",
+    storeAppendPrintf(&dumpEntry, "%4d %-6.6s %4d %7" PRId64 "%c %7" PRId64 "%c %-21s %s\n",
                       fdNumber,
 #endif
                       fdTypeStr[type],
index 6a4641d5c5370507ed92306adb48fa0840ff0984..65818c814aea7e7fdd796c7cfef3c94c9450e0c4 100644 (file)
@@ -996,8 +996,8 @@ void
 CossSwapDir::statfs(StoreEntry & sentry) const
 {
     storeAppendPrintf(&sentry, "\n");
-    storeAppendPrintf(&sentry, "Maximum Size: %"PRIu64" KB\n", max_size);
-    storeAppendPrintf(&sentry, "Current Size: %"PRIu64" KB\n", cur_size);
+    storeAppendPrintf(&sentry, "Maximum Size: %" PRIu64 " KB\n", max_size);
+    storeAppendPrintf(&sentry, "Current Size: %" PRIu64 " KB\n", cur_size);
     storeAppendPrintf(&sentry, "Percent Used: %0.2f%%\n",
                       (100.0 * (double)cur_size / (double)max_size) );
     storeAppendPrintf(&sentry, "Number of object collisions: %d\n", (int) numcollisions);
@@ -1095,7 +1095,7 @@ CossSwapDir::reconfigure(int index, char *path)
 void
 CossSwapDir::dump(StoreEntry &entry)const
 {
-    storeAppendPrintf(&entry, " %"PRIu64"", (max_size >> 10));
+    storeAppendPrintf(&entry, " %" PRIu64, (max_size >> 10));
     dumpOptions(&entry);
 }
 
index 0344368cad002a8e0e65de614665ce7c5ed707bb..b232261ca035eab3102aabab271330010dbf5088 100644 (file)
@@ -311,8 +311,8 @@ UFSSwapDir::statfs(StoreEntry & sentry) const
     int x;
     storeAppendPrintf(&sentry, "First level subdirectories: %d\n", l1);
     storeAppendPrintf(&sentry, "Second level subdirectories: %d\n", l2);
-    storeAppendPrintf(&sentry, "Maximum Size: %"PRIu64" KB\n", max_size);
-    storeAppendPrintf(&sentry, "Current Size: %"PRIu64" KB\n", cur_size);
+    storeAppendPrintf(&sentry, "Maximum Size: %" PRIu64 " KB\n", max_size);
+    storeAppendPrintf(&sentry, "Current Size: %" PRIu64 " KB\n", cur_size);
     storeAppendPrintf(&sentry, "Percent Used: %0.2f%%\n",
                       (double)(100.0 * cur_size) / (double)max_size);
     storeAppendPrintf(&sentry, "Filemap bits in use: %d of %d (%d%%)\n",
@@ -1324,7 +1324,7 @@ UFSSwapDir::replacementRemove(StoreEntry * e)
 void
 UFSSwapDir::dump(StoreEntry & entry) const
 {
-    storeAppendPrintf(&entry, " %"PRIu64" %d %d",
+    storeAppendPrintf(&entry, " %" PRIu64 " %d %d",
                       (max_size >> 10),
                       l1,
                       l2);
index 5d4f5cd9a41a2b28b0f9359b77e663ae2ae152e2..c98765ddee21e60ee58c8aca213ea4b78aa2b939 100644 (file)
@@ -1152,7 +1152,7 @@ FtpStateData::htmlifyListEntry(const char *line)
         snprintf(icon, 2048, "<IMG border=\"0\" SRC=\"%s\" ALT=\"%-6s\">",
                  mimeGetIconURL(parts->name),
                  "[FILE]");
-        snprintf(size, 2048, " %6"PRId64"k", parts->size);
+        snprintf(size, 2048, " %6" PRId64 "k", parts->size);
         break;
     }
 
@@ -3259,7 +3259,7 @@ ftpSendRest(FtpStateData * ftpState)
 
     debugs(9, 3, HERE);
 
-    snprintf(cbuf, 1024, "REST %"PRId64"\r\n", ftpState->restart_offset);
+    snprintf(cbuf, 1024, "REST %" PRId64 "\r\n", ftpState->restart_offset);
     ftpState->writeCommand(cbuf);
     ftpState->state = SENT_REST;
 }
index a68b88313731226db855b3167e804ec2035b6679..b6aec40b3e17adcaa420f05948bc672de12fe5f5 100644 (file)
@@ -1619,7 +1619,7 @@ statClientRequests(StoreEntry * s)
 
         if (conn != NULL) {
             fd = conn->fd;
-            storeAppendPrintf(s, "\tFD %d, read %"PRId64", wrote %"PRId64"\n", fd,
+            storeAppendPrintf(s, "\tFD %d, read %" PRId64 ", wrote %" PRId64 "\n", fd,
                               fd_table[fd].bytes_read, fd_table[fd].bytes_written);
             storeAppendPrintf(s, "\tFD desc: %s\n", fd_table[fd].desc);
             storeAppendPrintf(s, "\tin: buf %p, offset %ld, size %ld\n",
index 2057112620db320f4dc28f6345447043468068e2..cd036322ecf5a71c829b06d18816c392c40c2191 100644 (file)
@@ -841,7 +841,7 @@ store_client::dumpStats(MemBuf * output, int clientNumber) const
 
     output->Printf("\tClient #%d, %p\n", clientNumber, _callback.callback_data);
 
-    output->Printf("\t\tcopy_offset: %"PRId64"\n",
+    output->Printf("\t\tcopy_offset: %" PRId64 "\n",
                    copyInto.offset);
 
     output->Printf("\t\tcopy_size: %d\n",
index 170ba76f3ebb361c614a81ffeee9bd0923134771..925efbcf801ac1f042062bc3a092b36abc572ad0 100644 (file)
@@ -360,11 +360,11 @@ StoreController::stat(StoreEntry &output) const
     storeAppendPrintf(&output, "Store Directory Statistics:\n");
     storeAppendPrintf(&output, "Store Entries          : %lu\n",
                       (unsigned long int)StoreEntry::inUseCount());
-    storeAppendPrintf(&output, "Maximum Swap Size      : %"PRIu64" KB\n",
+    storeAppendPrintf(&output, "Maximum Swap Size      : %" PRIu64 " KB\n",
                       maxSize());
     storeAppendPrintf(&output, "Current Store Swap Size: %8lu KB\n",
                       store_swap_size);
-    storeAppendPrintf(&output, "Current Capacity       : %"PRId64"%% used, %"PRId64"%% free\n",
+    storeAppendPrintf(&output, "Current Capacity       : %" PRId64 "%% used, %" PRId64 "%% free\n",
                       Math::int64Percent(store_swap_size, maxSize()),
                       Math::int64Percent((maxSize() - store_swap_size), maxSize()));
     /* FIXME Here we should output memory statistics */
index 3656f539c6106a54a91c8bc0476a8a8ab10cc358..3a1927b8daed4fc5663fd6a529bd6b771aaf5f62 100644 (file)
@@ -83,7 +83,7 @@ storeLog(int tag, const StoreEntry * e)
 
         String ctype=(reply->content_type.size() ? reply->content_type.termedBuf() : str_unknown);
 
-        logfilePrintf(storelog, "%9d.%03d %-7s %02d %08X %s %4d %9d %9d %9d " SQUIDSTRINGPH " %"PRId64"/%"PRId64" %s %s\n",
+        logfilePrintf(storelog, "%9d.%03d %-7s %02d %08X %s %4d %9d %9d %9d " SQUIDSTRINGPH " %" PRId64 "/%" PRId64 " %s %s\n",
                       (int) current_time.tv_sec,
                       (int) current_time.tv_usec / 1000,
                       storeLogTags[tag],
index 6feae60403a5711fa9a1d135efa924bfe2dc7123..98cb14cdb0a50493d72c652490987934b03068c9 100644 (file)
@@ -174,7 +174,7 @@ dumpMallocStats(void)
 
     mp = mallinfo();
 
-    fprintf(debug_log, "Memory usage for "APP_SHORTNAME" via mallinfo():\n");
+    fprintf(debug_log, "Memory usage for " APP_SHORTNAME " via mallinfo():\n");
 
     fprintf(debug_log, "\ttotal space in arena:  %6ld KB\n",
             (long)mp.arena >> 10);