mirror of
https://github.com/NGSolve/netgen.git
synced 2025-01-26 12:50:34 +05:00
Fix/disable some core guidelines warnings
This commit is contained in:
parent
81a06181b4
commit
0525b8b61f
@ -1,5 +1,8 @@
|
|||||||
Checks: '*,-clang-analyzer-alpha.*,-*braces-around-statements,-fuchsia-*,-google-runtime-references,-readability-implicit-bool-conversion,-google-explicit-constructor,-hicpp-explicit-conversions,-google-runtime-int,-llvm-header-guard,-modernize-pass-by-value'
|
Checks: '*,-clang-analyzer-alpha.*,-*braces-around-statements,-fuchsia-*,-google-runtime-references,-readability-implicit-bool-conversion,-google-explicit-constructor,-hicpp-explicit-conversions,-google-runtime-int,-llvm-header-guard,-modernize-pass-by-value,-cppcoreguidelines-non-private-member-variables-in-classes,-misc-non-private-member-variables-in-classes,-readability-magic-numbers,-cppcoreguidelines-avoid-magic-numbers'
|
||||||
CheckOptions:
|
CheckOptions:
|
||||||
- key: cppcoreguidelines-special-member-functions.AllowSoleDefaultDtor
|
- key: cppcoreguidelines-special-member-functions.AllowSoleDefaultDtor
|
||||||
value: 1
|
value: 1
|
||||||
|
- key: cppcoreguidelines-macro-usage.AllowedRegexp
|
||||||
|
value: NGCORE_*|NETGEN_*|NG_EXCEPTION*
|
||||||
|
|
||||||
WarningsAsErrors: '*'
|
WarningsAsErrors: '*'
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#ifndef NETGEN_CORE_ARCHIVE_HPP
|
#ifndef NETGEN_CORE_ARCHIVE_HPP
|
||||||
#define NETGEN_CORE_ARCHIVE_HPP
|
#define NETGEN_CORE_ARCHIVE_HPP
|
||||||
|
|
||||||
|
#include <array> // for array
|
||||||
#include <complex> // for complex
|
#include <complex> // for complex
|
||||||
#include <cstring> // for size_t, strlen
|
#include <cstring> // for size_t, strlen
|
||||||
#include <fstream> // for ifstream, ofstream
|
#include <fstream> // for ifstream, ofstream
|
||||||
@ -657,7 +658,7 @@ namespace ngcore
|
|||||||
class NGCORE_API BinaryOutArchive : public Archive
|
class NGCORE_API BinaryOutArchive : public Archive
|
||||||
{
|
{
|
||||||
static constexpr size_t BUFFERSIZE = 1024;
|
static constexpr size_t BUFFERSIZE = 1024;
|
||||||
char buffer[BUFFERSIZE] = {};
|
std::array<char,BUFFERSIZE> buffer{};
|
||||||
size_t ptr = 0;
|
size_t ptr = 0;
|
||||||
protected:
|
protected:
|
||||||
std::shared_ptr<std::ostream> stream;
|
std::shared_ptr<std::ostream> stream;
|
||||||
@ -701,7 +702,7 @@ namespace ngcore
|
|||||||
}
|
}
|
||||||
Archive & operator & (char *& str) override
|
Archive & operator & (char *& str) override
|
||||||
{
|
{
|
||||||
long len = str ? strlen (str) : -1;
|
long len = str ? static_cast<long>(strlen (str)) : -1;
|
||||||
(*this) & len;
|
(*this) & len;
|
||||||
FlushBuffer();
|
FlushBuffer();
|
||||||
if(len > 0)
|
if(len > 0)
|
||||||
@ -838,7 +839,7 @@ namespace ngcore
|
|||||||
}
|
}
|
||||||
Archive & operator & (char *& str) override
|
Archive & operator & (char *& str) override
|
||||||
{
|
{
|
||||||
long len = str ? strlen (str) : -1;
|
long len = str ? static_cast<long>(strlen (str)) : -1;
|
||||||
*this & len;
|
*this & len;
|
||||||
if(len > 0)
|
if(len > 0)
|
||||||
{
|
{
|
||||||
@ -994,7 +995,7 @@ namespace ngcore
|
|||||||
std::string(pybind11::str(output)));
|
std::string(pybind11::str(output)));
|
||||||
return output;
|
return output;
|
||||||
},
|
},
|
||||||
[](pybind11::tuple state)
|
[](const pybind11::tuple & state)
|
||||||
{
|
{
|
||||||
T* val = nullptr;
|
T* val = nullptr;
|
||||||
GetLogger("Archive")->trace("State for unpickling of object of type {} = {}",
|
GetLogger("Archive")->trace("State for unpickling of object of type {} = {}",
|
||||||
|
@ -98,7 +98,7 @@ namespace ngcore
|
|||||||
// return time in milliseconds as double
|
// return time in milliseconds as double
|
||||||
// return std::chrono::duration<double>(t-start_time).count()*1000.0;
|
// return std::chrono::duration<double>(t-start_time).count()*1000.0;
|
||||||
// return std::chrono::duration<double>(t-start_time).count() / 2.7e3;
|
// return std::chrono::duration<double>(t-start_time).count() / 2.7e3;
|
||||||
return 1000.0*(t-start_time) / ticks_per_second;
|
return 1000.0*static_cast<double>(t-start_time) / ticks_per_second;
|
||||||
}
|
}
|
||||||
|
|
||||||
enum PType
|
enum PType
|
||||||
@ -241,7 +241,9 @@ namespace ngcore
|
|||||||
}
|
}
|
||||||
|
|
||||||
int alias = ++alias_counter;
|
int alias = ++alias_counter;
|
||||||
double r,g,b;
|
double r;
|
||||||
|
double g;
|
||||||
|
double b;
|
||||||
Hue2RGB( hue, r, g, b );
|
Hue2RGB( hue, r, g, b );
|
||||||
fprintf( ctrace_stream, "%d\ta%d\ta%d\t\"%s\"\t\"%.15g %.15g %.15g\"\n", PajeDefineEntityValue, alias, type, name.c_str(), r,g,b ); // NOLINT
|
fprintf( ctrace_stream, "%d\ta%d\ta%d\t\"%s\"\t\"%.15g %.15g %.15g\"\n", PajeDefineEntityValue, alias, type, name.c_str(), r,g,b ); // NOLINT
|
||||||
return alias;
|
return alias;
|
||||||
@ -346,7 +348,7 @@ namespace ngcore
|
|||||||
|
|
||||||
void PajeTrace::Write( const std::string & filename )
|
void PajeTrace::Write( const std::string & filename )
|
||||||
{
|
{
|
||||||
int n_events = jobs.size() + timer_events.size();
|
auto n_events = jobs.size() + timer_events.size();
|
||||||
for(auto & vtasks : tasks)
|
for(auto & vtasks : tasks)
|
||||||
n_events += vtasks.size();
|
n_events += vtasks.size();
|
||||||
|
|
||||||
@ -558,11 +560,11 @@ namespace ngcore
|
|||||||
// Write HTML file drawing a sunburst chart with cumulated timings
|
// Write HTML file drawing a sunburst chart with cumulated timings
|
||||||
struct TreeNode
|
struct TreeNode
|
||||||
{
|
{
|
||||||
int id;
|
int id = 0;
|
||||||
std::map<int, TreeNode> children;
|
std::map<int, TreeNode> children;
|
||||||
double time;
|
double time = 0.0;
|
||||||
std::string name;
|
std::string name;
|
||||||
TTimePoint start_time;
|
TTimePoint start_time = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
void PrintNode (const TreeNode &n, int &level, std::ofstream & f);
|
void PrintNode (const TreeNode &n, int &level, std::ofstream & f);
|
||||||
@ -627,7 +629,7 @@ namespace ngcore
|
|||||||
|
|
||||||
std::sort (events.begin(), events.end());
|
std::sort (events.begin(), events.end());
|
||||||
|
|
||||||
root.time = 1000.0*(stop_time-start_time)/ticks_per_second;
|
root.time = 1000.0*static_cast<double>(stop_time-start_time)/ticks_per_second;
|
||||||
|
|
||||||
for(auto & event : events)
|
for(auto & event : events)
|
||||||
{
|
{
|
||||||
@ -652,7 +654,7 @@ namespace ngcore
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
double time = 1000.0*(event.time-current->start_time)/ticks_per_second;
|
double time = 1000.0*static_cast<double>(event.time-current->start_time)/ticks_per_second;
|
||||||
current->time += time;
|
current->time += time;
|
||||||
current = node_stack.back();
|
current = node_stack.back();
|
||||||
current->time -= time;
|
current->time -= time;
|
||||||
|
@ -8,10 +8,10 @@ namespace ngcore
|
|||||||
|
|
||||||
std::string NgProfiler::filename;
|
std::string NgProfiler::filename;
|
||||||
|
|
||||||
size_t NgProfiler::dummy_thread_times[NgProfiler::SIZE];
|
std::array<size_t,NgProfiler::SIZE> NgProfiler::dummy_thread_times;
|
||||||
size_t * NgProfiler::thread_times = NgProfiler::dummy_thread_times; // NOLINT
|
size_t * NgProfiler::thread_times = NgProfiler::dummy_thread_times.data(); // NOLINT
|
||||||
size_t NgProfiler::dummy_thread_flops[NgProfiler::SIZE];
|
std::array<size_t,NgProfiler::SIZE> NgProfiler::dummy_thread_flops;
|
||||||
size_t * NgProfiler::thread_flops = NgProfiler::dummy_thread_flops; // NOLINT
|
size_t * NgProfiler::thread_flops = NgProfiler::dummy_thread_flops.data(); // NOLINT
|
||||||
|
|
||||||
std::shared_ptr<Logger> NgProfiler::logger = GetLogger("Profiler"); // NOLINT
|
std::shared_ptr<Logger> NgProfiler::logger = GetLogger("Profiler"); // NOLINT
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#ifndef NETGEN_CORE_PROFILER_HPP
|
#ifndef NETGEN_CORE_PROFILER_HPP
|
||||||
#define NETGEN_CORE_PROFILER_HPP
|
#define NETGEN_CORE_PROFILER_HPP
|
||||||
|
|
||||||
|
#include <array>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
@ -35,8 +36,8 @@ namespace ngcore
|
|||||||
NGCORE_API static TTimePoint * thread_times;
|
NGCORE_API static TTimePoint * thread_times;
|
||||||
NGCORE_API static TTimePoint * thread_flops;
|
NGCORE_API static TTimePoint * thread_flops;
|
||||||
NGCORE_API static std::shared_ptr<Logger> logger;
|
NGCORE_API static std::shared_ptr<Logger> logger;
|
||||||
NGCORE_API static size_t dummy_thread_times[NgProfiler::SIZE];
|
NGCORE_API static std::array<size_t, NgProfiler::SIZE> dummy_thread_times;
|
||||||
NGCORE_API static size_t dummy_thread_flops[NgProfiler::SIZE];
|
NGCORE_API static std::array<size_t, NgProfiler::SIZE> dummy_thread_flops;
|
||||||
private:
|
private:
|
||||||
|
|
||||||
NGCORE_API static std::string filename;
|
NGCORE_API static std::string filename;
|
||||||
|
@ -33,7 +33,7 @@ namespace ngcore
|
|||||||
auto tick_end = GetTimeCounter();
|
auto tick_end = GetTimeCounter();
|
||||||
tend = WallTime();
|
tend = WallTime();
|
||||||
|
|
||||||
return (tick_end-tick_start)/(tend-tstart);
|
return static_cast<double>(tick_end-tick_start)/(tend-tstart);
|
||||||
}();
|
}();
|
||||||
|
|
||||||
const std::chrono::time_point<TClock> wall_time_start = TClock::now();
|
const std::chrono::time_point<TClock> wall_time_start = TClock::now();
|
||||||
|
Loading…
Reference in New Issue
Block a user