Sfoglia il codice sorgente

More compiler warnings

Kajetan Johannes Hammerle 11 mesi fa
parent
commit
ef2028918d
3 ha cambiato i file con 27 aggiunte e 16 eliminazioni
  1. 24 14
      meson.build
  2. 1 0
      thread/Thread.cpp
  3. 2 2
      utils/Clock.cpp

+ 24 - 14
meson.build

@@ -55,20 +55,30 @@ src_tests = [
 
 compiler = meson.get_compiler('cpp')
 error_args = compiler.get_supported_arguments([
-    '-Wcast-align=strict', '-pedantic', '-Wmissing-declarations', '-Wdate-time', 
-    '-Winit-self', '-Woverlength-strings', '-Wsign-promo', '-Wnon-virtual-dtor', 
-    '-Wconversion', '-Woverloaded-virtual', '-Wdeprecated-enum-enum-conversion', 
-    '-Wdisabled-optimization', '-Winvalid-imported-macros', '-Wduplicated-cond', 
-    '-Wdeprecated-enum-float-conversion', '-Wduplicated-branches', '-Wformat=2', 
-    '-Wmissing-braces', '-Wsuggest-override', '-Wcast-qual', '-Wbidi-chars=any', 
-    '-Wzero-as-null-pointer-constant', '-pedantic-errors', '-Wnull-dereference', 
-    '-Wformat-signedness', '-Wfloat-equal', '-Wvolatile', '-Wctor-dtor-privacy', 
-    '-Winfinite-recursion', '-Wshift-overflow=2', '-Wmultichar', '-Walloc-zero', 
-    '-Wcomma-subscript', '-Wold-style-cast', '-Wwrite-strings', '-Wswitch-enum', 
-    '-Wredundant-decls', '-Werror', '-Wsign-conversion', '-Walloca', '-Wshadow',
-    '-Winvalid-pch', '-Wdeprecated-copy-dtor', '-Wundef', '-Wdouble-promotion',
-    '-Warith-conversion', '-Wextra', '-Wtrivial-auto-var-init', '-Wlogical-op', 
-    '-Wall', '-Wenum-conversion'
+    '-Wdeprecated-enum-float-conversion', '-Wctad-maybe-unsupported', '-Werror',
+    '-Wdeprecated-enum-enum-conversion', '-Winvalid-imported-macros', '-Wextra',
+    '-Wzero-as-null-pointer-constant', '-Wframe-larger-than=8388608', '-Wundef',
+    '-Wsuggest-attribute=const', '-Wunused-const-variable=2', '-Wwrite-strings',
+    '-Wconditionally-supported', '-Wimplicit-fallthrough=5', '-pedantic-errors',
+    '-Wlarger-than=1073741824', '-Wtrivial-auto-var-init', '-Wdouble-promotion',
+    '-Wsuggest-final-methods', '-Wdisabled-optimization', '-Wformat-signedness',
+    '-Wmissing-declarations', '-Wdeprecated-copy-dtor', '-Wduplicated-branches',
+    '-Wmultiple-inheritance', '-Wstrict-null-sentinel', '-Wformat-truncation=2',
+    '-Wanalyzer-too-complex', '-Wmissing-include-dirs', '-Wstack-usage=8388608',
+    '-Wstringop-overflow=4', '-Wsuggest-final-types', '-Wconversion', '-Wsynth',
+    '-Wvirtual-inheritance', '-Woverlength-strings', '-Wlogical-op', '-Wshadow',
+    '-Woverloaded-virtual', '-Winfinite-recursion', '-Wswitch-enum', '-Walloca',
+    '-Wattribute-alias=2', '-Wformat-overflow=2', '-Wfloat-equal', '-Wformat=2',
+    '-Wctor-dtor-privacy', '-Wstrict-overflow=5', '-Winvalid-pch', '-Wvolatile',
+    '-Wcast-align=strict', '-Wshift-overflow=2', '-Wcatch-value=3', '-pedantic',
+    '-Wsuggest-override', '-Wuse-after-free=3', '-Wunused-macros', '-Wnoexcept',
+    '-Wnon-virtual-dtor', '-Wnull-dereference', '-Wtrampolines', '-Walloc-zero',
+    '-Warith-conversion', '-Wsign-conversion', '-Wbidi-chars=any', '-Wregister',
+    '-Wcomma-subscript', '-Warray-parameter', '-Wold-style-cast', '-Winit-self',
+    '-Wplacement-new=2', '-Wstack-protector', '-Wmissing-braces', '-Wcast-qual',
+    '-Wenum-conversion', '-Waligned-new=all', '-Warray-bounds=2', '-Wdate-time',
+    '-Wredundant-decls', '-Wmismatched-tags', '-Wredundant-tags', '-Wmultichar',
+    '-Wall', '-Wbidi-chars', '-Wsign-promo', '-Wduplicated-cond'
 ])
 compile_args = compiler.get_supported_arguments([
     '-nostdinc++', '-fno-exceptions', '-fno-rtti', '-fno-threadsafe-statics'

+ 1 - 0
thread/Thread.cpp

@@ -13,6 +13,7 @@ Core::Error Core::Thread::start(Id& id, Function f, void* p) {
     CORE_RETURN_ERROR(threads.tryEmplace(t, id));
     if(thrd_create(t, f, p) != thrd_success) {
         (void)threads.remove(id);
+        id = INVALID_ID;
         return Error::THREAD_ERROR;
     }
     return Error::NONE;

+ 2 - 2
utils/Clock.cpp

@@ -28,7 +28,7 @@ float Core::Clock::getUpdatesPerSecond() const {
 }
 
 Core::Error Core::Clock::getNanos(Clock::Nanos& n) {
-    struct timespec ts;
+    timespec ts;
     if(timespec_get(&ts, TIME_UTC) == 0) {
         return Error::TIME_NOT_AVAILABLE;
     }
@@ -38,7 +38,7 @@ Core::Error Core::Clock::getNanos(Clock::Nanos& n) {
 }
 
 Core::Error Core::Clock::wait(Nanos nanos) const {
-    struct timespec t;
+    timespec t;
     t.tv_nsec = nanos % 1'000'000'000;
     t.tv_sec = nanos / 1'000'000'000;
     return thrd_sleep(&t, nullptr) != 0 ? Error::SLEEP_INTERRUPTED