From 531134f575d3c245d854a1c5256555e84bfe9ae2 Mon Sep 17 00:00:00 2001 From: Maieul BOYER Date: Sun, 4 Aug 2024 12:58:25 +0000 Subject: [PATCH] Make it so it should be possible to compile on MacOS --- Makefile | 5 +- allocator/src/vg/valgrind_block.c | 3 +- allocator/src/vg/valgrind_mempool.c | 3 +- allocator/src/vg/valgrind_mempool_bis.c | 3 +- ast/Filelist.ast.mk | 3 + ast/src/from_node/from_node.c | 10 ++-- flake.lock | 74 +++++++------------------ flake.nix | 6 +- 8 files changed, 37 insertions(+), 70 deletions(-) diff --git a/Makefile b/Makefile index e39473a6..63f86d0e 100644 --- a/Makefile +++ b/Makefile @@ -6,7 +6,7 @@ # By: rparodi +#+ +:+ +#+ # # +#+#+#+#+#+ +#+ # # Created: 2023/11/12 11:05:05 by rparodi #+# #+# # -# Updated: 2024/08/03 16:22:06 by maiboyer ### ########.fr # +# Updated: 2024/08/04 12:57:09 by maiboyer ### ########.fr # # # # **************************************************************************** # @@ -37,11 +37,12 @@ ifeq ($(shell uname), Linux) endif ifeq ($(shell uname), Darwin) PMAKE = -j$(shell sysctl -n hw.ncpu) + CFLAGS_ADDITIONAL += -DNVALGRIND endif endif # TODO: ADD THIS WHEN FINISHING THIS: -CFLAGS_ADDITIONAL += -DNVALGRIND +# CFLAGS_ADDITIONAL += -DNVALGRIND # TODO: REMOVE THIS WHEN FINISHING THIS: CFLAGS_ADDITIONAL += -DPRINT_BACKTRACE diff --git a/allocator/src/vg/valgrind_block.c b/allocator/src/vg/valgrind_block.c index 6ddad468..f868b1ea 100644 --- a/allocator/src/vg/valgrind_block.c +++ b/allocator/src/vg/valgrind_block.c @@ -6,12 +6,11 @@ /* By: maiboyer +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/05/12 22:51:55 by maiboyer #+# #+# */ -/* Updated: 2024/05/12 22:55:45 by maiboyer ### ########.fr */ +/* Updated: 2024/08/04 12:41:08 by maiboyer ### ########.fr */ /* */ /* ************************************************************************** */ #include "aq/internal_vg_funcs.h" -#include "valgrind/valgrind.h" #ifdef VGFUNCS diff --git a/allocator/src/vg/valgrind_mempool.c b/allocator/src/vg/valgrind_mempool.c index c24e00e8..8312b290 100644 --- a/allocator/src/vg/valgrind_mempool.c +++ b/allocator/src/vg/valgrind_mempool.c @@ -6,12 +6,11 @@ /* By: maiboyer +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/05/12 22:33:30 by maiboyer #+# #+# */ -/* Updated: 2024/07/10 17:24:19 by maiboyer ### ########.fr */ +/* Updated: 2024/08/04 12:41:08 by maiboyer ### ########.fr */ /* */ /* ************************************************************************** */ #include "aq/internal_vg_funcs.h" -#include "valgrind/valgrind.h" #ifdef VGFUNCS diff --git a/allocator/src/vg/valgrind_mempool_bis.c b/allocator/src/vg/valgrind_mempool_bis.c index cca01ae8..dfa83967 100644 --- a/allocator/src/vg/valgrind_mempool_bis.c +++ b/allocator/src/vg/valgrind_mempool_bis.c @@ -6,12 +6,11 @@ /* By: maiboyer +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/05/12 22:33:30 by maiboyer #+# #+# */ -/* Updated: 2024/07/10 17:24:11 by maiboyer ### ########.fr */ +/* Updated: 2024/08/04 12:41:01 by maiboyer ### ########.fr */ /* */ /* ************************************************************************** */ #include "aq/internal_vg_funcs.h" -#include "valgrind/valgrind.h" #ifdef VGFUNCS diff --git a/ast/Filelist.ast.mk b/ast/Filelist.ast.mk index e43465ff..2db27b11 100644 --- a/ast/Filelist.ast.mk +++ b/ast/Filelist.ast.mk @@ -5,7 +5,10 @@ ast_alloc/ast_alloc \ ast_alloc/ast_alloc_scripting \ ast_free/ast_free \ ast_free/ast_free_scripting \ +from_node/arithmetic_node2 \ +from_node/artihmetic_node \ from_node/from_node \ +from_node/node_utils \ print_ast/ast_print_command \ print_ast/ast_print_global \ print_ast/ast_print_node \ diff --git a/ast/src/from_node/from_node.c b/ast/src/from_node/from_node.c index a2dc67ef..32f4a133 100644 --- a/ast/src/from_node/from_node.c +++ b/ast/src/from_node/from_node.c @@ -6,7 +6,7 @@ /* By: rparodi +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/07/26 10:55:52 by rparodi #+# #+# */ -/* Updated: 2024/08/04 11:54:08 by rparodi ### ########.fr */ +/* Updated: 2024/08/04 12:43:56 by maiboyer ### ########.fr */ /* */ /* ************************************************************************** */ @@ -103,8 +103,8 @@ void ast_set_term(t_ast_node *node, t_ast_terminator_kind term) (void)(void_storage); } -t_ast_vec _append_scripting(\ - t_ast_node node, t_ast_node redirection) +t_vec_ast *_append_scripting(\ + t_ast_node node) { if (node->kind == AST_WHILE) return (&node->data.while_.suffixes_redirections); @@ -137,8 +137,8 @@ void _append_redirection(t_ast_node node, t_ast_node redirection) vec = &node->data.pipeline.suffixes_redirections; if (node->kind == AST_SUBSHELL) vec = &node->data.subshell.suffixes_redirections; - if (_append_scripting(node, redirection) != NULL) - vec = _append_scripting(node, redirection); + if (vec == NULL) + vec = _append_scripting(node); if (vec != NULL) vec_ast_push(vec, redirection); else diff --git a/flake.lock b/flake.lock index 355be09e..e26c76dc 100644 --- a/flake.lock +++ b/flake.lock @@ -7,11 +7,11 @@ "nixpkgs": "nixpkgs" }, "locked": { - "lastModified": 1700259489, - "narHash": "sha256-Ye2zwphDUY/eDjyFCPFt0r9RyqMr4ZQprCE4bydNdpw=", + "lastModified": 1718446391, + "narHash": "sha256-1YWHbvi5Bn90wRR0nOKxODDgdE13NxR8t7EZ1E0MqZk=", "owner": "Maix0", "repo": "c_formatter_42-flake", - "rev": "3d4f6a40bd1edf9fdb4959051edc172473d9544d", + "rev": "bf7e7fac053e5a4cd0b193390b9a6b0c701d400d", "type": "github" }, "original": { @@ -41,11 +41,11 @@ "systems": "systems" }, "locked": { - "lastModified": 1694529238, - "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=", + "lastModified": 1710146030, + "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=", "owner": "numtide", "repo": "flake-utils", - "rev": "ff7b65b44d01cf9ba6a71320833626af21126384", + "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a", "type": "github" }, "original": { @@ -108,24 +108,6 @@ "type": "github" } }, - "flake-utils_5": { - "inputs": { - "systems": "systems_5" - }, - "locked": { - "lastModified": 1705309234, - "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=", - "owner": "numtide", - "repo": "flake-utils", - "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26", - "type": "github" - }, - "original": { - "owner": "numtide", - "repo": "flake-utils", - "type": "github" - } - }, "generic_c": { "inputs": { "flake-utils": "flake-utils_3", @@ -167,12 +149,10 @@ }, "nixpkgs": { "locked": { - "lastModified": 1700108881, - "narHash": "sha256-+Lqybl8kj0+nD/IlAWPPG/RDTa47gff9nbei0u7BntE=", - "owner": "NixOS", - "repo": "nixpkgs", - "rev": "7414e9ee0b3e9903c24d3379f577a417f0aae5f1", - "type": "github" + "lastModified": 0, + "narHash": "sha256-yZKhxVIKd2lsbOqYd5iDoUIwsRZFqE87smE2Vzf6Ck0=", + "path": "/nix/store/5jgh89kgmrb687c254wxdac4cj5hqjw8-source", + "type": "path" }, "original": { "id": "nixpkgs", @@ -227,11 +207,11 @@ }, "nixpkgs_5": { "locked": { - "lastModified": 1722523718, - "narHash": "sha256-QygJr6Nk5Fuc9LNGcdyiqAchIwTzN/9m/3cVJp3qH/4=", + "lastModified": 1722775820, + "narHash": "sha256-2+P7be2JqEXHxamkqkrBZQU1kiz22I7znFESFgljmFg=", "owner": "nixos", "repo": "nixpkgs", - "rev": "849492e6e2fae04a8add2e2fe692503f96ad1587", + "rev": "7f38c2488573835f1bc0455712253f7346fd4e7c", "type": "github" }, "original": { @@ -242,11 +222,11 @@ }, "nixpkgs_6": { "locked": { - "lastModified": 1706487304, - "narHash": "sha256-LE8lVX28MV2jWJsidW13D2qrHU/RUUONendL2Q/WlJg=", + "lastModified": 1718428119, + "narHash": "sha256-WdWDpNaq6u1IPtxtYHHWpl5BmabtpmLnMAx0RdJ/vo8=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "90f456026d284c22b3e3497be980b2e47d0b28ac", + "rev": "e6cea36f83499eb4e9cd184c8a8e823296b50ad5", "type": "github" }, "original": { @@ -286,15 +266,14 @@ }, "rust-overlay_2": { "inputs": { - "flake-utils": "flake-utils_5", "nixpkgs": "nixpkgs_6" }, "locked": { - "lastModified": 1717208326, - "narHash": "sha256-4gVhbC+NjSQ4c6cJvJGNCI1oTcD+8jRRNAnOF9faGCE=", + "lastModified": 1722738111, + "narHash": "sha256-cWD5pCs9AYb+512/yCx9D0Pl5KcmyuXHeJpsDw/D1vs=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "ab69b67fac9a96709fbef0b899db308ca714a120", + "rev": "27ec296d93cb4b2d03e8cbd019b1b4cde8c34280", "type": "github" }, "original": { @@ -362,21 +341,6 @@ "repo": "default", "type": "github" } - }, - "systems_5": { - "locked": { - "lastModified": 1681028828, - "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", - "owner": "nix-systems", - "repo": "default", - "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", - "type": "github" - }, - "original": { - "owner": "nix-systems", - "repo": "default", - "type": "github" - } } }, "root": "root", diff --git a/flake.nix b/flake.nix index ac8ae320..4d00ae10 100644 --- a/flake.nix +++ b/flake.nix @@ -41,8 +41,10 @@ c_formatter_42.packages.${system}.default llvmPackages.bintools norminette - ]; - VALGRIND_INC_OPT = "${pkgs.valgrind.dev}/include"; + tokei + coreutils + ] ++ (if system == "x86_64-linux" then [valgrind valgrind.dev] else []); + ASAN_OPTIONS = "strict_string_checks=1:detect_stack_use_after_return=1:check_initialization_order=1:strict_init_order=1"; }; }