]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Replace __FUNCTION__ with C++11 __func__ (#1620)
authorAmos Jeffries <yadij@users.noreply.github.com>
Thu, 14 Dec 2023 16:42:47 +0000 (16:42 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Sat, 16 Dec 2023 09:49:49 +0000 (09:49 +0000)
compat/os/solaris.h
src/base/Here.h
src/client_side_reply.cc
src/debug/Stream.h
src/debug/debug.cc
src/icp_v2.cc
src/mime.cc
src/store/Controller.cc
src/tests/STUB.h
src/urn.cc

index 8c990a4020abafdd8807f2f2936779ce907aa73a..07de191a3168bf0b87323db65942451fbe1ab0ee 100644 (file)
@@ -71,13 +71,6 @@ SQUIDCEXTERN int getpagesize(void);
 SQUIDCEXTERN int gethostname(char *, int);
 #endif
 
-/*
- * SunStudio CC does not define C++ portability API __FUNCTION__
- */
-#if defined(__SUNPRO_CC) && !defined(__FUNCTION__)
-#define __FUNCTION__ ""
-#endif
-
 /* Bug 2500: Solaris 10/11 require s6_addr* defines. */
 //#define s6_addr8   _S6_un._S6_u8
 //#define s6_addr16  _S6_un._S6_u16
index 0dbc7a05ab701c27f067490514cac34bf5a28d8a..704cf27194068d5fd4df8fe5d9b6abf66637244f 100644 (file)
@@ -12,7 +12,7 @@
 #include <iosfwd>
 
 /// source code location of the caller
-#define Here() SourceLocation(__FUNCTION__, __FILE__, __LINE__)
+#define Here() SourceLocation(__func__, __FILE__, __LINE__)
 
 /// semi-uniquely identifies a source code location; stable across Squid runs
 typedef uint32_t SourceLocationId;
index d80d82dd19f6724a29bca2d7cfc5b14f5ad22256..c52771d2bbbfee79fed218a163f959df9bf1c509 100644 (file)
@@ -298,7 +298,7 @@ clientReplyContext::processExpired()
                 entry = e;
                 entry->lock("clientReplyContext::processExpired#alreadyRevalidating");
             } else {
-                e->abandon(__FUNCTION__);
+                e->abandon(__func__);
                 // assume mayInitiateCollapsing() would fail too
                 collapsingAllowed = false;
             }
@@ -924,7 +924,7 @@ clientReplyContext::purgeDoPurge()
             const auto err = clientBuildError(ERR_ACCESS_DENIED, Http::scForbidden, nullptr,
                                               http->getConn(), http->request, http->al);
             startError(err);
-            entry->abandon(__FUNCTION__);
+            entry->abandon(__func__);
             return;
         }
         firstFound = true;
index 47178251932857cca6f841949696db6afcba0e21..7308e4aae8bd5bc887dc717d7089835cab93b41e 100644 (file)
@@ -233,7 +233,7 @@ HERE(std::ostream& s)
 #ifdef __PRETTY_FUNCTION__
 #define MYNAME __PRETTY_FUNCTION__ << " "
 #else
-#define MYNAME __FUNCTION__ << " "
+#define MYNAME __func__ << " "
 #endif
 
 /* some uint8_t do not like streaming control-chars (values 0-31, 127+) */
index 90198f0861b2dbbc465f90d6479192d7cdfbe8dd..94fc93b6a8828c0c0cf710ec787d63c6e12b9de7 100644 (file)
@@ -796,11 +796,11 @@ Debug::LogMessage(const Context &context)
 
             if (!InitializeCriticalSectionAndSpinCount(dbg_mutex, 4000)) {
                 if (const auto logFile = TheLog.file()) {
-                    fprintf(logFile, "FATAL: %s: can't initialize critical section\n", __FUNCTION__);
+                    fprintf(logFile, "FATAL: %s: can't initialize critical section\n", __func__);
                     fflush(logFile);
                 }
 
-                fprintf(stderr, "FATAL: %s: can't initialize critical section\n", __FUNCTION__);
+                fprintf(stderr, "FATAL: %s: can't initialize critical section\n", __func__);
                 abort();
             } else
                 InitializeCriticalSection(dbg_mutex);
