Fix all the linter warnings

This commit is contained in:
Sameer Rahmani 2022-07-10 07:52:15 +01:00
parent 14a833f841
commit 4d3624505e
6 changed files with 13 additions and 39 deletions

View File

@ -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 # Leave it as it is or if you want to use your own
# fs repo change the address to your copy. # fs repo change the address to your copy.
SERENE_FS_REPO=https://dl.serene-lang.org/devfs/ SERENE_FS_REPO=https://dl.serene-lang.org/devfs/

27
builder
View File

@ -80,9 +80,6 @@ CMAKEARGS=("-DCMAKE_EXPORT_COMPILE_COMMANDS=ON"
# shellcheck source=scripts/utils.sh # shellcheck source=scripts/utils.sh
source "$ME/scripts/utils.sh" source "$ME/scripts/utils.sh"
# shellcheck source=scripts/containers.sh
source "$ME/scripts/containers.sh"
# shellcheck source=scripts/devfs.sh # shellcheck source=scripts/devfs.sh
source "$ME/scripts/devfs.sh" source "$ME/scripts/devfs.sh"
@ -144,30 +141,6 @@ function build() { ## Builds the project by regenerating the build scripts
popd_build 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) function build-20() { ## Builds the project using C++20 (will regenerate the build)
clean clean
pushed_build pushed_build

View File

@ -33,7 +33,7 @@
#include <vector> // for vector #include <vector> // for vector
#define DEFAULT_NS_NAME "serene.user" #define DEFAULT_NS_NAME "serene.user"
#define INTERNAL_NS "serene.internal" #define INTERNAL_NS "serene.internal"
namespace serene { namespace serene {
class SereneContext; class SereneContext;
@ -62,7 +62,8 @@ SERENE_EXPORT void terminate(SereneContext &ctx, int exitCode);
class SERENE_EXPORT SereneContext { class SERENE_EXPORT SereneContext {
public: public:
template <typename T> using CurrentNSFn = std::function<T()>; template <typename T>
using CurrentNSFn = std::function<T()>;
/// The set of options to change the compilers behaivoirs /// The set of options to change the compilers behaivoirs
Options opts; Options opts;

View File

@ -221,7 +221,7 @@ void Halley::setEngine(std::unique_ptr<llvm::orc::LLJIT> e, bool isLazy) {
// Later on we might use different classes of JIT which might need some // Later on we might use different classes of JIT which might need some
// work for lazyness // work for lazyness
(void)ctx; (void)ctx;
engine = std::move(e); engine = std::move(e);
this->isLazy = isLazy; this->isLazy = isLazy;
}; };
@ -394,8 +394,8 @@ types::Namespace &Halley::makeNamespace(const char *name) {
// randomly build instances here and there that causes unsafe memory // randomly build instances here and there that causes unsafe memory
assert(name && "name is nullptr: createNamespace"); assert(name && "name is nullptr: createNamespace");
const auto &nsName = getInternalString(name); const auto &nsName = getInternalString(name);
auto *ns = (types::Namespace *)GC_MALLOC(sizeof(types::Namespace)); auto *ns = (types::Namespace *)GC_MALLOC(sizeof(types::Namespace));
ns->name = &nsName; ns->name = &nsName;
nsStorage.push_back(ns); nsStorage.push_back(ns);
return *ns; return *ns;
@ -405,7 +405,7 @@ types::Namespace &Halley::makeNamespace(const char *name) {
llvm::Error Halley::createEmptyNS(const char *name) { llvm::Error Halley::createEmptyNS(const char *name) {
assert(name && "name is nullptr: createEmptyNS"); assert(name && "name is nullptr: createEmptyNS");
// TODO: Look up the Namespace first. // TODO: Look up the Namespace first.
auto &ns = makeNamespace(name); auto &ns = makeNamespace(name);
auto numOfDylibs = getNumberOfJITDylibs(ns) + 1; auto numOfDylibs = getNumberOfJITDylibs(ns) + 1;
HALLEY_LOG( HALLEY_LOG(
@ -578,7 +578,7 @@ Halley::loadNamespaceFrom<fs::NSFileType::StaticLib>(NSLoadRequest &req) {
} }
auto &session = engine->getExecutionSession(); 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."); 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 // TODO: Handle hidden static libs as well look at the addLibrary/AddArchive

View File

@ -168,8 +168,8 @@ function build_llvm_multiarch() {
local ROOT="$2" local ROOT="$2"
info "Building the multiarch llvm images for:" info "Building the multiarch llvm images for:"
info "VERSION: $LLVM_VERSION | Platforms: $PLATFORMS" info "VERSION: $LLVM_VERSION | Platforms: ${PLATFORMS[*]}"
docker buildx build --platform "$PLATFORMS" \ docker buildx build --platform "${PLATFORMS[@]}" \
--builder "$BUILDER_NAME" --push \ --builder "$BUILDER_NAME" --push \
-f "$ROOT/resources/docker/llvm/Dockerfile" \ -f "$ROOT/resources/docker/llvm/Dockerfile" \
-t "$REGISTRY/$IMAGE_NAME:${LLVM_VERSION}-$(git describe)" \ -t "$REGISTRY/$IMAGE_NAME:${LLVM_VERSION}-$(git describe)" \

View File

@ -299,7 +299,7 @@ int main(int argc, char *argv[]) {
// } // }
std::string core = "serene.core"; std::string core = "serene.core";
auto maybeJD = engine->loadNamespace(core); auto maybeJD = engine->loadNamespace(core);
if (!maybeJD) { if (!maybeJD) {
llvm::errs() << "Error: " << maybeJD.takeError() << "'\n"; llvm::errs() << "Error: " << maybeJD.takeError() << "'\n";
return 1; return 1;
@ -312,7 +312,7 @@ int main(int argc, char *argv[]) {
return 1; return 1;
} }
auto c = *bt; auto c = *bt;
void *res = c(); void *res = c();
(void)res; (void)res;