From: Amos Jeffries Date: Thu, 14 Dec 2023 16:42:47 +0000 (+0000) Subject: Replace __FUNCTION__ with C++11 __func__ (#1620) X-Git-Tag: SQUID_7_0_1~254 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d868b138346b57b740047baced21bbad643775c8;p=thirdparty%2Fsquid.git Replace __FUNCTION__ with C++11 __func__ (#1620) --- diff --git a/compat/os/solaris.h b/compat/os/solaris.h index 8c990a4020..07de191a31 100644 --- a/compat/os/solaris.h +++ b/compat/os/solaris.h @@ -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 diff --git a/src/base/Here.h b/src/base/Here.h index 0dbc7a05ab..704cf27194 100644 --- a/src/base/Here.h +++ b/src/base/Here.h @@ -12,7 +12,7 @@ #include /// 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; diff --git a/src/client_side_reply.cc b/src/client_side_reply.cc index d80d82dd19..c52771d2bb 100644 --- a/src/client_side_reply.cc +++ b/src/client_side_reply.cc @@ -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; diff --git a/src/debug/Stream.h b/src/debug/Stream.h index 4717825193..7308e4aae8 100644 --- a/src/debug/Stream.h +++ b/src/debug/Stream.h @@ -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+) */ diff --git a/src/debug/debug.cc b/src/debug/debug.cc index 90198f0861..94fc93b6a8 100644 --- a/src/debug/debug.cc +++ b/src/debug/debug.cc @@ -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); diff --git a/src/icp_v2.cc b/src/icp_v2.cc index 1b901f6172..7c0f571aea 100644 --- a/src/icp_v2.cc +++ b/src/icp_v2.cc @@ -159,7 +159,7 @@ ICPState::isHit() const const auto hit = e && confirmAndPrepHit(*e); if (e) - e->abandon(__FUNCTION__); + e->abandon(__func__); return hit; } diff --git a/src/mime.cc b/src/mime.cc index 452bf58857..905054c8fc 100644 --- a/src/mime.cc +++ b/src/mime.cc @@ -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; } diff --git a/src/store/Controller.cc b/src/store/Controller.cc index 9507a6d11a..5f5bad1f30 100644 --- a/src/store/Controller.cc +++ b/src/store/Controller.cc @@ -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)) diff --git a/src/tests/STUB.h b/src/tests/STUB.h index ed2c0d67dd..a7d7d722b9 100644 --- a/src/tests/STUB.h +++ b/src/tests/STUB.h @@ -27,14 +27,14 @@ #include // 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: "<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); }