mirror of
https://github.com/Kitware/CMake.git
synced 2025-12-30 10:20:56 -06:00
Revise C++ coding style using clang-format-18
Run the `clang-format.bash` script to update all our C and C++ code to a new style defined by `.clang-format`. Use `clang-format` version 18. * If you reached this commit for a line in `git blame`, re-run the blame operation starting at the parent of this commit to see older history for the content. * See the parent commit for instructions to rebase a change across this style transition commit. Fixes: #26123
This commit is contained in:
@@ -7,4 +7,4 @@ CMAKE-STDLIB-DETECT: libstdc++
|
||||
#else
|
||||
CMAKE-STDLIB-DETECT: UNKNOWN
|
||||
#endif
|
||||
// clang-format on
|
||||
// clang-format on
|
||||
|
||||
@@ -551,8 +551,7 @@ int cmCPackNSISGenerator::InitializeInternal()
|
||||
}
|
||||
} else {
|
||||
cmCPackLogger(cmCPackLog::LOG_DEBUG,
|
||||
"CPACK_CREATE_DESKTOP_LINKS: "
|
||||
<< "not set" << std::endl);
|
||||
"CPACK_CREATE_DESKTOP_LINKS: " << "not set" << std::endl);
|
||||
}
|
||||
|
||||
std::ostringstream str;
|
||||
|
||||
@@ -1733,9 +1733,7 @@ int cmCTestCoverageHandler::RunBullseyeCoverageBranch(
|
||||
"run covbr: " << std::endl, this->Quiet);
|
||||
|
||||
if (!this->RunBullseyeCommand(cont, "covbr", nullptr, outputFile)) {
|
||||
cmCTestLog(this->CTest, ERROR_MESSAGE,
|
||||
"error running covbr for."
|
||||
<< "\n");
|
||||
cmCTestLog(this->CTest, ERROR_MESSAGE, "error running covbr for." << "\n");
|
||||
return -1;
|
||||
}
|
||||
cmCTestOptionalLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "cmCursesWidget.h"
|
||||
#include "cmStateTypes.h"
|
||||
|
||||
#define ctrl(z) ((z)&037)
|
||||
#define ctrl(z) ((z) & 037)
|
||||
|
||||
cmCursesOptionsWidget::cmCursesOptionsWidget(int width, int height, int left,
|
||||
int top)
|
||||
|
||||
@@ -31,7 +31,7 @@ public:
|
||||
protected:
|
||||
// Implement virtual methods from the superclass.
|
||||
void ComplainAboutDuplicateTarget(
|
||||
std::string const& /*targetName*/) const override{};
|
||||
std::string const& /*targetName*/) const override {};
|
||||
void ReportError(std::string const& errorMessage) const override;
|
||||
|
||||
bool GenerateMainFile(std::ostream& os) override;
|
||||
|
||||
@@ -830,7 +830,7 @@ void cmGlobalGenerator::EnableLanguage(
|
||||
// flag
|
||||
needTestLanguage[lang] = true;
|
||||
} // end if(!this->GetLanguageEnabled(lang) )
|
||||
} // end loop over languages
|
||||
} // end loop over languages
|
||||
|
||||
// **** Load the system specific information if not yet loaded
|
||||
if (!mf->GetDefinition("CMAKE_SYSTEM_SPECIFIC_INFORMATION_LOADED")) {
|
||||
@@ -939,7 +939,7 @@ void cmGlobalGenerator::EnableLanguage(
|
||||
cmSystemTools::RemoveFile(compilerLangFile);
|
||||
}
|
||||
} // end if in try compile
|
||||
} // end need test language
|
||||
} // end need test language
|
||||
|
||||
// load linker configuration, if required
|
||||
if (mf->GetDefinition(cmStrCat("CMAKE_", lang, "_USE_LINKER_INFORMATION"))
|
||||
|
||||
@@ -42,10 +42,10 @@ public:
|
||||
public:
|
||||
Error(Location loc, std::string errMsg)
|
||||
: location(loc)
|
||||
, message(std::move(errMsg)){};
|
||||
, message(std::move(errMsg)) {};
|
||||
Error(std::string errMsg)
|
||||
: location({ -1, -1 })
|
||||
, message(std::move(errMsg)){};
|
||||
, message(std::move(errMsg)) {};
|
||||
std::string GetErrorMessage() const
|
||||
{
|
||||
std::string output = message;
|
||||
|
||||
@@ -1503,7 +1503,7 @@ cmSystemTools::RenameResult cmSystemTools::RenameFile(
|
||||
{
|
||||
#ifdef _WIN32
|
||||
# ifndef INVALID_FILE_ATTRIBUTES
|
||||
# define INVALID_FILE_ATTRIBUTES ((DWORD)-1)
|
||||
# define INVALID_FILE_ATTRIBUTES ((DWORD) - 1)
|
||||
# endif
|
||||
std::wstring const oldname_wstr =
|
||||
SystemTools::ConvertToWindowsExtendedPath(oldname);
|
||||
|
||||
@@ -26,6 +26,6 @@ public:
|
||||
and to encode dates until the year 10000 in the patch level. */
|
||||
#define CMake_VERSION_ENCODE_BASE KWIML_INT_UINT64_C(100000000)
|
||||
#define CMake_VERSION_ENCODE(major, minor, patch) \
|
||||
((((major)*1000u) * CMake_VERSION_ENCODE_BASE) + \
|
||||
((((major) * 1000u) * CMake_VERSION_ENCODE_BASE) + \
|
||||
(((minor) % 1000u) * CMake_VERSION_ENCODE_BASE) + \
|
||||
(((patch) % CMake_VERSION_ENCODE_BASE)))
|
||||
|
||||
@@ -3,7 +3,7 @@ struct
|
||||
#ifdef _WIN32
|
||||
__declspec(dllexport)
|
||||
#endif
|
||||
OnlyPlainLib1
|
||||
OnlyPlainLib1
|
||||
{
|
||||
OnlyPlainLib1();
|
||||
|
||||
|
||||
@@ -4,4 +4,5 @@
|
||||
#ifdef _WIN32
|
||||
__declspec(dllexport)
|
||||
#endif
|
||||
OnlyPlainLib1 onlyPlainLib2();
|
||||
OnlyPlainLib1
|
||||
onlyPlainLib2();
|
||||
|
||||
@@ -16,8 +16,7 @@ struct ExpectedPackResult
|
||||
std::vector<cmCTestBinPackerAllocation> ExpectedBlockAllocations;
|
||||
};
|
||||
|
||||
static const std::vector<ExpectedPackResult> expectedResults
|
||||
{
|
||||
static const std::vector<ExpectedPackResult> expectedResults{
|
||||
/* clang-format off */
|
||||
{
|
||||
{ 2, 2, 2, 2 },
|
||||
|
||||
@@ -7,14 +7,12 @@
|
||||
#include "cmCTestResourceSpec.h"
|
||||
#include "cmJSONState.h"
|
||||
|
||||
static const cmCTestResourceSpec spec{
|
||||
{ {
|
||||
/* clang-format off */
|
||||
static const cmCTestResourceSpec spec{ { {
|
||||
/* clang-format off */
|
||||
{ "gpus", { { "0", 4 }, { "1", 8 }, { "2", 0 }, { "3", 8 } }, },
|
||||
/* clang-format on */
|
||||
} },
|
||||
cmJSONState()
|
||||
};
|
||||
/* clang-format on */
|
||||
} },
|
||||
cmJSONState() };
|
||||
|
||||
static bool testInitializeFromResourceSpec()
|
||||
{
|
||||
|
||||
@@ -19,7 +19,7 @@ extern "C" {
|
||||
|
||||
#include <sys/stat.h>
|
||||
#if !defined(S_ISDIR)
|
||||
# define S_ISDIR(mode) ((mode)&_S_IFDIR)
|
||||
# define S_ISDIR(mode) ((mode) & _S_IFDIR)
|
||||
#endif
|
||||
|
||||
#ifdef COMPLEX_TEST_LINK_STATIC
|
||||
|
||||
@@ -19,7 +19,7 @@ extern "C" {
|
||||
|
||||
#include <sys/stat.h>
|
||||
#if !defined(S_ISDIR)
|
||||
# define S_ISDIR(mode) ((mode)&_S_IFDIR)
|
||||
# define S_ISDIR(mode) ((mode) & _S_IFDIR)
|
||||
#endif
|
||||
|
||||
#ifdef COMPLEX_TEST_LINK_STATIC
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
#ifdef _WIN32
|
||||
__declspec(dllimport)
|
||||
#endif
|
||||
extern void dep1(void);
|
||||
extern void
|
||||
dep1(void);
|
||||
|
||||
#ifdef _WIN32
|
||||
__declspec(dllexport)
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
#ifdef _WIN32
|
||||
__declspec(dllimport)
|
||||
#endif
|
||||
extern void dep8(void);
|
||||
extern void
|
||||
dep8(void);
|
||||
|
||||
#ifdef _WIN32
|
||||
__declspec(dllexport)
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
#ifdef _WIN32
|
||||
__declspec(dllimport)
|
||||
#endif
|
||||
extern void dep9(void);
|
||||
extern void
|
||||
dep9(void);
|
||||
|
||||
#ifdef _WIN32
|
||||
__declspec(dllexport)
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
#ifdef _WIN32
|
||||
__declspec(dllimport)
|
||||
#endif
|
||||
extern void dep6(void);
|
||||
extern void
|
||||
dep6(void);
|
||||
|
||||
#ifdef _WIN32
|
||||
__declspec(dllexport)
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
#ifdef _WIN32
|
||||
__declspec(dllimport)
|
||||
#endif
|
||||
extern void dep7(void);
|
||||
extern void
|
||||
dep7(void);
|
||||
|
||||
#ifdef _WIN32
|
||||
__declspec(dllexport)
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
#ifdef _WIN32
|
||||
__declspec(dllimport)
|
||||
#endif
|
||||
extern void dep3(void);
|
||||
extern void
|
||||
dep3(void);
|
||||
#ifdef _WIN32
|
||||
__declspec(dllimport)
|
||||
#endif
|
||||
extern void dep4(void);
|
||||
extern void
|
||||
dep4(void);
|
||||
|
||||
int main(void)
|
||||
{
|
||||
|
||||
@@ -26,7 +26,7 @@ int main(void)
|
||||
b[i] = (float)(1000 * i);
|
||||
}
|
||||
/* compute on the GPU */
|
||||
#pragma acc data copyin(a [0:n], b [0:n]) copyout(r [0:n])
|
||||
#pragma acc data copyin(a[0 : n], b[0 : n]) copyout(r[0 : n])
|
||||
{
|
||||
vecaddgpu(r, a, b, n);
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ int main(int, char*[])
|
||||
auto a_ptr = a.data();
|
||||
auto b_ptr = b.data();
|
||||
auto r_ptr = r.data();
|
||||
#pragma acc data copyin(a_ptr [0:n], b_ptr [0:n]) copyout(r_ptr [0:n])
|
||||
#pragma acc data copyin(a_ptr[0 : n], b_ptr[0 : n]) copyout(r_ptr[0 : n])
|
||||
{
|
||||
vecaddgpu(r_ptr, a_ptr, b_ptr, n);
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
__declspec(dllexport)
|
||||
#endif
|
||||
|
||||
extern void foo(void)
|
||||
extern void
|
||||
foo(void)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
#ifdef _WIN32
|
||||
__declspec(dllimport)
|
||||
#endif
|
||||
extern void foo(void);
|
||||
extern void
|
||||
foo(void);
|
||||
#ifdef _WIN32
|
||||
__declspec(dllexport)
|
||||
#endif
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
#ifdef _WIN32
|
||||
__declspec(dllimport)
|
||||
#endif
|
||||
extern void bar();
|
||||
extern void
|
||||
bar();
|
||||
|
||||
int main(void)
|
||||
{
|
||||
|
||||
@@ -11,7 +11,7 @@ class LObject : public QObject
|
||||
Q_OBJECT
|
||||
public:
|
||||
Q_SLOT
|
||||
void aSlot(){};
|
||||
void aSlot() {};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -8,7 +8,7 @@ class IncAPrivate : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
IncAPrivate(){};
|
||||
IncAPrivate() {};
|
||||
};
|
||||
|
||||
IncA::IncA()
|
||||
|
||||
@@ -6,7 +6,7 @@ class IncBPrivate : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
IncBPrivate(){};
|
||||
IncBPrivate() {};
|
||||
};
|
||||
|
||||
IncB::IncB()
|
||||
|
||||
@@ -4,8 +4,8 @@ class QItemC_Local : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QItemC_Local(){};
|
||||
~QItemC_Local(){};
|
||||
QItemC_Local() {};
|
||||
~QItemC_Local() {};
|
||||
};
|
||||
|
||||
void QItemC::go()
|
||||
|
||||
@@ -4,8 +4,8 @@ class QItemD_Local : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
QItemD_Local(){};
|
||||
~QItemD_Local(){};
|
||||
QItemD_Local() {};
|
||||
~QItemD_Local() {};
|
||||
};
|
||||
|
||||
void QItemD::go()
|
||||
|
||||
@@ -7,7 +7,7 @@ class Object_h : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_SLOT
|
||||
void go(){};
|
||||
void go() {};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -7,7 +7,7 @@ class Object_hh : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_SLOT
|
||||
void go(){};
|
||||
void go() {};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -7,7 +7,7 @@ class Object_hpp : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_SLOT
|
||||
void go(){};
|
||||
void go() {};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -7,7 +7,7 @@ class Object_hxx : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_SLOT
|
||||
void go(){};
|
||||
void go() {};
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -7,11 +7,13 @@
|
||||
#ifdef _WIN32
|
||||
__declspec(dllexport)
|
||||
#endif
|
||||
QString tr2xi18n(const char* text, const char* comment = 0);
|
||||
QString
|
||||
tr2xi18n(const char* text, const char* comment = 0);
|
||||
|
||||
#ifdef _WIN32
|
||||
__declspec(dllexport)
|
||||
#endif
|
||||
QString tr2i18n(const char* text, const char* comment = 0);
|
||||
QString
|
||||
tr2i18n(const char* text, const char* comment = 0);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -4,7 +4,7 @@ class LocalObject : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
LocalObject(){};
|
||||
LocalObject() {};
|
||||
};
|
||||
|
||||
void mocOnly()
|
||||
|
||||
@@ -10,8 +10,8 @@ void hello()
|
||||
{
|
||||
printf("hello");
|
||||
}
|
||||
void Hello::operator delete[](void*){};
|
||||
void Hello::operator delete(void*){};
|
||||
void Hello::operator delete[](void*) {};
|
||||
void Hello::operator delete(void*) {};
|
||||
|
||||
#ifdef HELLO_VFTABLE
|
||||
HelloVFTable::HelloVFTable()
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
#ifdef _WIN32
|
||||
__declspec(dllimport)
|
||||
#endif
|
||||
extern void lib2(void);
|
||||
extern void
|
||||
lib2(void);
|
||||
|
||||
#ifdef _WIN32
|
||||
__declspec(dllexport)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#ifdef _WIN32
|
||||
__declspec(dllimport)
|
||||
#endif
|
||||
extern void lib1(void);
|
||||
extern void
|
||||
lib1(void);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#ifdef _WIN32
|
||||
__declspec(dllimport)
|
||||
#endif
|
||||
extern void lib2(void);
|
||||
extern void
|
||||
lib2(void);
|
||||
|
||||
@@ -3,7 +3,7 @@ class
|
||||
#ifdef _WIN32
|
||||
__declspec(dllexport)
|
||||
#endif
|
||||
Bar
|
||||
Bar
|
||||
{
|
||||
public:
|
||||
int bar();
|
||||
|
||||
@@ -3,7 +3,7 @@ class
|
||||
#ifdef _WIN32
|
||||
__declspec(dllexport)
|
||||
#endif
|
||||
Foo
|
||||
Foo
|
||||
{
|
||||
public:
|
||||
int foo();
|
||||
|
||||
@@ -19,7 +19,7 @@ private:
|
||||
|
||||
public:
|
||||
Circle(double r)
|
||||
: radius(r){};
|
||||
: radius(r) {};
|
||||
virtual double area(void);
|
||||
virtual double perimeter(void);
|
||||
};
|
||||
@@ -31,7 +31,7 @@ private:
|
||||
|
||||
public:
|
||||
Square(double w)
|
||||
: width(w){};
|
||||
: width(w) {};
|
||||
virtual double area(void);
|
||||
virtual double perimeter(void);
|
||||
};
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include <cstring>
|
||||
|
||||
template <size_t N>
|
||||
constexpr size_t cmStrLen(const char (&/*str*/)[N])
|
||||
constexpr size_t cmStrLen(const char (& /*str*/)[N])
|
||||
{
|
||||
return N - 1;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include <cstring>
|
||||
|
||||
template <size_t N>
|
||||
constexpr size_t cmStrLen(const char (&/*str*/)[N])
|
||||
constexpr size_t cmStrLen(const char (& /*str*/)[N])
|
||||
{
|
||||
return N - 1;
|
||||
}
|
||||
|
||||
@@ -221,7 +221,7 @@ inline auto data(C& c) -> decltype(c.data())
|
||||
# else
|
||||
inline constexpr auto data(C& c) noexcept(noexcept(c.data()))
|
||||
# endif
|
||||
-> decltype(c.data())
|
||||
-> decltype(c.data())
|
||||
{
|
||||
return c.data();
|
||||
}
|
||||
|
||||
@@ -212,8 +212,9 @@ bool contains(Iterator first, Iterator last, Key const& key)
|
||||
|
||||
#if defined(__SUNPRO_CC)
|
||||
template <typename Range, typename Key>
|
||||
auto contains(Range const& range, Key const& key, detail::overload_selector<1>)
|
||||
-> decltype(range.find(key) != range.end())
|
||||
auto contains(Range const& range, Key const& key,
|
||||
detail::overload_selector<1>) -> decltype(range.find(key) !=
|
||||
range.end())
|
||||
#else
|
||||
template <
|
||||
typename Range, typename Key,
|
||||
|
||||
Reference in New Issue
Block a user