]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Fix build after ccfbe8f (Report context of cache.log messages) (#495)
authorAlex Rousskov <rousskov@measurement-factory.com>
Sat, 19 Oct 2019 16:19:10 +0000 (16:19 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Sun, 20 Oct 2019 05:13:47 +0000 (05:13 +0000)
In some environments (e.g., Ubuntu 14 without libcppunit-dev), GCC
correctly complained that it does not know how to print "[unknown]",
probably because none of the other headers imported `<ostream>` before
importing base/InstanceId.h.

src/base/InstanceId.cc [new file with mode: 0644]
src/base/InstanceId.h
src/base/Makefile.am

diff --git a/src/base/InstanceId.cc b/src/base/InstanceId.cc
new file mode 100644 (file)
index 0000000..0507978
--- /dev/null
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 1996-2019 The Squid Software Foundation and contributors
+ *
+ * Squid software is distributed under GPLv2+ license and includes
+ * contributions from numerous individuals and organizations.
+ * Please see the COPYING and CONTRIBUTORS files for details.
+ */
+
+#include "squid.h"
+#include "base/InstanceId.h"
+
+#include <iostream>
+
+std::ostream&
+operator <<(std::ostream &os, const ScopedId &id)
+{
+    if (id.value)
+        os << id.scope << id.value;
+    else if (id.scope)
+        os << id.scope;
+    else
+        os << "[unknown]";
+    return os;
+}
+
index f5fcfbca96ee29f5a732f6623f8d2256a1ff36f4..d8f9251bb032b356f25ef2e7929119631a853d41 100644 (file)
@@ -32,17 +32,7 @@ public:
     uint64_t value;
 };
 
-inline std::ostream&
-operator <<(std::ostream &os, const ScopedId &id)
-{
-    if (id.value)
-        os << id.scope << id.value;
-    else if (id.scope)
-        os << id.scope;
-    else
-        os << "[unknown]";
-    return os;
-}
+std::ostream &operator <<(std::ostream &os, const ScopedId &id);
 
 typedef unsigned int InstanceIdDefaultValueType;
 /** Identifier for class instances
index c891b4f819ea64ef25afcd33104ae3bf94bb105d..ea403a1a210ee3a64726f9862d842bd95033679c 100644 (file)
@@ -33,6 +33,7 @@ libbase_la_SOURCES = \
        HardFun.h \
        Here.cc \
        Here.h \
+       InstanceId.cc \
        InstanceId.h \
        Lock.h \
        LookupTable.h \