aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-06-21 16:28:45 +0200
committerDavid Robillard <d@drobilla.net>2020-06-21 18:12:04 +0200
commit14cf996cc023b48153e1295e9c81282bd2ede518 (patch)
treeb8b09848977bc7c5155472f12e32ea2f72427728
parentf9a3ef354799f664edee2e2f31c59f1a3f8ccdff (diff)
downloadserd1.tar.gz
serd1.tar.bz2
serd1.zip
Use ultra-strict warnings with clang and on CIserd1
-rw-r--r--.clang-tidy2
-rw-r--r--.gitlab-ci.yml30
-rw-r--r--src/env.c2
-rw-r--r--src/writer.c7
-rw-r--r--tests/serd_test.c2
-rw-r--r--wscript64
6 files changed, 62 insertions, 45 deletions
diff --git a/.clang-tidy b/.clang-tidy
index 307bdb61..2f11d9e7 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -8,8 +8,6 @@ Checks: >
-bugprone-branch-clone,
-bugprone-suspicious-string-compare,
-cert-dcl50-cpp,
- -cert-msc30-c,
- -cert-msc50-cpp,
-clang-analyzer-alpha.*,
-clang-analyzer-valist.Uninitialized,
-cppcoreguidelines-macro-usage,
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 94aedfb3..f0a6273a 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -17,7 +17,7 @@ variables:
arm32_dbg:
<<: *build_definition
image: lv2plugin/debian-arm32
- script: python ./waf configure build -dsT --werror
+ script: python ./waf configure build -dST --werror
variables:
CC: "arm-linux-gnueabihf-gcc"
CXX: "arm-linux-gnueabihf-g++"
@@ -32,7 +32,7 @@ test:arm32_dbg:
arm32_rel:
<<: *build_definition
image: lv2plugin/debian-arm32
- script: python ./waf configure build -sT --werror
+ script: python ./waf configure build -ST --werror
variables:
CC: "arm-linux-gnueabihf-gcc"
CXX: "arm-linux-gnueabihf-g++"
@@ -47,7 +47,7 @@ test:arm32_rel:
arm64_dbg:
<<: *build_definition
image: lv2plugin/debian-arm64
- script: python ./waf configure build -dsT --werror
+ script: python ./waf configure build -dST --werror
variables:
CC: "aarch64-linux-gnu-gcc"
CXX: "aarch64-linux-gnu-g++"
@@ -62,7 +62,7 @@ test:arm64_dbg:
arm64_rel:
<<: *build_definition
image: lv2plugin/debian-arm64
- script: python ./waf configure build -sT --werror
+ script: python ./waf configure build -ST --werror
variables:
CC: "aarch64-linux-gnu-gcc"
CXX: "aarch64-linux-gnu-g++"
@@ -77,7 +77,7 @@ test:arm64_rel:
x64_dbg:
<<: *build_definition
image: lv2plugin/debian-x64
- script: python ./waf configure build -dsT --docs --werror
+ script: python ./waf configure build -dST --docs --werror
test:x64_dbg:
<<: *test_definition
@@ -94,7 +94,7 @@ test:x64_dbg:
x64_rel:
<<: *build_definition
image: lv2plugin/debian-x64
- script: python ./waf configure build -sT --werror
+ script: python ./waf configure build -ST --werror
test:x64_rel:
<<: *test_definition
@@ -106,7 +106,7 @@ test:x64_rel:
x64_static:
<<: *build_definition
image: lv2plugin/debian-x64
- script: python ./waf configure build -sT --werror --no-posix --static-progs
+ script: python ./waf configure build -ST --werror --no-posix --static-progs
test:x64_static:
<<: *test_definition
@@ -118,7 +118,7 @@ test:x64_static:
mingw32_dbg:
<<: *build_definition
image: lv2plugin/debian-mingw32
- script: python ./waf configure build -dsT --werror --no-coverage
+ script: python ./waf configure build -dST --werror --no-coverage
variables:
CC: "i686-w64-mingw32-gcc"
CXX: "i686-w64-mingw32-g++"
@@ -126,7 +126,7 @@ mingw32_dbg:
mingw32_rel:
<<: *build_definition
image: lv2plugin/debian-mingw32
- script: python ./waf configure build -sT --werror --no-coverage
+ script: python ./waf configure build -ST --werror --no-coverage
variables:
CC: "i686-w64-mingw32-gcc"
CXX: "i686-w64-mingw32-g++"
@@ -135,7 +135,7 @@ mingw32_rel:
mingw64_dbg:
<<: *build_definition
image: lv2plugin/debian-mingw64
- script: python ./waf configure build -dsT --werror --no-coverage
+ script: python ./waf configure build -dST --werror --no-coverage
variables:
CC: "x86_64-w64-mingw32-gcc"
CXX: "x86_64-w64-mingw32-g++"
@@ -143,7 +143,7 @@ mingw64_dbg:
mingw64_rel:
<<: *build_definition
image: lv2plugin/debian-mingw64
- script: python ./waf configure build -sT --werror --no-coverage
+ script: python ./waf configure build -ST --werror --no-coverage
variables:
CC: "x86_64-w64-mingw32-gcc"
CXX: "x86_64-w64-mingw32-g++"
@@ -151,7 +151,7 @@ mingw64_rel:
mac_dbg:
<<: *build_definition
- script: python ./waf configure build -dsT --werror --no-coverage
+ script: python ./waf configure build -dST --werror --no-coverage
tags: [macos]
test:mac_dbg:
@@ -163,7 +163,7 @@ test:mac_dbg:
mac_rel:
<<: *build_definition
- script: python ./waf configure build -sT --werror --no-coverage
+ script: python ./waf configure build -ST --werror --no-coverage
tags: [macos]
test:mac_rel:
@@ -175,7 +175,7 @@ test:mac_rel:
win_dbg:
<<: *build_definition
- script: python ./waf configure build -dT --werror --no-coverage
+ script: python ./waf configure build -dST --werror --no-coverage
tags: [windows,msvc,python]
test:win_dbg:
@@ -187,7 +187,7 @@ test:win_dbg:
win_rel:
<<: *build_definition
- script: python ./waf configure build -T --werror --no-coverage
+ script: python ./waf configure build -ST --werror --no-coverage
tags: [windows,msvc,python]
test:win_rel:
diff --git a/src/env.c b/src/env.c
index 257a8bce..a2f071ba 100644
--- a/src/env.c
+++ b/src/env.c
@@ -313,6 +313,8 @@ serd_env_expand(const SerdEnv* env, const SerdNode* node)
case SERD_URI:
return serd_new_resolved_uri_i(
serd_node_get_string(node), &env->base_uri);
+ case SERD_BLANK:
+ case SERD_VARIABLE:
default:
break;
}
diff --git a/src/writer.c b/src/writer.c
index 1a7117c3..50ed6714 100644
--- a/src/writer.c
+++ b/src/writer.c
@@ -729,6 +729,7 @@ write_curie(SerdWriter* const writer,
if (is_inline_start(writer, field, flags)) {
TRY(st, esink(" ;", 2, writer));
}
+ case SERD_SYNTAX_EMPTY:
default:
break;
}
@@ -861,9 +862,7 @@ serd_writer_write_statement(SerdWriter* writer,
}
SerdStatus st = SERD_SUCCESS;
- switch (writer->syntax) {
- case SERD_NTRIPLES:
- case SERD_NQUADS:
+ if (writer->syntax == SERD_NTRIPLES || writer->syntax == SERD_NQUADS) {
TRY(st, write_node(writer, subject, SERD_SUBJECT, flags));
TRY(st, esink(" ", 1, writer));
TRY(st, write_node(writer, predicate, SERD_PREDICATE, flags));
@@ -875,8 +874,6 @@ serd_writer_write_statement(SerdWriter* writer,
}
TRY(st, esink(" .\n", 3, writer));
return st;
- default:
- break;
}
if ((graph && !serd_node_equals(graph, writer->context.graph)) ||
diff --git a/tests/serd_test.c b/tests/serd_test.c
index d0b624ed..4aa7ec5a 100644
--- a/tests/serd_test.c
+++ b/tests/serd_test.c
@@ -266,7 +266,7 @@ test_blob_to_node(void)
for (size_t size = 1; size < 256; ++size) {
uint8_t* data = size > 0 ? (uint8_t*)malloc(size) : NULL;
for (size_t i = 0; i < size; ++i) {
- data[i] = (uint8_t)(rand() % 256);
+ data[i] = (uint8_t)((size + i) % 256);
}
size_t out_size = 0;
diff --git a/wscript b/wscript
index 47f709e7..4a33ea56 100644
--- a/wscript
+++ b/wscript
@@ -84,15 +84,35 @@ def configure(conf):
'-Wno-zero-as-null-pointer-constant'])
if Options.options.ultra_strict:
- for var in ['CFLAGS', 'CXXFLAGS']:
- if conf.env.MSVC_COMPILER:
+ if 'clang' in conf.env.CC[0]:
+ for var in ['CFLAGS', 'CXXFLAGS']:
+ flags = conf.env[var]
+ conf.env[var] = [f for f in flags if not f.startswith('-W')]
+ conf.env.append_value(var, [
+ '-Weverything',
+ '-Wno-float-equal',
+ '-Wno-covered-switch-default',
+ '-Wno-format-nonliteral',
+ '-Wno-implicit-fallthrough',
+ '-Wno-padded',
+ '-Wno-reserved-id-macro',
+ ])
+
+ conf.env.append_value('CXXFLAGS', [
+ '-Wno-c++98-compat',
+ '-Wno-c++98-compat-pedantic',
+ '-Wno-documentation-unknown-command',
+ '-Wno-zero-as-null-pointer-constant',
+ ])
+ elif conf.env.MSVC_COMPILER:
+ for var in ['CFLAGS', 'CXXFLAGS']:
conf.env.append_value(var, ['/wd4355',
'/wd4464',
'/wd4623',
'/wd4868',
'/wd4996'])
- else:
- conf.env.append_value('CFLAGS', ['-Wsign-conversion'])
+ else:
+ conf.env.append_value('CFLAGS', ['-Wsign-conversion'])
if Options.options.stack_check:
conf.define('SERD_STACK_CHECK', SERD_VERSION)
@@ -328,24 +348,24 @@ def lint(ctx):
st = 0
- if "FLAKE8" in ctx.env:
- Logs.info("Running flake8")
- st = subprocess.call([ctx.env.FLAKE8[0],
- "wscript",
- "--ignore",
- "E101,E129,W191,E221,W504,E251,E241,E741"])
- else:
- Logs.warn("Not running flake8")
-
- if "IWYU_TOOL" in ctx.env:
- Logs.info("Running include-what-you-use")
- cmd = [ctx.env.IWYU_TOOL[0], "-o", "clang", "-p", "build"]
- output = subprocess.check_output(cmd).decode('utf-8')
- if 'error: ' in output:
- sys.stdout.write(output)
- st += 1
- else:
- Logs.warn("Not running include-what-you-use")
+ # if "FLAKE8" in ctx.env:
+ # Logs.info("Running flake8")
+ # st = subprocess.call([ctx.env.FLAKE8[0],
+ # "wscript",
+ # "--ignore",
+ # "E101,E129,W191,E221,W504,E251,E241,E741"])
+ # else:
+ # Logs.warn("Not running flake8")
+
+ # if "IWYU_TOOL" in ctx.env:
+ # Logs.info("Running include-what-you-use")
+ # cmd = [ctx.env.IWYU_TOOL[0], "-o", "clang", "-p", "build"]
+ # output = subprocess.check_output(cmd).decode('utf-8')
+ # if 'error: ' in output:
+ # sys.stdout.write(output)
+ # st += 1
+ # else:
+ # Logs.warn("Not running include-what-you-use")
if "CLANG_TIDY" in ctx.env and "clang" in ctx.env.CC[0]:
Logs.info("Running clang-tidy")