UwU 1 ay önce
ebeveyn
işleme
0d473d70c2

+ 1 - 0
CMakeModules/FindLZ4.cmake

@@ -17,6 +17,7 @@ if (LZ4_LIBRARY)
   set(CMAKE_REQUIRED_INCLUDES ${LZ4_INCLUDE_DIR})
   set(CMAKE_REQUIRED_LIBRARIES ${LZ4_LIBRARY})
   check_c_source_runs("
+#include <lz4.h>
 int main() {
   int good = (LZ4_VERSION_MAJOR > 1) ||
     ((LZ4_VERSION_MAJOR == 1) && (LZ4_VERSION_MINOR >= 7));

+ 6 - 6
src/WallpaperEngine/Render/Objects/Effects/CPass.h

@@ -290,18 +290,18 @@ private:
     std::map<std::string, ReferenceUniformEntry*> m_referenceUniforms = {};
     BlendingMode m_blendingmode = BlendingMode_Normal;
     std::optional<std::pair<DepthtestMode, DepthwriteMode>> m_depthState = std::nullopt;
-    const glm::mat4* m_modelViewProjectionMatrix;
+    const glm::mat4* m_modelViewProjectionMatrix = nullptr;
     const glm::mat4* m_effectModelViewProjectionOverride = nullptr;
     const glm::mat4* m_effectModelViewProjectionMatrix = nullptr;
-    const glm::mat4* m_modelViewProjectionMatrixInverse;
-    const glm::mat4* m_modelMatrix;
+    const glm::mat4* m_modelViewProjectionMatrixInverse = nullptr;
+    const glm::mat4* m_modelMatrix = nullptr;
     const glm::mat4* m_layerModelMatrix = &s_identity;
     static const glm::mat4 s_identity;
     const glm::mat4* m_lightingModelMatrix;
     bool m_fogWorld = false;
     const glm::mat3* m_lightingNormalMatrix;
     const glm::mat4* m_lightingViewProjectionMatrix;
-    const glm::mat4* m_viewProjectionMatrix;
+    const glm::mat4* m_viewProjectionMatrix = nullptr;
     const glm::mat4* m_effectTextureProjectionMatrix;
     const glm::mat4* m_effectTextureProjectionMatrixInverse;
     glm::mat4 m_layerModelViewProjection = glm::mat4 (1.0f);
@@ -332,8 +332,8 @@ private:
 
     GLint g_Texture0Rotation;
     GLint g_Texture0Translation;
-    GLuint a_TexCoord;
-    GLuint a_Position;
+    GLuint a_TexCoord = 0;
+    GLuint a_Position = 0;
     GLuint m_vao;
 
     GeometryCallback m_setupAttribsCallback;

+ 28 - 10
tools/static_analysis.py

@@ -2,7 +2,7 @@
 """Static analysis over our own sources (src/, not src/External) with PVS-Studio, the Clang Static Analyzer and clang-tidy.
 
 Usage:
-    static_analysis.py [-b build dir] [-o out dir] [-j jobs] pvs|csa|tidy|all
+    static_analysis.py [-b build dir] [-o out dir] [-j jobs] [--full] pvs|csa|tidy|all
 
 Needs a build made with CMAKE_EXPORT_COMPILE_COMMANDS=ON (default build dir: build). The compile database comes from
 GCC, so the clang tools get -Wno-unknown-warning-option for the GCC-only warning flags in it. Every tool works on a
@@ -16,6 +16,10 @@ count per check printed at the end:
     csa/     analyze-build in <jobs> shards, plist files per shard, failures/ for files clang could not parse
     tidy/    run-clang-tidy with the repo's .clang-tidy, tidy.log is its raw output
 
+--full widens the clang tools: the analyzer also runs the alpha, optin, security and cplusplus checkers (noisier, some
+report things that cannot happen), and clang-tidy gets a second run in tidy-full/ with the bugprone, cert, concurrency,
+misc, performance and portability groups besides the repo's own list.
+
 Run one tool at a time on a machine others are using, each one starts <jobs> processes.
 """
 import argparse
@@ -72,7 +76,7 @@ def write_report(out, findings):
         print(f'{count:6d}  {check}')
 
 
-def run_pvs(build, out, jobs):
+def run_pvs(build, out, jobs, full=False):
     folder = out / 'pvs'
     shutil.rmtree(folder, ignore_errors=True)
     database, entries = own_database(build, folder)
@@ -96,7 +100,13 @@ def run_pvs(build, out, jobs):
     write_report(folder, findings)
 
 
-def run_csa(build, out, jobs):
+CSA_FULL_CHECKERS = ['alpha.core', 'alpha.cplusplus', 'alpha.security', 'alpha.unix', 'alpha.deadcode',
+                     'optin.cplusplus', 'optin.performance', 'optin.portability', 'security', 'cplusplus', 'nullability']
+TIDY_FULL_CHECKS = ('-*,bugprone-*,cert-*,clang-analyzer-*,concurrency-*,misc-*,performance-*,portability-*,'
+                    '-misc-non-private-member-variables-in-classes,-misc-include-cleaner')
+
+
+def run_csa(build, out, jobs, full=False):
     folder = out / 'csa'
     shutil.rmtree(folder, ignore_errors=True)
     database, entries = own_database(build, folder)
@@ -112,9 +122,11 @@ def run_csa(build, out, jobs):
         wrapper.write_text(f'#!/bin/sh\ncase "$1" in -cc1*) exec clang++ "$@" ;; esac\n'
                            f'exec clang++ {CLANG_EXTRA_ARG} "$@"\n')
         wrapper.chmod(0o755)
-        shards.append(subprocess.Popen(['analyze-build', '--cdb', str(shard / 'compile_commands.json'),
-                                        '--output', str(shard / 'reports'), '--plist',
-                                        '--use-analyzer', str(wrapper)]))
+        command = ['analyze-build', '--cdb', str(shard / 'compile_commands.json'),
+                   '--output', str(shard / 'reports'), '--plist', '--use-analyzer', str(wrapper)]
+        for checker in CSA_FULL_CHECKERS if full else []:
+            command += ['--enable-checker', checker]
+        shards.append(subprocess.Popen(command))
     for process in shards:
         process.wait()
     findings = []
@@ -135,8 +147,13 @@ def run_csa(build, out, jobs):
     write_report(folder, findings)
 
 
-def run_tidy(build, out, jobs):
-    folder = out / 'tidy'
+def run_tidy(build, out, jobs, full=False):
+    run_tidy_with(build, out / 'tidy', jobs, None)
+    if full:
+        run_tidy_with(build, out / 'tidy-full', jobs, TIDY_FULL_CHECKS)
+
+
+def run_tidy_with(build, folder, jobs, checks):
     shutil.rmtree(folder, ignore_errors=True)
     database, entries = own_database(build, folder)
     log = folder / 'tidy.log'
@@ -144,7 +161,7 @@ def run_tidy(build, out, jobs):
     with open(log, 'w') as handle:
         subprocess.run(['run-clang-tidy', '-p', str(folder), '-j', str(jobs), '-quiet',
                         f'-extra-arg={CLANG_EXTRA_ARG}', f'-header-filter={header_filter}',
-                        f'-config-file={ROOT / ".clang-tidy"}'],
+                        f'-config-file={ROOT / ".clang-tidy"}', *([f'-checks={checks}'] if checks else [])],
                        stdout=handle, stderr=subprocess.STDOUT, check=False)
     pattern = re.compile(r'^(.+?):(\d+):(\d+): (warning|error): (.*) \[([\w.,-]+)\]$')
     findings = []
@@ -165,13 +182,14 @@ def main():
     parser.add_argument('tool', choices=[*TOOLS, 'all'])
     parser.add_argument('-b', '--build', type=Path, default=ROOT / 'build')
     parser.add_argument('-o', '--out', type=Path, default=ROOT / 'build' / 'static-analysis')
+    parser.add_argument('--full', action='store_true', help='wider clang analyzer and clang-tidy checks')
     parser.add_argument('-j', '--jobs', type=int, default=8)
     args = parser.parse_args()
     if not (args.build / 'compile_commands.json').exists():
         sys.exit(f'{args.build}/compile_commands.json is missing, configure with -DCMAKE_EXPORT_COMPILE_COMMANDS=ON')
     for name in (TOOLS if args.tool == 'all' else [args.tool]):
         print(f'== {name} ==', flush=True)
-        TOOLS[name](args.build.resolve(), args.out.resolve(), args.jobs)
+        TOOLS[name](args.build.resolve(), args.out.resolve(), args.jobs, args.full)
 
 
 if __name__ == '__main__':