Yesterday's cppcheck built fine. Not today. A compile error about SHOWTIME_NONE
lib/settings.cpp: In constructor ‘Settings::Settings()’:
lib/settings.cpp:69:30: error: ‘SHOWTIME_NONE’ is not a member of ‘SHOWTIME_MODES’
69 | showtime(SHOWTIME_MODES::SHOWTIME_NONE),
| ^~~~~~~~~~~~~
clang and g++ refuse to compile it, so I have no idea which compiler accepted the code.
I ran the preprocessor only and grepped for SHOWTIME:
Yesterday's cppcheck built fine. Not today. A compile error about SHOWTIME_NONE
lib/settings.cpp: In constructor ‘Settings::Settings()’:
lib/settings.cpp:69:30: error: ‘SHOWTIME_NONE’ is not a member of ‘SHOWTIME_MODES’
69 | showtime(SHOWTIME_MODES::SHOWTIME_NONE),
| ^~~~~~~~~~~~~
clang and g++ refuse to compile it, so I have no idea which compiler accepted the code.
I ran the preprocessor only and grepped for SHOWTIME:
$ grep SHOWTIME /tmp/q.ii
enum class SHOWTIME_MODES;
SHOWTIME_MODES showtime{};
showtime(SHOWTIME_MODES::SHOWTIME_NONE),
$
Bingo ! I fixed it like this:
diff --git a/lib/settings.cpp b/lib/settings.cpp
index 896341a..7b62612 100644
--- a/lib/settings.cpp
+++ b/lib/settings.cpp
@@ -24,6 +24,7 @@
#include <fstream></fstream>
#include "json.h"
+#include "timer.h"
std::atomic<bool> Settings::mTerminated;</bool>
In future, it might be wise to compile new code with multiple compilers before checking in.
The line you quote doesn't exist in
settings.cpp
. Also, head is building just fine in our CI.$ git diff lib/settings.cpp
diff --git a/lib/settings.cpp b/lib/settings.cpp
index 896341a..7b62612 100644
--- a/lib/settings.cpp
+++ b/lib/settings.cpp
@@ -24,6 +24,7 @@
#include <fstream></fstream>
#include "json.h"
+#include "timer.h"
std::atomic<bool> Settings::mTerminated;</bool>
So I think lib/settings.cpp is up to date.
In your CI, which C++ compiler do you use ? Perhaps Microsoft ?
I was referring to
lib/settings.cpp:69:30: error: ‘SHOWTIME_NONE’ is not a member of ‘SHOWTIME_MODES’ 69 | showtime(SHOWTIME_MODES::SHOWTIME_NONE),
.We use clang, gcc and msvc: https://github.com/danmar/cppcheck/actions
I haven't seen your CI before, so it can be no surprise that
I see no evidence of a build by gcc or clang from today in it.
I tried a git pull, just in case something had changed during
the day. It didn't help.
I have a self generated fix, so cppcheck builds for me here.
I think that's about as far as I want to go with this.
Thanks for your help.