From 42ac28d44ac7e1f102e9ba37fa91923e822e47df Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Mon, 23 Oct 2023 04:30:50 +0100 Subject: Make root directory an include path, set #include's properly Easier to write includes now just using < with the module name, in comparison to using relative paths. --- .dir-locals.el | 9 ++++++--- Makefile | 2 +- examples/fib.c | 4 ++-- vm/inst.h | 4 ++-- vm/runtime.h | 1 - 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/.dir-locals.el b/.dir-locals.el index e942583..02fbd7a 100644 --- a/.dir-locals.el +++ b/.dir-locals.el @@ -1,6 +1,9 @@ ;;; Directory Local Variables -*- no-byte-compile: t -*- ;;; For more information see (info "(emacs) Directory Variables") -((nil . ((projectile-project-compilation-cmd . "make") - (projectile-project-configure-cmd . "make clean") - (+license/license-choice . "GPLv2")))) +((nil . ((projectile-project-compilation-cmd . "make") + (projectile-project-configure-cmd . "make clean") + (+license/license-choice . "GPLv2"))) + (c-mode . ((flycheck-gcc-include-path . ("..")) + (flycheck-clang-include-path . ("..")) + (company-clang-arguments . ("-I.."))))) diff --git a/Makefile b/Makefile index bd3cdff..2ca4781 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ CC=gcc -GENERAL-FLAGS=-Wall -Wextra -Werror -Wswitch-enum -std=c11 +GENERAL-FLAGS=-Wall -Wextra -Werror -Wswitch-enum -std=c11 -I. DEBUG-FLAGS=-ggdb -fsanitize=address RELEASE-FLAGS=-O3 CFLAGS:=$(GENERAL-FLAGS) $(DEBUG-FLAGS) diff --git a/examples/fib.c b/examples/fib.c index 17a9ef8..c059ff9 100644 --- a/examples/fib.c +++ b/examples/fib.c @@ -15,8 +15,8 @@ #include #include -#include "../vm/inst.h" -#include "../vm/runtime.h" +#include +#include int main(void) { diff --git a/vm/inst.h b/vm/inst.h index 5882e4f..935f722 100644 --- a/vm/inst.h +++ b/vm/inst.h @@ -16,8 +16,8 @@ #include #include -#include "../lib/base.h" -#include "../lib/darr.h" +#include +#include typedef enum { diff --git a/vm/runtime.h b/vm/runtime.h index 03cd21f..316b4c6 100644 --- a/vm/runtime.h +++ b/vm/runtime.h @@ -16,7 +16,6 @@ #include #include -#include "../lib/base.h" #include "./inst.h" typedef enum -- cgit v1.2.3-13-gbd6f