aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-11-01 13:32:11 +0100
committerDavid Robillard <d@drobilla.net>2020-11-01 13:43:16 +0100
commitf0f058dbeb40d016501328ed755392b46eefec9b (patch)
tree3fe5ede0194084d6475ee25c0d07cda271d565f5
parent71a9fbf296928d3599743e88f72390ff827c5ab3 (diff)
downloadpugl-f0f058dbeb40d016501328ed755392b46eefec9b.tar.gz
pugl-f0f058dbeb40d016501328ed755392b46eefec9b.tar.bz2
pugl-f0f058dbeb40d016501328ed755392b46eefec9b.zip
Run clang-tidy on all headers and fix various issues
It's a nightmare trying to get this thing to check everything.
-rw-r--r--bindings/cxx/include/.clang-tidy7
-rw-r--r--bindings/cxx/include/pugl/cairo.hpp2
-rw-r--r--bindings/cxx/include/pugl/gl.hpp4
-rw-r--r--bindings/cxx/include/pugl/pugl.hpp4
-rw-r--r--bindings/cxx/include/pugl/stub.hpp2
-rw-r--r--bindings/cxx/include/pugl/vulkan.hpp2
-rw-r--r--include/.clang-tidy (renamed from include/pugl/.clang-tidy)3
-rw-r--r--src/.clang-tidy2
-rw-r--r--src/implementation.h6
-rw-r--r--wscript8
10 files changed, 30 insertions, 10 deletions
diff --git a/bindings/cxx/include/.clang-tidy b/bindings/cxx/include/.clang-tidy
index 6453ca0..182d0d7 100644
--- a/bindings/cxx/include/.clang-tidy
+++ b/bindings/cxx/include/.clang-tidy
@@ -1,5 +1,12 @@
Checks: >
*,
-*-uppercase-literal-suffix,
+ -clang-diagnostic-unused-macros,
+ -cppcoreguidelines-pro-bounds-pointer-arithmetic,
+ -cppcoreguidelines-pro-type-static-cast-downcast,
+ -google-runtime-references,
+ -modernize-use-trailing-return-type,
+ -readability-implicit-bool-conversion,
+ -readability-named-parameter,
FormatStyle: file
HeaderFilterRegex: 'pugl/.*'
diff --git a/bindings/cxx/include/pugl/cairo.hpp b/bindings/cxx/include/pugl/cairo.hpp
index 4df2702..d321b0b 100644
--- a/bindings/cxx/include/pugl/cairo.hpp
+++ b/bindings/cxx/include/pugl/cairo.hpp
@@ -35,7 +35,7 @@ namespace pugl {
*/
/// @copydoc puglCairoBackend
-static inline const PuglBackend*
+inline const PuglBackend*
cairoBackend() noexcept
{
return puglCairoBackend();
diff --git a/bindings/cxx/include/pugl/gl.hpp b/bindings/cxx/include/pugl/gl.hpp
index 2777cbf..ba7143b 100644
--- a/bindings/cxx/include/pugl/gl.hpp
+++ b/bindings/cxx/include/pugl/gl.hpp
@@ -38,14 +38,14 @@ namespace pugl {
using GlFunc = PuglGlFunc;
/// @copydoc puglGetProcAddress
-static inline GlFunc
+inline GlFunc
getProcAddress(const char* name) noexcept
{
return puglGetProcAddress(name);
}
/// @copydoc puglGlBackend
-static inline const PuglBackend*
+inline const PuglBackend*
glBackend() noexcept
{
return puglGlBackend();
diff --git a/bindings/cxx/include/pugl/pugl.hpp b/bindings/cxx/include/pugl/pugl.hpp
index 4f5f3cf..31903a9 100644
--- a/bindings/cxx/include/pugl/pugl.hpp
+++ b/bindings/cxx/include/pugl/pugl.hpp
@@ -210,7 +210,7 @@ enum class Status {
static_assert(Status(PUGL_UNSUPPORTED_TYPE) == Status::unsupportedType, "");
/// @copydoc puglStrerror
-static inline const char*
+inline const char*
strerror(const Status status) noexcept
{
return puglStrerror(static_cast<PuglStatus>(status));
@@ -278,6 +278,8 @@ public:
World(World&&) = delete;
World& operator=(World&&) = delete;
+ ~World() = default;
+
explicit World(WorldType type, WorldFlags flags)
: Wrapper{puglNewWorld(static_cast<PuglWorldType>(type), flags)}
{
diff --git a/bindings/cxx/include/pugl/stub.hpp b/bindings/cxx/include/pugl/stub.hpp
index 74e8ef2..02a8dc2 100644
--- a/bindings/cxx/include/pugl/stub.hpp
+++ b/bindings/cxx/include/pugl/stub.hpp
@@ -35,7 +35,7 @@ namespace pugl {
*/
/// @copydoc puglStubBackend
-static inline const PuglBackend*
+inline const PuglBackend*
stubBackend() noexcept
{
return puglStubBackend();
diff --git a/bindings/cxx/include/pugl/vulkan.hpp b/bindings/cxx/include/pugl/vulkan.hpp
index a7b16cb..5ce8acd 100644
--- a/bindings/cxx/include/pugl/vulkan.hpp
+++ b/bindings/cxx/include/pugl/vulkan.hpp
@@ -155,7 +155,7 @@ createSurface(const VulkanLoader& loader,
}
/// @copydoc puglVulkanBackend
-static inline const PuglBackend*
+inline const PuglBackend*
vulkanBackend() noexcept
{
return puglVulkanBackend();
diff --git a/include/pugl/.clang-tidy b/include/.clang-tidy
index 6453ca0..ccf7b3c 100644
--- a/include/pugl/.clang-tidy
+++ b/include/.clang-tidy
@@ -1,5 +1,8 @@
Checks: >
*,
+ -*-magic-numbers,
-*-uppercase-literal-suffix,
+ -clang-diagnostic-unused-function,
+ -clang-diagnostic-unused-macros,
FormatStyle: file
HeaderFilterRegex: 'pugl/.*'
diff --git a/src/.clang-tidy b/src/.clang-tidy
index 7bc36f7..bdbd078 100644
--- a/src/.clang-tidy
+++ b/src/.clang-tidy
@@ -5,8 +5,10 @@ Checks: >
-bugprone-suspicious-string-compare,
-cert-flp30-c,
-clang-analyzer-security.FloatLoopCounter,
+ -clang-diagnostic-unused-macros,
-hicpp-multiway-paths-covered,
-hicpp-signed-bitwise,
+ -llvm-header-guard,
-readability-else-after-return,
FormatStyle: file
HeaderFilterRegex: 'pugl/.*'
diff --git a/src/implementation.h b/src/implementation.h
index 3a8b6ca..6d961a8 100644
--- a/src/implementation.h
+++ b/src/implementation.h
@@ -19,8 +19,8 @@
@brief Shared declarations for implementation.
*/
-#ifndef PUGL_DETAIL_IMPLEMENTATION_H
-#define PUGL_DETAIL_IMPLEMENTATION_H
+#ifndef PUGL_IMPLEMENTATION_H
+#define PUGL_IMPLEMENTATION_H
#include "types.h"
@@ -84,4 +84,4 @@ puglSetInternalClipboard(PuglView* view,
PUGL_END_DECLS
-#endif // PUGL_DETAIL_IMPLEMENTATION_H
+#endif // PUGL_IMPLEMENTATION_H
diff --git a/wscript b/wscript
index d95f0a1..bd4d19a 100644
--- a/wscript
+++ b/wscript
@@ -694,6 +694,7 @@ class LintContext(Build.BuildContext):
def lint(ctx):
"checks code for style issues"
+ import glob
import json
import subprocess
@@ -736,9 +737,14 @@ def lint(ctx):
c_files = [os.path.join('build', f)
for f in files if f.endswith('.c')]
+ c_files += glob.glob('include/pugl/*.h')
+ c_files += glob.glob('src/implementation.h')
+
cpp_files = [os.path.join('build', f)
for f in files if f.endswith('.cpp')]
+ cpp_files += glob.glob('bindings/cxx/include/pugl/*')
+
c_files = list(map(os.path.abspath, c_files))
cpp_files = list(map(os.path.abspath, cpp_files))
@@ -749,7 +755,7 @@ def lint(ctx):
for cpp_file in cpp_files:
cmd = [ctx.env.CLANG_TIDY[0],
- '--header-filter=".*\\.hpp"',
+ '--header-filter=".*"',
"--quiet",
"-p=.", cpp_file]
procs += [subprocess.Popen(cmd, cwd="build")]