index 1b901f6172b3c66ede00ed3ce9bea12f206b52b2..7c0f571aea7191d3c3760b4c29e41d1336ee2664 100644 (file)
@@ -159,7 +159,7 @@ ICPState::isHit() const
     const auto hit = e && confirmAndPrepHit(*e);
 
     if (e)
-        e->abandon(__FUNCTION__);
+        e->abandon(__func__);
 
     return hit;
 }
index 452bf5885716fd9f21057bc4f6ef34b8ddd18c59..905054c8fc617c3d4a4498ee5eb3b0f00b7be4e3 100644 (file)
@@ -362,7 +362,7 @@ MimeIcon::load()
 
     if (const auto e = storeGetPublic(url_, Http::METHOD_GET)) {
         // do not overwrite an already stored icon
-        e->abandon(__FUNCTION__);
+        e->abandon(__func__);
         return;
     }
 
index 9507a6d11a93366876af9509d1b1a705e2fa4f93..5f5bad1f30eaee3db5f97cbd27e4a7f9897c1ef3 100644 (file)
@@ -551,7 +551,7 @@ Store::Controller::freeMemorySpace(const int bytesRequired)
     int removed = 0;
     while (const auto entry = walker->Next(walker)) {
         // Abandoned memory cache entries are purged during memory shortage.
-        entry->abandon(__FUNCTION__); // may delete entry
+        entry->abandon(__func__); // may delete entry
         ++removed;
 
         if (memoryCacheHasSpaceFor(pagesRequired))
index ed2c0d67dd7745eff38725d09b8b470373808ab8..a7d7d722b92c26954e975646ba5167b93c39a80b 100644 (file)
 #include <iostream>
 
 // Internal Special: the STUB framework requires this function
-#define stub_fatal(m) { std::cerr<<"FATAL: "<<(m)<<" for use of "<<__FUNCTION__<<"\n"; exit(EXIT_FAILURE); }
+#define stub_fatal(m) { std::cerr<<"FATAL: "<<(m)<<" for use of "<<__func__<<"\n"; exit(EXIT_FAILURE); }
 
 /// macro to stub a void function.
 #define STUB { stub_fatal(STUB_API " required"); }
 
 /// macro to stub a void function without a fatal message
 /// Intended for registration pattern APIs where the function result does not matter to the test
-#define STUB_NOP { std::cerr<<"SKIP: "<<STUB_API<<" "<<__FUNCTION__<<" (not implemented).\n"; }
+#define STUB_NOP { std::cerr<<"SKIP: "<<STUB_API<<" "<<__func__<<" (not implemented).\n"; }
 
 /// macro to stub a function with return value.
 /// Aborts unit tests requiring its definition with a message about the missing linkage
@@ -42,7 +42,7 @@
 
 /// macro to stub a void function without a fatal message and with a return value
 /// Intended for registration pattern APIs where the function result does not matter to the test
-#define STUB_RETVAL_NOP(x) { std::cerr<<"SKIP: "<<STUB_API<<" "<<__FUNCTION__<<" (not implemented).\n"; return x; }
+#define STUB_RETVAL_NOP(x) { std::cerr<<"SKIP: "<<STUB_API<<" "<<__func__<<" (not implemented).\n"; return x; }
 
 /** macro to stub a function which returns a reference to dynamic
  *  Aborts unit tests requiring its definition with a message about the missing linkage
index 7365c6ec80299f2d81a43cd4667c1317fa664d56..ff88aae4d54d4fe3e91ff267289e31c872a7f2e7 100644 (file)
@@ -178,12 +178,12 @@ UrnState::start(HttpRequest * r, StoreEntry * e)
         sc = storeClientListAdd(urlres_e, this);
         FwdState::Start(Comm::ConnectionPointer(), urlres_e, urlres_r.getRaw(), ale);
         if (urlEntry) {
-            urlEntry->abandon(__FUNCTION__);
+            urlEntry->abandon(__func__);
             urlEntry = nullptr;
         }
     } else {
         urlres_e = urlEntry;
-        urlres_e->lock("UrnState::start");
+        urlres_e->lock(__func__);
         sc = storeClientListAdd(urlres_e, this);
     }