Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix GCC v13 LTO build [-Walloc-size-larger-than=] #1929

Open
wants to merge 16 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/DiskIO/DiskThreads/DiskThreads.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ void aioRead(int, off_t offset, size_t size, AIOCB *, void *);

void aioStat(char *, struct stat *, AIOCB *, void *);
void aioUnlink(const char *, AIOCB *, void *);
int aioQueueSize(void);
size_t aioQueueSize(void);

#include "DiskIO/DiskFile.h"

Expand Down
10 changes: 5 additions & 5 deletions src/DiskIO/DiskThreads/aiops.cc
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ static Mem::Allocator *squidaio_small_bufs = nullptr; /* 4K */
static Mem::Allocator *squidaio_tiny_bufs = nullptr; /* 2K */
static Mem::Allocator *squidaio_micro_bufs = nullptr; /* 128K */

static int request_queue_len = 0;
static size_t request_queue_len = 0;
static Mem::Allocator *squidaio_request_pool = nullptr;
static Mem::Allocator *squidaio_thread_pool = nullptr;
static squidaio_request_queue_t request_queue;
Expand Down Expand Up @@ -215,7 +215,7 @@ squidaio_xstrfree(char *str)
void
squidaio_init(void)
{
int i;
size_t i;
squidaio_thread_t *threadp;

if (squidaio_initialised)
Expand Down Expand Up @@ -515,7 +515,7 @@ squidaio_queue_request(squidaio_request_t * request)
/* Warn if out of threads */
if (request_queue_len > MAGIC1) {
static int last_warn = 0;
static int queue_high, queue_low;
static size_t queue_high, queue_low;

if (high_start == 0) {
high_start = squid_curtime;
Expand Down Expand Up @@ -999,7 +999,7 @@ void
squidaio_stats(StoreEntry * sentry)
{
squidaio_thread_t *threadp;
int i;
size_t i;

if (!squidaio_initialised)
return;
Expand All @@ -1011,7 +1011,7 @@ squidaio_stats(StoreEntry * sentry)
threadp = threads;

for (i = 0; i < NUMTHREADS; ++i) {
storeAppendPrintf(sentry, "%i\t0x%lx\t%ld\n", i + 1, (unsigned long)threadp->thread, threadp->requests);
storeAppendPrintf(sentry, "%lu\t0x%lx\t%ld\n", i + 1, (unsigned long)threadp->thread, threadp->requests);
rousskov marked this conversation as resolved.
Show resolved Hide resolved
threadp = threadp->next;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/DiskIO/DiskThreads/async_io.cc
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ aioUnlink(const char *path, AIOCB * callback, void *callback_data)
dlinkAdd(ctrlp, &ctrlp->node, &used_list);
} /* aioUnlink */

int
size_t
aioQueueSize(void)
{
return squidaio_ctrl_t::UseCount();
Expand Down
4 changes: 2 additions & 2 deletions src/SquidConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ class DiskConfig {
~DiskConfig() { delete[] swapDirs; }

RefCount<SwapDir> *swapDirs = nullptr;
int n_allocated = 0;
int n_configured = 0;
size_t n_allocated = 0;
size_t n_configured = 0;
/// number of disk processes required to support all cache_dirs
int n_strands = 0;
};
Expand Down
2 changes: 1 addition & 1 deletion src/auth/SchemeConfig.cc
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ Auth::SchemeConfig::registerWithCacheManager(void)
{}

void
Auth::SchemeConfig::parse(Auth::SchemeConfig * scheme, int, char *param_str)
Auth::SchemeConfig::parse(Auth::SchemeConfig * scheme, size_t, char *param_str)
{
if (strcmp(param_str, "program") == 0) {
if (authenticateProgram)
Expand Down
2 changes: 1 addition & 1 deletion src/auth/SchemeConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ class SchemeConfig
virtual void registerWithCacheManager(void);

/** parse config options */
virtual void parse(SchemeConfig *, int, char *);
virtual void parse(SchemeConfig *, size_t, char *);

/** the http string id */
virtual const char * type() const = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/auth/basic/Config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ Auth::Basic::Config::Config() :
}

void
Auth::Basic::Config::parse(Auth::SchemeConfig * scheme, int n_configured, char *param_str)
Auth::Basic::Config::parse(Auth::SchemeConfig * scheme, size_t n_configured, char *param_str)
{
if (strcmp(param_str, "credentialsttl") == 0) {
parse_time_t(&credentialsTTL);
Expand Down
2 changes: 1 addition & 1 deletion src/auth/basic/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class Config : public Auth::SchemeConfig
bool dump(StoreEntry *, const char *, Auth::SchemeConfig *) const override;
void fixHeader(Auth::UserRequest::Pointer, HttpReply *, Http::HdrType, HttpRequest *) override;
void init(Auth::SchemeConfig *) override;
void parse(Auth::SchemeConfig *, int, char *) override;
void parse(Auth::SchemeConfig *, size_t, char *) override;
void decode(char const *httpAuthHeader, Auth::UserRequest::Pointer);
void registerWithCacheManager(void) override;
const char * type() const override;
Expand Down
2 changes: 1 addition & 1 deletion src/auth/digest/Config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ Auth::Digest::Config::Config() :
{}

void
Auth::Digest::Config::parse(Auth::SchemeConfig * scheme, int n_configured, char *param_str)
Auth::Digest::Config::parse(Auth::SchemeConfig * scheme, size_t n_configured, char *param_str)
{
if (strcmp(param_str, "nonce_garbage_interval") == 0) {
parse_time_t(&nonceGCInterval);
Expand Down
2 changes: 1 addition & 1 deletion src/auth/digest/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class Config : public Auth::SchemeConfig
bool dump(StoreEntry *, const char *, Auth::SchemeConfig *) const override;
void fixHeader(Auth::UserRequest::Pointer, HttpReply *, Http::HdrType, HttpRequest *) override;
void init(Auth::SchemeConfig *) override;
void parse(Auth::SchemeConfig *, int, char *) override;
void parse(Auth::SchemeConfig *, size_t, char *) override;
void registerWithCacheManager(void) override;
const char * type() const override;

Expand Down
2 changes: 1 addition & 1 deletion src/fs/rock/RockSwapDir.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1118,7 +1118,7 @@ DefineRunnerRegistratorIn(Rock, SwapDirRr);
void Rock::SwapDirRr::create()
{
Must(mapOwners.empty() && freeSlotsOwners.empty());
for (int i = 0; i < Config.cacheSwap.n_configured; ++i) {
for (size_t i = 0; i < Config.cacheSwap.n_configured; ++i) {
if (const Rock::SwapDir *const sd = dynamic_cast<Rock::SwapDir *>(INDEXSD(i))) {
rebuildStatsOwners.push_back(Rebuild::Stats::Init(*sd));

Expand Down
9 changes: 4 additions & 5 deletions src/fs/ufs/UFSSwapDir.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
#include <sys/stat.h>
#endif

int Fs::Ufs::UFSSwapDir::NumberOfUFSDirs = 0;
size_t Fs::Ufs::UFSSwapDir::NumberOfUFSDirs = 0;
int *Fs::Ufs::UFSSwapDir::UFSDirToGlobalDirMapping = nullptr;

class UFSCleanLog : public SwapDir::CleanLog
Expand Down Expand Up @@ -758,7 +758,6 @@ Fs::Ufs::UFSSwapDir::closeLog()
return;

--NumberOfUFSDirs;
rousskov marked this conversation as resolved.
Show resolved Hide resolved
assert(NumberOfUFSDirs >= 0);
if (!NumberOfUFSDirs)
safe_free(UFSDirToGlobalDirMapping);

Expand Down Expand Up @@ -1039,9 +1038,9 @@ int
Fs::Ufs::UFSSwapDir::HandleCleanEvent()
{
static int swap_index = 0;
int i;
size_t i;
int j = 0;
int n = 0;
size_t n = 0;

if (!NumberOfUFSDirs)
return 0; // probably in the middle of reconfiguration
Expand Down Expand Up @@ -1112,7 +1111,7 @@ Fs::Ufs::UFSSwapDir::IsUFSDir(SwapDir * sd)
* if not UFSSwapDir return 0;
*/
bool
Fs::Ufs::UFSSwapDir::FilenoBelongsHere(int fn, int F0, int F1, int F2)
Fs::Ufs::UFSSwapDir::FilenoBelongsHere(int fn, size_t F0, int F1, int F2)
{
int D1, D2;
int L1, L2;
Expand Down
4 changes: 2 additions & 2 deletions src/fs/ufs/UFSSwapDir.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class UFSSwapDir : public SwapDir
* \param level1dir level-1 dir in the cachedir
* \param level2dir level-2 dir
*/
static bool FilenoBelongsHere(int fn, int cachedir, int level1dir, int level2dir);
static bool FilenoBelongsHere(int fn, size_t cachedir, int level1dir, int level2dir);

UFSSwapDir(char const *aType, const char *aModuleType);
~UFSSwapDir() override;
Expand Down Expand Up @@ -123,7 +123,7 @@ class UFSSwapDir : public SwapDir

private:
void parseSizeL1L2();
static int NumberOfUFSDirs;
static size_t NumberOfUFSDirs;
static int * UFSDirToGlobalDirMapping;
bool pathIsDirectory(const char *path)const;
int swaplog_fd;
Expand Down
6 changes: 3 additions & 3 deletions src/pconn.cc
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,9 @@ IdleConnList::findIndexOf(const Comm::ConnectionPointer &conn) const
* \retval false The index is not an in-use entry.
*/
bool
IdleConnList::removeAt(int index)
IdleConnList::removeAt(size_t index)
{
if (index < 0 || index >= size_)
if (index >= size_)
return false;

// shuffle the remaining entries to fill the new gap.
Expand Down Expand Up @@ -174,7 +174,7 @@ IdleConnList::push(const Comm::ConnectionPointer &conn)
capacity_ <<= 1;
const Comm::ConnectionPointer *oldList = theList_;
theList_ = new Comm::ConnectionPointer[capacity_];
for (int index = 0; index < size_; ++index)
for (size_t index = 0; index < size_; ++index)
theList_[index] = oldList[index];

delete[] oldList;
Expand Down
6 changes: 3 additions & 3 deletions src/pconn.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class IdleConnList: public hash_link, private IndependentRunner
void endingShutdown() override;
private:
bool isAvailable(int i) const;
bool removeAt(int index);
bool removeAt(size_t index);
int findIndexOf(const Comm::ConnectionPointer &conn) const;
void findAndClose(const Comm::ConnectionPointer &conn);
static IOCB Read;
Expand All @@ -81,9 +81,9 @@ class IdleConnList: public hash_link, private IndependentRunner
Comm::ConnectionPointer *theList_;

/// Number of entries theList can currently hold without re-allocating (capacity).
int capacity_;
size_t capacity_;
///< Number of in-use entries in theList
int size_;
size_t size_;
rousskov marked this conversation as resolved.
Show resolved Hide resolved

/** The pool containing this sub-list.
* The parent performs all stats accounting, and
Expand Down
Loading