mirror of
https://github.com/facebookresearch/faiss.git
synced 2026-10-11 22:50:00 +00:00
Summary: - Fix compiler warnings in all 20 FAISS C++ test files - Fixes include `-Wshadow`, `-Wunused-parameter`, and signed/unsigned comparisons All changes are mechanical. No functional changes. Part 13/13 of the compiler warnings cleanup (split from https://github.com/facebookresearch/faiss/issues/4810 per maintainer request). Pull Request resolved: https://github.com/facebookresearch/faiss/pull/4944 Test Plan: - [x] No functional changes — all fixes are mechanical renames and annotations 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]> Reviewed By: mnorris11 Differential Revision: D96996609 Pulled By: alibeklfc fbshipit-source-id: 72555246a4ccf540eb5422e64018c8d5e2660dce
39 lines
889 B
C++
39 lines
889 B
C++
/*
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
#ifndef FAISS_TEST_UTIL_H
|
|
#define FAISS_TEST_UTIL_H
|
|
|
|
#include <faiss/IndexIVFPQ.h>
|
|
#include <unistd.h>
|
|
|
|
struct Tempfilename {
|
|
pthread_mutex_t* mutex;
|
|
std::string filename;
|
|
|
|
Tempfilename(pthread_mutex_t* mutex_in, std::string filename_template) {
|
|
this->mutex = mutex_in;
|
|
this->filename = filename_template;
|
|
pthread_mutex_lock(mutex);
|
|
int fd = mkstemp(&this->filename[0]);
|
|
close(fd);
|
|
pthread_mutex_unlock(mutex);
|
|
}
|
|
|
|
~Tempfilename() {
|
|
if (access(filename.c_str(), F_OK)) {
|
|
unlink(filename.c_str());
|
|
}
|
|
}
|
|
|
|
const char* c_str() {
|
|
return filename.c_str();
|
|
}
|
|
};
|
|
|
|
#endif // FAISS_TEST_UTIL_H
|