From 4d3624505ea662aa5207e9ce68ca2f92fb75986e Mon Sep 17 00:00:00 2001 From: Sameer Rahmani Date: Sun, 10 Jul 2022 07:52:15 +0100 Subject: [PATCH] Fix all the linter warnings --- .env.example | 2 +- builder | 27 --------------------------- libserene/include/serene/context.h | 5 +++-- libserene/lib/jit/halley.cpp | 10 +++++----- scripts/containers.sh | 4 ++-- serenec/serenec.cpp | 4 ++-- 6 files changed, 13 insertions(+), 39 deletions(-) diff --git a/.env.example b/.env.example index 8e29d63..492b425 100644 --- a/.env.example +++ b/.env.example @@ -8,4 +8,4 @@ DEV_FS_DIR=/home/lxsameer/src/serene/devfs # Leave it as it is or if you want to use your own # fs repo change the address to your copy. -SERENE_FS_REPO=https://dl.serene-lang.org/devfs/ \ No newline at end of file +SERENE_FS_REPO=https://dl.serene-lang.org/devfs/ diff --git a/builder b/builder index 63474eb..f177e9b 100755 --- a/builder +++ b/builder @@ -80,9 +80,6 @@ CMAKEARGS=("-DCMAKE_EXPORT_COMPILE_COMMANDS=ON" # shellcheck source=scripts/utils.sh source "$ME/scripts/utils.sh" -# shellcheck source=scripts/containers.sh -source "$ME/scripts/containers.sh" - # shellcheck source=scripts/devfs.sh source "$ME/scripts/devfs.sh" @@ -144,30 +141,6 @@ function build() { ## Builds the project by regenerating the build scripts popd_build } -function build-container() { ## Builds the project in handmade container (Linux only) - # shellcheck source=/dev/null - source .env - local uid - local gid - - # uid=$(id -u) - # gid=$(id -g) - # --map-user="$uid" \ - # --map-group="$gid" \ - - unshare --user \ - -w "/app" \ - --uts --net --ipc \ - --pid --fork \ - -c \ - --kill-child \ - --cgroup \ - --mount \ - --mount-proc \ - --root="$DEVFS" \ - /bin/bash -} - function build-20() { ## Builds the project using C++20 (will regenerate the build) clean pushed_build diff --git a/libserene/include/serene/context.h b/libserene/include/serene/context.h index 42d2812..7e52c81 100644 --- a/libserene/include/serene/context.h +++ b/libserene/include/serene/context.h @@ -33,7 +33,7 @@ #include // for vector #define DEFAULT_NS_NAME "serene.user" -#define INTERNAL_NS "serene.internal" +#define INTERNAL_NS "serene.internal" namespace serene { class SereneContext; @@ -62,7 +62,8 @@ SERENE_EXPORT void terminate(SereneContext &ctx, int exitCode); class SERENE_EXPORT SereneContext { public: - template using CurrentNSFn = std::function; + template + using CurrentNSFn = std::function; /// The set of options to change the compilers behaivoirs Options opts; diff --git a/libserene/lib/jit/halley.cpp b/libserene/lib/jit/halley.cpp index 4bb64c9..65177d9 100644 --- a/libserene/lib/jit/halley.cpp +++ b/libserene/lib/jit/halley.cpp @@ -221,7 +221,7 @@ void Halley::setEngine(std::unique_ptr e, bool isLazy) { // Later on we might use different classes of JIT which might need some // work for lazyness (void)ctx; - engine = std::move(e); + engine = std::move(e); this->isLazy = isLazy; }; @@ -394,8 +394,8 @@ types::Namespace &Halley::makeNamespace(const char *name) { // randomly build instances here and there that causes unsafe memory assert(name && "name is nullptr: createNamespace"); const auto &nsName = getInternalString(name); - auto *ns = (types::Namespace *)GC_MALLOC(sizeof(types::Namespace)); - ns->name = &nsName; + auto *ns = (types::Namespace *)GC_MALLOC(sizeof(types::Namespace)); + ns->name = &nsName; nsStorage.push_back(ns); return *ns; @@ -405,7 +405,7 @@ types::Namespace &Halley::makeNamespace(const char *name) { llvm::Error Halley::createEmptyNS(const char *name) { assert(name && "name is nullptr: createEmptyNS"); // TODO: Look up the Namespace first. - auto &ns = makeNamespace(name); + auto &ns = makeNamespace(name); auto numOfDylibs = getNumberOfJITDylibs(ns) + 1; HALLEY_LOG( @@ -578,7 +578,7 @@ Halley::loadNamespaceFrom(NSLoadRequest &req) { } auto &session = engine->getExecutionSession(); - auto *jd = getLatestJITDylib(req.nsName.str().c_str()); + auto *jd = getLatestJITDylib(req.nsName.str().c_str()); assert(jd == nullptr && "'jd' must not be null since we just created it."); // TODO: Handle hidden static libs as well look at the addLibrary/AddArchive diff --git a/scripts/containers.sh b/scripts/containers.sh index 0338dc2..67e5080 100644 --- a/scripts/containers.sh +++ b/scripts/containers.sh @@ -168,8 +168,8 @@ function build_llvm_multiarch() { local ROOT="$2" info "Building the multiarch llvm images for:" - info "VERSION: $LLVM_VERSION | Platforms: $PLATFORMS" - docker buildx build --platform "$PLATFORMS" \ + info "VERSION: $LLVM_VERSION | Platforms: ${PLATFORMS[*]}" + docker buildx build --platform "${PLATFORMS[@]}" \ --builder "$BUILDER_NAME" --push \ -f "$ROOT/resources/docker/llvm/Dockerfile" \ -t "$REGISTRY/$IMAGE_NAME:${LLVM_VERSION}-$(git describe)" \ diff --git a/serenec/serenec.cpp b/serenec/serenec.cpp index 4adc4f8..b37b89b 100644 --- a/serenec/serenec.cpp +++ b/serenec/serenec.cpp @@ -299,7 +299,7 @@ int main(int argc, char *argv[]) { // } std::string core = "serene.core"; - auto maybeJD = engine->loadNamespace(core); + auto maybeJD = engine->loadNamespace(core); if (!maybeJD) { llvm::errs() << "Error: " << maybeJD.takeError() << "'\n"; return 1; @@ -312,7 +312,7 @@ int main(int argc, char *argv[]) { return 1; } - auto c = *bt; + auto c = *bt; void *res = c(); (void)res;