summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--iwyu.json10
-rw-r--r--libadhocutil/fileUtils.cpp6
-rw-r--r--libadhocutil/lexer-regex.cpp6
-rw-r--r--libadhocutil/lexer-regex.h7
-rw-r--r--libadhocutil/resourcePool.h1
-rw-r--r--libadhocutil/semaphore.h1
-rw-r--r--libadhocutil/unittests/testBuffer.cpp1
-rw-r--r--libadhocutil/unittests/testException.cpp1
-rw-r--r--libadhocutil/unittests/testLexer.cpp10
-rw-r--r--libadhocutil/unittests/testMapFinds.cpp1
-rw-r--r--libadhocutil/unittests/testOptionals.cpp1
-rw-r--r--libadhocutil/unittests/testProcessPipes.cpp3
-rw-r--r--libadhocutil/unittests/testUriParse.cpp2
-rw-r--r--libadhocutil/uriParse.cpp5
14 files changed, 36 insertions, 19 deletions
diff --git a/iwyu.json b/iwyu.json
index 3765a27..b12677a 100644
--- a/iwyu.json
+++ b/iwyu.json
@@ -1,5 +1,13 @@
[
{
+ "symbol": [
+ "Glib::ustring",
+ "private",
+ "<glibmm/ustring.h>",
+ "public"
+ ]
+ },
+ {
"include": [
"<bits/types/stack_t.h>",
"private",
@@ -112,6 +120,6 @@
]
},
{
- "ref": "/usr/lib/llvm/11/share/include-what-you-use/boost-all-private.imp"
+ "ref": "/usr/lib/llvm/12/share/include-what-you-use/boost-all-private.imp"
}
]
diff --git a/libadhocutil/fileUtils.cpp b/libadhocutil/fileUtils.cpp
index 4ebcbf2..4221182 100644
--- a/libadhocutil/fileUtils.cpp
+++ b/libadhocutil/fileUtils.cpp
@@ -134,7 +134,8 @@ namespace AdHoc::FileUtils {
MemMap::setupMap(int flags) const
{
auto data = setupMapInt(flags);
- if (data == reinterpret_cast<void *>(-1)) {
+ // NOLINTNEXTLINE(performance-no-int-to-ptr)
+ if (data == MAP_FAILED) {
throw SystemExceptionOn("mmap(2) failed", strerror(errno), errno, FD::get(fh));
}
return data;
@@ -144,7 +145,8 @@ namespace AdHoc::FileUtils {
MemMap::setupMap(const std::filesystem::path & path, int flags) const
{
auto data = setupMapInt(flags);
- if (data == reinterpret_cast<void *>(-1)) {
+ // NOLINTNEXTLINE(performance-no-int-to-ptr)
+ if (data == MAP_FAILED) {
throw SystemExceptionOn("mmap(2) failed", strerror(errno), errno, path);
}
return data;
diff --git a/libadhocutil/lexer-regex.cpp b/libadhocutil/lexer-regex.cpp
index 6e17a5d..5f2ceaa 100644
--- a/libadhocutil/lexer-regex.cpp
+++ b/libadhocutil/lexer-regex.cpp
@@ -1,12 +1,15 @@
#include "lexer-regex.h"
#include "c++11Helpers.h"
-#include <cassert>
#include <cstddef>
+#include <glib/gtypes.h>
#include <memory>
#include <optional>
#include <stdexcept>
#include <string>
+namespace Glib {
+ class ustring;
+}
namespace AdHoc::LexerMatchers {
class Regex : public Lexer::Pattern {
public:
@@ -55,7 +58,6 @@ namespace AdHoc::LexerMatchers {
{
gint start, end;
g_match_info_fetch_pos(info, 0, &start, &end);
- assert(start <= end);
return static_cast<size_t>(end - start);
}
diff --git a/libadhocutil/lexer-regex.h b/libadhocutil/lexer-regex.h
index 0673458..1d1e80c 100644
--- a/libadhocutil/lexer-regex.h
+++ b/libadhocutil/lexer-regex.h
@@ -6,6 +6,9 @@
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wold-style-cast"
#pragma GCC diagnostic ignored "-Wsign-conversion"
+#ifndef __clang__
+# pragma GCC diagnostic ignored "-Wuseless-cast"
+#endif
#include <glib.h>
#include <glibmm/ustring.h>
#pragma GCC diagnostic pop
@@ -19,8 +22,8 @@ namespace AdHoc {
* @param match The regex match flags.
* @return Pointer to the newly created pattern matcher.
*/
- DLL_PUBLIC Lexer::PatternPtr regex(const Glib::ustring & regex,
- GRegexCompileFlags compile = GRegexCompileFlags {}, GRegexMatchFlags match = GRegexMatchFlags {});
+ DLL_PUBLIC Lexer::PatternPtr regex(
+ const Glib::ustring & regex, GRegexCompileFlags compile = {}, GRegexMatchFlags match = {});
}
}
diff --git a/libadhocutil/resourcePool.h b/libadhocutil/resourcePool.h
index e8d8597..c7fed42 100644
--- a/libadhocutil/resourcePool.h
+++ b/libadhocutil/resourcePool.h
@@ -5,6 +5,7 @@
#include "exception.h"
#include "semaphore.h"
#include "visibility.h"
+#include <cstddef>
#include <list>
#include <map>
#include <memory>
diff --git a/libadhocutil/semaphore.h b/libadhocutil/semaphore.h
index b551661..8b03907 100644
--- a/libadhocutil/semaphore.h
+++ b/libadhocutil/semaphore.h
@@ -6,6 +6,7 @@
#include "visibility.h"
#include <condition_variable>
+#include <cstddef>
#include <mutex>
namespace AdHoc {
diff --git a/libadhocutil/unittests/testBuffer.cpp b/libadhocutil/unittests/testBuffer.cpp
index 5184427..925b8e8 100644
--- a/libadhocutil/unittests/testBuffer.cpp
+++ b/libadhocutil/unittests/testBuffer.cpp
@@ -6,6 +6,7 @@
#include <cstring>
#include <iosfwd>
#include <string>
+#include <string_view>
using namespace AdHoc;
diff --git a/libadhocutil/unittests/testException.cpp b/libadhocutil/unittests/testException.cpp
index bd68bc7..d1c32f6 100644
--- a/libadhocutil/unittests/testException.cpp
+++ b/libadhocutil/unittests/testException.cpp
@@ -4,7 +4,6 @@
#include <buffer.h>
#include <cstdlib>
#include <exception.h>
-#include <stdexcept>
#include <string>
using namespace AdHoc;
diff --git a/libadhocutil/unittests/testLexer.cpp b/libadhocutil/unittests/testLexer.cpp
index b8411c2..6390def 100644
--- a/libadhocutil/unittests/testLexer.cpp
+++ b/libadhocutil/unittests/testLexer.cpp
@@ -2,6 +2,11 @@
#include <boost/test/unit_test.hpp>
#include <functional>
+#include <lexer-regex.h>
+#include <memory>
+#include <optional>
+#include <stdexcept>
+#include <string>
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wold-style-cast"
#pragma GCC diagnostic ignored "-Wsign-conversion"
@@ -11,11 +16,6 @@
#include <glib.h>
#include <glibmm/ustring.h>
#pragma GCC diagnostic pop
-#include <lexer-regex.h>
-#include <memory>
-#include <optional>
-#include <stdexcept>
-#include <string>
using namespace AdHoc;
using namespace AdHoc::LexerMatchers;
diff --git a/libadhocutil/unittests/testMapFinds.cpp b/libadhocutil/unittests/testMapFinds.cpp
index 3372526..a2f0b1e 100644
--- a/libadhocutil/unittests/testMapFinds.cpp
+++ b/libadhocutil/unittests/testMapFinds.cpp
@@ -2,7 +2,6 @@
#include <boost/test/unit_test.hpp>
#include "safeMapFind.h"
-#include <boost/lexical_cast.hpp>
#include <map>
#include <stdexcept>
#include <string>
diff --git a/libadhocutil/unittests/testOptionals.cpp b/libadhocutil/unittests/testOptionals.cpp
index 4404568..2ce7cd7 100644
--- a/libadhocutil/unittests/testOptionals.cpp
+++ b/libadhocutil/unittests/testOptionals.cpp
@@ -5,7 +5,6 @@
#include <optional>
#include <optionalUtils.h>
#include <string>
-#include <type_traits>
using namespace AdHoc;
diff --git a/libadhocutil/unittests/testProcessPipes.cpp b/libadhocutil/unittests/testProcessPipes.cpp
index ac6330a..44b9b3a 100644
--- a/libadhocutil/unittests/testProcessPipes.cpp
+++ b/libadhocutil/unittests/testProcessPipes.cpp
@@ -3,11 +3,12 @@
#include "definedDirs.h"
#include "processPipes.h"
+#include <array>
#include <cstdio>
-#include <cstring>
#include <filesystem>
#include <stdexcept>
#include <string>
+#include <string_view>
#include <sys/wait.h>
#include <unistd.h>
diff --git a/libadhocutil/unittests/testUriParse.cpp b/libadhocutil/unittests/testUriParse.cpp
index 51e8571..2a1bd64 100644
--- a/libadhocutil/unittests/testUriParse.cpp
+++ b/libadhocutil/unittests/testUriParse.cpp
@@ -7,7 +7,7 @@
#include <map>
#include <optional>
#include <string>
-#include <typeinfo>
+#include <string_view>
#include <utility>
BOOST_AUTO_TEST_CASE(simple)
diff --git a/libadhocutil/uriParse.cpp b/libadhocutil/uriParse.cpp
index e2cff82..eb728d1 100644
--- a/libadhocutil/uriParse.cpp
+++ b/libadhocutil/uriParse.cpp
@@ -1,11 +1,12 @@
#include "uriParse.h"
#include "compileTimeFormatter.h"
+#include <algorithm>
#include <boost/algorithm/string/case_conv.hpp>
-#include <boost/lexical_cast.hpp>
#include <cctype>
#include <charconv>
#include <cstdint>
-#include <cstring>
+#include <string_view>
+#include <system_error>
#include <utility>
namespace AdHoc {