]> Untitled Git - axy/ft/c-cera.git/commitdiff
Test for inline in header master
authorAxy <gilliardmarthey.axel@gmail.com>
Wed, 6 May 2026 16:37:33 +0000 (18:37 +0200)
committerAxy <gilliardmarthey.axel@gmail.com>
Wed, 6 May 2026 16:37:33 +0000 (18:37 +0200)
Makefile
src/ccera.h
src/defer.c
test.c

index 16315615ec28daf72f975abb8ecea937b4920f93..b8aa5944094f7da8945871bb1bdad6ef5d96c101 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -59,7 +59,7 @@ build-watch:
        watch -c -n 1 make
 
 a.out: test.c ${NAME} ${THIS} 
-       ${CC} ${CFLAGS} test.c ccera.a
+       ${CC} ${CFLAGS} ccera.a test.c
 
 test: a.out
        valgrind ./a.out
index 7f3fc3564cf1a597f1f899f84bbd82beff150b1c..6c5b13dd2ce1cf3e9da4c48b372c63e30a757531 100644 (file)
@@ -6,7 +6,7 @@
 /*   By: agilliar <agilliar@student.42mulhouse.fr>  +#+  +:+       +#+        */
 /*                                                +#+#+#+#+#+   +#+           */
 /*   Created: 2026/04/29 16:08:57 by agilliar          #+#    #+#             */
-/*   Updated: 2026/05/06 02:32:20 by agilliar         ###   ########.fr       */
+/*   Updated: 2026/05/06 18:37:26 by agilliar         ###   ########.fr       */
 /*                                                                            */
 /* ************************************************************************** */
 
@@ -40,6 +40,12 @@ typedef struct s_defer
        struct s_defer_pair     defers[MAX_DEFERS];
 }      t_defer;
 
+__attribute__((__always_inline__))
+inline void    *foo(void)
+{
+       return (__builtin_alloca(10));
+}
+
 void                   defer_new(t_defer *store);
 void                   defer_delete(t_defer *store);
 void                   defer_re(t_defer *store);
@@ -58,7 +64,7 @@ typedef struct s_panic_info
 void                   *catch(void (f)(void *), void *dat);
 
 void                   panic(void *err)
-                               __attribute__((noreturn, nonnull(1)));
+                       __attribute__((noreturn, nonnull(1)));
 bool                   panicking(void);
 
 typedef union u_value  t_value;
index 25320ba836ee63c3def90536af369bcc569711cb..55b8a8f29eb9f6d8934124e882ccf8ddc8510de4 100644 (file)
@@ -6,7 +6,7 @@
 /*   By: agilliar <agilliar@student.42mulhouse.fr>  +#+  +:+       +#+        */
 /*                                                +#+#+#+#+#+   +#+           */
 /*   Created: 2026/05/05 17:31:36 by agilliar          #+#    #+#             */
-/*   Updated: 2026/05/06 02:31:46 by agilliar         ###   ########.fr       */
+/*   Updated: 2026/05/06 18:37:20 by agilliar         ###   ########.fr       */
 /*                                                                            */
 /* ************************************************************************** */
 
diff --git a/test.c b/test.c
index ff6d963ce55c0a75e4fa639cf48b709278de2eab..1cc25a9443dd15c3d61c50f3879a77163aed3e24 100644 (file)
--- a/test.c
+++ b/test.c
@@ -6,7 +6,7 @@
 /*   By: agilliar <agilliar@student.42mulhouse.fr>  +#+  +:+       +#+        */
 /*                                                +#+#+#+#+#+   +#+           */
 /*   Created: 2026/04/30 17:19:58 by agilliar          #+#    #+#             */
-/*   Updated: 2026/05/06 02:32:34 by agilliar         ###   ########.fr       */
+/*   Updated: 2026/05/06 17:58:12 by agilliar         ###   ########.fr       */
 /*                                                                            */
 /* ************************************************************************** */
 
@@ -21,7 +21,7 @@ void  main2(void *s)
 
        t_value arg = value_bytes_new(strlen(s) + 1);
        defer(value_destroy, &arg);
-       //panic("A");
+       panic("A");
        t_value state = value_list_new(0);
        defer(value_destroy, &state);
        //panic("B");
@@ -40,12 +40,16 @@ void        main2(void *s)
        defer(value_destroy, &expr);
        //panic("E");
        t_value val = value_copy(expr);
-       defer(value_destroy, &val);
+       errdefer(value_destroy, &val);
        //panic("F");
 }
 
 int    main(void)
 {
+       char *b = foo();
+       b[0] = 'a';
+       b[1] = '\0';
+       printf("%s\n", b);
        if (char *err = catch(main2, "Hello cera!"))
        {
                printf("%s\n", err);