From 8353731836d8a79265d93792d29b8b4550a8c09e Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 21 Jun 2020 17:38:08 +0200 Subject: Clean up includes --- src/byte_source.c | 9 ++++++++- src/env.c | 7 +++++-- src/n3.c | 9 +++++---- src/node.c | 8 +++++++- src/reader.c | 3 +-- src/reader.h | 6 +++++- src/serd_internal.h | 15 ++++++++------- src/serdi.c | 11 +++++++---- src/string.c | 6 +++++- src/uri.c | 7 ++++++- src/writer.c | 7 ++++++- tests/serd_test.c | 9 +++++---- wscript | 8 ++++++++ 13 files changed, 76 insertions(+), 29 deletions(-) diff --git a/src/byte_source.c b/src/byte_source.c index 210e638e..329c89a3 100644 --- a/src/byte_source.c +++ b/src/byte_source.c @@ -1,5 +1,5 @@ /* - Copyright 2011-2017 David Robillard + Copyright 2011-2020 David Robillard Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above @@ -16,6 +16,13 @@ #include "serd_internal.h" +#include "serd/serd.h" + +#include +#include +#include +#include + SerdStatus serd_byte_source_page(SerdByteSource* source) { diff --git a/src/env.c b/src/env.c index 55284b8c..09a91d6a 100644 --- a/src/env.c +++ b/src/env.c @@ -1,5 +1,5 @@ /* - Copyright 2011-2016 David Robillard + Copyright 2011-2020 David Robillard Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above @@ -14,8 +14,11 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -#include "serd_internal.h" +#include "serd/serd.h" +#include +#include +#include #include #include diff --git a/src/n3.c b/src/n3.c index b9bc58cd..4b9ba7cf 100644 --- a/src/n3.c +++ b/src/n3.c @@ -1,5 +1,5 @@ /* - Copyright 2011-2017 David Robillard + Copyright 2011-2020 David Robillard Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above @@ -14,18 +14,19 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include "reader.h" #include "serd_internal.h" +#include "serd/serd.h" + #include #include -#include +#include #include #include #include #include -#include "reader.h" - #define TRY_THROW(exp) if (!(exp)) goto except; #define TRY_RET(exp) if (!(exp)) return 0; diff --git a/src/node.c b/src/node.c index 6a2e352f..5a84237d 100644 --- a/src/node.c +++ b/src/node.c @@ -1,5 +1,5 @@ /* - Copyright 2011-2016 David Robillard + Copyright 2011-2020 David Robillard Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above @@ -16,8 +16,14 @@ #include "serd_internal.h" +#include "serd/serd.h" + +#include #include #include +#include +#include +#include #include #include diff --git a/src/reader.c b/src/reader.c index ef393ec7..aec37bea 100644 --- a/src/reader.c +++ b/src/reader.c @@ -1,5 +1,5 @@ /* - Copyright 2011-2017 David Robillard + Copyright 2011-2020 David Robillard Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above @@ -17,7 +17,6 @@ #include "reader.h" #include "serd_internal.h" -#include #include #include #include diff --git a/src/reader.h b/src/reader.h index f7cdba02..adea6651 100644 --- a/src/reader.h +++ b/src/reader.h @@ -1,5 +1,5 @@ /* - Copyright 2011-2017 David Robillard + Copyright 2011-2020 David Robillard Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above @@ -16,7 +16,11 @@ #include "serd_internal.h" +#include "serd/serd.h" + #include +#include +#include #include static inline int diff --git a/src/serd_internal.h b/src/serd_internal.h index 9c58c151..dea98000 100644 --- a/src/serd_internal.h +++ b/src/serd_internal.h @@ -19,20 +19,21 @@ #define _POSIX_C_SOURCE 200809L /* for posix_memalign and posix_fadvise */ -#include -#include -#include -#include -#include -#include +#include "serd_config.h" #include "serd/serd.h" -#include "serd_config.h" #if defined(HAVE_POSIX_FADVISE) && defined(HAVE_FILENO) # include #endif +#include +#include +#include +#include +#include +#include + #define NS_XSD "http://www.w3.org/2001/XMLSchema#" #define NS_RDF "http://www.w3.org/1999/02/22-rdf-syntax-ns#" diff --git a/src/serdi.c b/src/serdi.c index 03de46fd..802a6ff5 100644 --- a/src/serdi.c +++ b/src/serdi.c @@ -1,5 +1,5 @@ /* - Copyright 2011-2017 David Robillard + Copyright 2011-2020 David Robillard Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above @@ -14,16 +14,19 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ +#include "serd_config.h" #include "serd_internal.h" +#include "serd/serd.h" + #ifdef _WIN32 #include #include #endif -#include -#include -#include +#include +#include +#include #include #define SERDI_ERROR(msg) fprintf(stderr, "serdi: " msg); diff --git a/src/string.c b/src/string.c index 0869bc23..b73cea03 100644 --- a/src/string.c +++ b/src/string.c @@ -1,5 +1,5 @@ /* - Copyright 2011-2016 David Robillard + Copyright 2011-2020 David Robillard Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above @@ -16,7 +16,11 @@ #include "serd_internal.h" +#include "serd/serd.h" + #include +#include +#include void serd_free(void* ptr) diff --git a/src/uri.c b/src/uri.c index 7b016b8b..4528f0f4 100644 --- a/src/uri.c +++ b/src/uri.c @@ -1,5 +1,5 @@ /* - Copyright 2011-2014 David Robillard + Copyright 2011-2020 David Robillard Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above @@ -16,6 +16,11 @@ #include "serd_internal.h" +#include "serd/serd.h" + +#include +#include +#include #include #include diff --git a/src/writer.c b/src/writer.c index 33619d34..61b6b825 100644 --- a/src/writer.c +++ b/src/writer.c @@ -1,5 +1,5 @@ /* - Copyright 2011-2017 David Robillard + Copyright 2011-2020 David Robillard Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above @@ -16,7 +16,12 @@ #include "serd_internal.h" +#include "serd/serd.h" + #include +#include +#include +#include #include #include #include diff --git a/tests/serd_test.c b/tests/serd_test.c index 015d02d7..b2d862a1 100644 --- a/tests/serd_test.c +++ b/tests/serd_test.c @@ -1,5 +1,5 @@ /* - Copyright 2011-2017 David Robillard + Copyright 2011-2020 David Robillard Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above @@ -16,16 +16,17 @@ #undef NDEBUG +#include "serd/serd.h" + #include #include #include -#include +#include +#include #include #include #include -#include "serd/serd.h" - #define USTR(s) ((const uint8_t*)(s)) #ifndef INFINITY diff --git a/wscript b/wscript index b1d688ac..eb9495d0 100644 --- a/wscript +++ b/wscript @@ -44,6 +44,9 @@ def configure(conf): conf.load('autowaf', cache=True) autowaf.set_c_lang(conf, 'c99') + if Options.options.strict and not conf.env.MSVC_COMPILER: + conf.env.append_unique('CFLAGS', '-Wno-cast-align') + conf.env.update({ 'BUILD_UTILS': not Options.options.no_utils, 'BUILD_SHARED': not Options.options.no_shared, @@ -212,6 +215,11 @@ def lint(ctx): "../src/*.c") subprocess.call(cmd, cwd='build', shell=True) + try: + subprocess.call(["iwyu_tool.py", "-o", "clang", "-p", "build"]) + except Exception: + Logs.warn("Failed to call iwyu_tool.py") + def amalgamate(ctx): "builds single-file amalgamated source" -- cgit v1.2.1