]> git.mdlowis.com Git - projs/tide.git/commitdiff
reworked compilation in prep for atf overhaul
authorMichael D. Lowis <mike.lowis@gentex.com>
Thu, 20 Feb 2020 20:06:11 +0000 (15:06 -0500)
committerMichael D. Lowis <mike.lowis@gentex.com>
Thu, 20 Feb 2020 20:06:11 +0000 (15:06 -0500)
34 files changed:
Rsconscript
alcc
atf [new file with mode: 0755]
inc/atf.h
inc/qcheck.h
inc/stdc.h
src/edit.c
src/fetch.c
src/fetchsel.c
src/lib/argv0.c
src/lib/buf.c
src/lib/dbc.c
src/lib/draw.c
src/lib/editlog.c
src/lib/exec.c
src/lib/gapbuf.c
src/lib/job.c
src/lib/mouse.c
src/lib/range.c
src/lib/readfd.c
src/lib/readfile.c
src/lib/shortcuts.c
src/lib/telem.c
src/lib/utf8.c
src/lib/view.c
src/lib/writefd.c
src/lib/x11.c
src/lib/x11_gc.c
src/lib/x11_sel.c
src/lib/xpty.c
src/pick.c
src/registrar.c
src/tide.c
tests/lib/buf.c

index 0564c1042515501590bf69acba2c756e4ddd3de1..be9539a1fa71242e4935416843ae5c2e0a529faf 100644 (file)
@@ -1,16 +1,15 @@
 configure do
   check_c_compiler "clang", "gcc"
-  check_c_header "X11/Xlib.h",
-    check_cpppath: ["/usr/X11/include"]
-  check_lib "X11",
-    check_libpath: ["/usr/X11/lib"]
+  check_c_header "X11/Xlib.h", check_cpppath: ["/usr/X11/include"]
+  check_lib "X11", check_libpath: ["/usr/X11/lib"]
   check_cfg program: "freetype-config"
 end
 
 build do
   env = Environment.new
   env["prefix"] = ENV["PREFIX"] || env["prefix"]
-  env["CC"] = "./alcc"
+  env["CC"] = "cc"
+  env["LD"] = "./alcc"
   env["CFLAGS"] += %w[-g]
   env["CPPPATH"] += %w[. inc]
   env["LIBPATH"] += %w[.]
@@ -34,11 +33,11 @@ build do
   end
 
   # Build and run unit tests
-  env.Program("tests/libedit", %w[tests/libedit.c tests/lib/buf.c tests/lib/utf8.c libtide.a])
-  env.Command("", "tests/libedit",
-    "CMD" => ["${_SOURCES}"],
-    "CMD_DESC" => "TEST")
-  env.depends("${prefix}/bin", "")
+#  env.Program("tests/libedit", %w[tests/libedit.c tests/lib/buf.c tests/lib/utf8.c libtide.a])
+#  env.Command("", "tests/libedit",
+#    "CMD" => ["${_SOURCES}"],
+#    "CMD_DESC" => "TEST")
+#  env.depends("${prefix}/bin", "")
 
   env.Directory("#{env.build_root}/uml/")
   Dir.glob("**/*.adoc").each do |doc|
@@ -51,3 +50,5 @@ build do
   # Install the compiled binaries
   Dir.glob("bin/*").each{|bin| env.Install("${prefix}/bin", bin) }
 end
+
+# CC=./alcc ./atf -Iinc -I. -I/usr/include/freetype2/ src/lib/buf.c src/lib/dbc.c src/lib/telem.c src/lib/gapbuf.c src/lib/utf8.c src/lib/editlog.c src/lib/range.c src/lib/argv0.c src/lib/writefd.c src/lib/readfd.c
\ No newline at end of file
diff --git a/alcc b/alcc
index 14ca76d61cbab88dc12c6a8b81ac079b785fb72b..6631faf750902a4bb1a0284ef350910bc99bf36f 100755 (executable)
--- a/alcc
+++ b/alcc
 # OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
 # PERFORMANCE OF THIS SOFTWARE.
 
-declare -a sources
 declare -a objects
-declare -a libpaths
-compile=false
-runtime='
-#define _POSIX_C_SOURCE 200809L
-#define _XOPEN_SOURCE 700
-#define AUTOLIB(n) \
-    int __autolib_##n __attribute__ ((weak));
-#include <stddef.h>
-#include <stdint.h>
-#include <stdbool.h>
-#include <stdarg.h>
-#include <errno.h>
-#include <limits.h>
-#include <sys/types.h>
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <signal.h>
-#include <ctype.h>
-#include <unistd.h>
-#include <fcntl.h>
-' # end of runtime definition
 
 # scan the rest of the options for lib paths, libs and objects
 for i do
     case "$i" in
-        *.c) # Add source to the list
-            sources+=("$i") ;;
-
         *.[ao]) # Add objects and static libs to object list
-            objects+=("$i") ;;
-
-        -L*) # Add libpaths to the search list
-            libpaths+=("${i#-L}") ;;
-
-        -c|-E) # Mark this as compilation/preprocess only run
-            compile=true ;;
+            objects+=("$i")
+            ;;
     esac
 done
 
-# if we're compiling,  generate the header, compile, and exit
-if $compile; then
-    genfile=$(mktemp)
-    printf '%s\n' "$runtime" > "$genfile"
-    cc -isystem "${genfile%/*}" -include "${genfile##*/}" --std=c99 -pedantic -Wall -Wextra -Werror "$@"
-    status=$?
-    rm "$genfile"
-    exit "$status"
-fi
-
 # scan objects/libs for referenced libraries
 scan_for_libs(){
     [[ $# -ne 0 ]] && nm "$@" | sed -n '/__autolib/ s/.*_\+autolib_// p' | sort -u
@@ -75,4 +33,3 @@ scan_for_libs(){
 # if we made it here, we must be linking. scan for dependencies
 mapfile -t libraries < <(scan_for_libs "${objects[@]}")
 cc "$@" "${libraries[@]/#/-l}"
-
diff --git a/atf b/atf
new file mode 100755 (executable)
index 0000000..aada39b
--- /dev/null
+++ b/atf
@@ -0,0 +1,353 @@
+#!/usr/bin/env bash
+
+runner="runner.c"
+declare -a sources
+header=$(cat<<-EOF
+#include <stdint.h>
+#include <stdbool.h>
+#include <stdlib.h>
+
+#ifdef ATF_TEST
+    #define main MAIN
+    #define UNITTEST(name,...) void name(void)
+#else
+    #define UNITTEST(name,...) static inline void name(void)
+#endif
+
+#define CHECK(cond) Assert(cond, #cond, __FILE__, __LINE__)
+
+typedef struct Value {
+    struct Value* next;
+    void (*showfn)(struct Value* val);
+    long ndata;
+    long data[];
+} Value;
+
+void Assert(int cond, char* condstr, char* file, int line);
+void* ValueAlloc(void (*showfn)(Value* val), size_t num, size_t sz, void* data);
+long RandR(long from, long to);
+long Rand(void);
+
+void ShowLong(Value* val);
+void ShowBool(Value* val);
+void ShowChar(Value* val);
+void ShowString(Value* val);
+
+long MkLongR(long from, long to);
+long MkLong(void);
+uint8_t MkU8(void);
+uint16_t MkU16(void);
+uint32_t MkU32(void);
+bool MkBool(void);
+char MkAsciiChar(void);
+char* MkAsciiStringL(size_t len);
+char* MkAsciiString(void);
+EOF
+)
+
+# get the list of sources
+for i do
+    case "$i" in
+        *.c) sources+=("$i") ;;
+        --header)
+            printf "%s\n" "$header"
+            exit 0
+            ;;
+    esac
+done
+
+cat <<-EOF > "$runner"
+#include "atf.h"
+#undef main
+#include <setjmp.h>
+#include <stdio.h>
+#include <signal.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <stdbool.h>
+#include <string.h>
+#include <time.h>
+
+#define RUN(file, line, name, ntrials) \\
+    void name(void); \\
+    runtestn(file, line, #name, name, ntrials)
+
+static char* Curr_File = 0;
+static char* Curr_Test = 0;
+static char* Curr_Expr = 0;
+static unsigned int Curr_Line = 0;
+static Value* Curr_Values;
+static jmp_buf Jump_Buf;
+static unsigned long Total = 0;
+static unsigned long Failed = 0;
+static uintptr_t Heap_Buf[1024*1024];
+static uintptr_t* Heap_Top = Heap_Buf;
+static uintptr_t* Heap_Base = Heap_Buf;
+static uintptr_t* Heap_End = Heap_Buf + sizeof(Heap_Buf)/sizeof(uintptr_t) - 1;
+enum {
+    FAIL_ASSERT = 1,
+    FAIL_OOM = 2
+};
+
+/* Basic Runtime Functions
+ ****************************/
+static int print_results(void)
+{
+    printf("%lu/%lu tests passed\n" , Total - Failed, Total);
+    return Failed;
+}
+
+static void print_values(void)
+{
+    Value* values = 0;
+    while (Curr_Values)
+    {
+        Value* val = Curr_Values;
+        Curr_Values = val->next;
+        val->next = values;
+        values = val;
+    }
+
+    while (values)
+    {
+        printf("  -> arg: ");
+        values->showfn(values);
+        values = values->next;
+    }
+}
+
+void* malloc(size_t size)
+{
+    void* ptr = Heap_Top;
+    size_t num_words = ((size & ~0x7) + ((size & 7) ? 1 : 0)) / sizeof(uintptr_t) + 1;
+    *Heap_Top = size;
+    Heap_Top += num_words;
+    if (Heap_Top > Heap_End)
+    {
+        Heap_Top = Heap_Base; // Reset heap in case printf mallocs.
+        fprintf(stderr,"%s:%d: MEM %s out of memory\n", Curr_File, Curr_Line, Curr_Test);
+        longjmp(Jump_Buf, FAIL_OOM);
+    }
+    else
+    {
+        memset(ptr, 0, size);
+    }
+    return ptr;
+}
+
+void* calloc(size_t num, size_t size)
+{
+    return malloc(num * size);
+}
+
+void* realloc(void* ptr, size_t new_size)
+{
+    uintptr_t old_size = *((uintptr_t*)ptr - 1);
+    void* newptr = malloc(new_size);
+    memcpy(newptr, ptr, old_size);
+    return newptr;
+}
+
+void free(void* ptr)
+{
+    (void)ptr; /* simply reset the buffer after each test */
+}
+
+void Assert(int cond, char* condstr, char* file, int line)
+{
+    if (!cond)
+    {
+        Curr_File = file;
+        Curr_Line = line;
+        Curr_Expr = condstr;
+        longjmp(Jump_Buf, 1);
+    }
+}
+
+static int runtest(void (*fn)(void))
+{
+    Curr_Values = 0;
+    Heap_Top = Heap_Base;
+    int code = setjmp(Jump_Buf);
+    if (code == 0)
+    {
+        fn();
+    }
+    return code;
+}
+
+static void runtestn(char* file, int line, char* fnname, void (*fn)(void), int ntrials)
+{
+    Curr_File = file;
+    Curr_Line = line;
+    Curr_Test = fnname;
+    Total++;
+    for (int i = 0; i < ntrials; i++)
+    {
+        int fail = runtest(fn);
+        if (fail != 0)
+        {
+            Failed++;
+            if (fail == FAIL_ASSERT)
+            {
+                if (ntrials == 1)
+                {
+                    printf("%s:%d: FAIL for test %s \n  -> CHECK( %s )\n", Curr_File, Curr_Line, Curr_Test, Curr_Expr);
+                }
+                else
+                {
+                    printf("%s:%d: FAIL on trial %d/%d for test %s\n", Curr_File, Curr_Line, i, ntrials, Curr_Test);
+                    print_values();
+                }
+            }
+            break;
+        }
+    }
+}
+
+static void handle_signal(int sig)
+{
+    /* Determine the signal name */
+    char* sig_name = NULL;
+    switch(sig)
+    {
+        case SIGABRT: sig_name = "SIGABRT"; break;
+        case SIGBUS:  sig_name = "SIGBUS";  break;
+        case SIGFPE:  sig_name = "SIGFPE";  break;
+        case SIGILL:  sig_name = "SIGILL";  break;
+        case SIGSEGV: sig_name = "SIGSEGV"; break;
+        case SIGSYS:  sig_name = "SIGSYS";  break;
+        /* If we don't recognize it then just return and let the default handler
+           catch it. */
+        default:      return;
+    }
+    /* Error and exit. No summary will be printed but the user will know which
+       test has crashed. */
+    fprintf(stderr,"%s:%d: CRASH %s (signal: %d - %s)\n", Curr_File, Curr_Line, Curr_Test, sig, sig_name);
+    Failed++;
+    (void)print_results();
+    _Exit(1);
+}
+
+/* Property Testing Functions
+ ****************************/
+void* ValueAlloc(void (*showfn)(Value* val), size_t num, size_t sz, void* data)
+{
+    Value* value = calloc(num, sizeof(Value) + sz);
+    value->showfn = showfn;
+    value->ndata = num;
+    value->next = Curr_Values;
+    Curr_Values = value;
+    if (data)
+    {
+        memcpy(value->data, data, num * sz);
+    }
+    return &(value->data[0]);
+}
+
+long RandR(long from, long to)
+{
+    return ((rand() % (to - from + 1)) + from);
+}
+
+long Rand(void)
+{
+    return rand();
+}
+
+void ShowLong(Value* val)
+{
+    printf("%ld\n", (val->data[0]));
+}
+
+void ShowBool(Value* val)
+{
+    printf("%s\n", (val->data[0] ? "true" : "false"));
+}
+
+void ShowChar(Value* val)
+{
+    printf("'%c'\n", (char)(val->data[0]));
+}
+
+void ShowString(Value* val)
+{
+    printf("'%s'\n", (char*)(val->data));
+}
+
+long MkLongR(long from, long to)
+{
+    return *((long*)ValueAlloc(ShowLong, 1, sizeof(long), &(long){RandR(from, to)}));
+}
+
+long MkLong(void)
+{
+    return *((long*)ValueAlloc(ShowLong, 1, sizeof(long), &(long){Rand()}));
+}
+
+uint8_t MkU8(void)
+{
+    return MkLongR(0, UINT8_MAX);
+}
+
+uint16_t MkU16(void)
+{
+    return MkLongR(0, UINT16_MAX);
+}
+
+uint32_t MkU32(void)
+{
+    return MkLongR(0, UINT32_MAX);
+}
+
+bool MkBool(void)
+{
+    return *((bool*)ValueAlloc(ShowBool, 1, sizeof(bool), &(bool){RandR(0, 1)}));
+}
+
+char MkAsciiChar(void)
+{
+    return *((char*)ValueAlloc(ShowChar, 1, sizeof(char), &(char){RandR(32, 127)}));
+}
+
+char* MkAsciiStringL(size_t len) {
+    char* val = ValueAlloc(ShowString, len+1, sizeof(char), 0);
+    for (size_t i = 0; i < len; i++)
+    {
+        *(val++) = RandR(32, 127);
+    }
+    return val;
+}
+
+char* MkAsciiString(void) {
+    return MkAsciiStringL(RandR(1, 1024));
+}
+
+/* Main Routine
+ ****************************/
+int main(int argc, char** argv)
+{
+    (void)runtestn;
+    unsigned int seed = (argc >= 2 ? strtoul(argv[1], 0, 0) : (unsigned int)time(0));
+    printf("Seed: %u\n", seed);
+    srand(seed);
+    signal(SIGABRT, handle_signal);
+    signal(SIGBUS,  handle_signal);
+    signal(SIGFPE,  handle_signal);
+    signal(SIGILL,  handle_signal);
+    signal(SIGSEGV, handle_signal);
+    signal(SIGSYS,  handle_signal);
+    Heap_Base = Heap_Top;
+EOF
+grep -Hn '\(PROP\|UNIT\)TEST' "${sources[@]}" | sed '
+    s/^\(.*\):\(.*\):[\t ]*UNITTEST(\(.*\),\(.*\)).*$/    RUN("\1",\2,\3,\4);/
+    s/^\(.*\):\(.*\):[\t ]*UNITTEST(\(.*\)).*$/    RUN("\1",\2,\3,1);/
+' >> "$runner"
+cat <<-EOF >> "$runner"
+    return print_results();
+}
+EOF
+
+cc="${CC:-cc}"
+"$cc" -DATF_TEST -g -o runner -O0 "$@" "$runner" && ./runner
+#rm -f runner "$runner"
index b76cd7eab9537e17e77bae0b8d3fc799515696ca..5ce11c33ab5f270bbea90c2b7a3b2dd29ce46501 100644 (file)
--- a/inc/atf.h
+++ b/inc/atf.h
-/**
-    @file
-    Aardvark Test Framework - A minimalistic unit testing framework for C.
-
-    Copyright 2014 Michael D. Lowis
-
-    Permission to use, copy, modify, and/or distribute this software
-    for any purpose with or without fee is hereby granted, provided
-    that the above copyright notice and this permission notice appear
-    in all copies.
-
-    THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
-    WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
-    WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
-    AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
-    DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA
-    OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
-    TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-    PERFORMANCE OF THIS SOFTWARE.
-*/
-#ifndef ATF_H
-#define ATF_H
-
-#include <stddef.h>
+#include <stdint.h>
 #include <stdbool.h>
-#include <setjmp.h>
-#include <assert.h>
-
-extern char* Curr_Test;
-void atf_init(int argc, char** argv);
-void atf_test_start(char* file, unsigned int line, char* name);
-bool atf_test_assert(bool success, char* expr_str, char* file, int line);
-void atf_test_fail(char* expr, char* file, int line);
-int atf_print_results(void);
-
-#define IGNORE(msg) \
-    printf("%s:%d:%s:IGNORE:\n\t%s\n", __FILE__, __LINE__, Curr_Test, msg); break
-
-#define CHECK(expr) \
-    if(atf_test_assert((expr), #expr, __FILE__, __LINE__)) break
-
-#define CHECK_EXITCODE(code) \
-    CHECK(ExitCode == code)
-
-#define TEST_SUITE(name) \
-    void name(void)
-
-#define TEST(desc) \
-    for(atf_test_start(__FILE__,__LINE__,#desc); Curr_Test != NULL; Curr_Test = NULL)
-
-#define RUN_TEST_SUITE(name) \
-    name();
-
-#define RUN_EXTERN_TEST_SUITE(name) \
-    do { extern TEST_SUITE(name); RUN_TEST_SUITE(name); } while(0)
-
-#define EXPECT_EXIT \
-    if ((ExitExpected = true, 0 == setjmp(ExitPad)))
-
-/* Function Definitions
- *****************************************************************************/
-#ifdef INCLUDE_DEFS
-#include <stdio.h>
 #include <stdlib.h>
-#ifndef NO_SIGNALS
-#include <signal.h>
-#endif
-
-char* Curr_Test = NULL;
-char* Curr_File = NULL;
-unsigned int Curr_Line = 0;
-static unsigned int Total = 0;
-static unsigned int Failed = 0;
-bool ExitExpected;
-int ExitCode;
-jmp_buf ExitPad;
-
-#ifndef NO_SIGNALS
-static void handle_signal(int sig) {
-    /* Determine the signal name */
-    char* sig_name = NULL;
-    switch(sig) {
-        case SIGABRT: sig_name = "SIGABRT"; break;
-        case SIGBUS:  sig_name = "SIGBUS";  break;
-        case SIGFPE:  sig_name = "SIGFPE";  break;
-        case SIGILL:  sig_name = "SIGILL";  break;
-        case SIGSEGV: sig_name = "SIGSEGV"; break;
-        case SIGSYS:  sig_name = "SIGSYS";  break;
-        /* If we don't recognize it then just return and let the default handler
-           catch it. */
-        default:      return;
-    }
-    /* Error and exit. No summary will be printed but the user will know which
-       test has crashed. */
-    fprintf(stderr,"%s:%d:0:%s:CRASH (signal: %d - %s)\n", Curr_File, Curr_Line, Curr_Test, sig, sig_name);
-    Failed++;
-    (void)atf_print_results();
-    _Exit(1);
-}
-#endif
-
-void atf_init(int argc, char** argv) {
-    /* I reserve the right to use these later */
-    (void)argc;
-    (void)argv;
-
-#ifndef NO_SIGNALS
-    /* Init signal handler */
-    signal(SIGABRT, handle_signal);
-    signal(SIGBUS,  handle_signal);
-    signal(SIGFPE,  handle_signal);
-    signal(SIGILL,  handle_signal);
-    signal(SIGSEGV, handle_signal);
-    signal(SIGSYS,  handle_signal);
-#endif
-}
-
-void atf_test_start(char* file, unsigned int line, char* name) {
-    Curr_File = file;
-    Curr_Line = line;
-    Curr_Test = name;
-    Total++;
-}
-
-bool atf_test_assert(bool success, char* expr, char* file, int line) {
-    bool failed = !success;
-    if (failed) atf_test_fail(expr,file,line);
-    return failed;
-}
-
-void atf_test_fail(char* expr, char* file, int line) {
-    Failed++;
-    printf("%s:%d:0:%s:FAIL:( %s )\n", file, line, Curr_Test, expr); \
-}
-
-int atf_print_results(void) {
-    static const char* results_string =
-    "\nUnit Test Summary"
-    "\n-----------------"
-    "\nTotal:  %d"
-    "\nPassed: %d"
-    "\nFailed: %d"
-    "\n\n";
-    printf(results_string, Total, Total - Failed, Failed);
-    return Failed;
-}
 
-void exit(int code) {
-    if (ExitExpected) {
-        ExitCode = code;
-        ExitExpected = false;
-        longjmp(ExitPad, 1);
-    } else {
-        assert(!"Unexpected exit. Something went wrong");
-        abort(); // if NDEBUG defined
-    }
-}
+#ifdef ATF_TEST
+    #define main MAIN
+    #define UNITTEST(name,...) void name(void)
+#else
+    #define UNITTEST(name,...) static inline void name(void)
 #endif
 
-#endif /* ATF_H */
+#define CHECK(cond) Assert(cond, #cond, __FILE__, __LINE__)
+
+typedef struct Value {
+    struct Value* next;
+    void (*showfn)(struct Value* val);
+    long ndata;
+    long data[];
+} Value;
+
+void Assert(int cond, char* condstr, char* file, int line);
+void* ValueAlloc(void (*showfn)(Value* val), size_t num, size_t sz, void* data);
+long RandR(long from, long to);
+long Rand(void);
+
+void ShowLong(Value* val);
+void ShowBool(Value* val);
+void ShowChar(Value* val);
+void ShowString(Value* val);
+
+long MkLongR(long from, long to);
+long MkLong(void);
+uint8_t MkU8(void);
+uint16_t MkU16(void);
+uint32_t MkU32(void);
+bool MkBool(void);
+char MkAsciiChar(void);
+char* MkAsciiStringL(size_t len);
+char* MkAsciiString(void);
index e66914a59981e076d3a49a64a12203607ccb222a..033a97d8ea14f25b030e1310b7ea85eb8ad94ee0 100644 (file)
 #define QCHECK_H
 
 #include <stdarg.h>
+#include <stdint.h>
 #include <string.h>
 #include <time.h>
+#include <string.h>
 
 typedef struct QCValue {
     void (*showfn)(struct QCValue* val);
index 8630a4a026305ec0b2519daac2999bd280240c13..68e0e36be92f792998a53021b235be4195e0ef07 100644 (file)
@@ -4,21 +4,25 @@
     @author Michael D. Lowis
     @license BSD 2-clause License
 */
-
-///* Standard Macros and Types */
-//#include <stddef.h>
-//#include <stdint.h>
-//#include <stdbool.h>
-//#include <errno.h>
-//#include <limits.h>
-//#include <assert.h>
-//
-///* Useful Standard Functions */
-//#include <signal.h>
-//#include <stdio.h>
-//#include <stdlib.h>
-//#include <stdarg.h>
-//#include <string.h>
+#define _POSIX_C_SOURCE 200809L
+#define _XOPEN_SOURCE 700
+#define AUTOLIB(n) \
+    int __autolib_##n __attribute__ ((weak));
+#include <stddef.h>
+#include <stdint.h>
+#include <stdbool.h>
+#include <stdarg.h>
+#include <errno.h>
+#include <limits.h>
+#include <sys/types.h>
+#include <assert.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <signal.h>
+#include <ctype.h>
+#include <unistd.h>
+#include <fcntl.h>
 
 #pragma GCC diagnostic push
 #pragma GCC diagnostic ignored "-Wunused-function"
@@ -164,7 +168,4 @@ static inline char* _getopt_(int* p_argc, char*** p_argv) {
         ((x) > (y) ? (x) : (y))
 #endif
 
-#define UNITTEST(name) \
-    void unittest_##name(void)
-
 #pragma GCC diagnostic pop
index 098bee1cd55e746663bba9220a5d72196b5772ec..4f61aefa7f5b614cb1329f06662b77803600c621 100644 (file)
@@ -1,7 +1,3 @@
-/**
-    @file
-    @ingroup edit
-*/
 #include <stdc.h>
 #include <x11.h>
 
index 322a0af5d1fdc45f5f3f31ac65850e6fecd29b7e..12285b7351924c9249b61a0c7ab6b44a64e3a6e5 100644 (file)
@@ -1,7 +1,3 @@
-/**
-    @file
-    @ingroup fetch
-*/
 #include <stdc.h>
 #include <io.h>
 #include <regex.h>
index 5cd4576472351a884326fc9383ae8d10479a94e8..de6ab6865c04110e1bf470ed664499bdf797c58d 100644 (file)
@@ -1,7 +1,3 @@
-/**
-    @file
-    @ingroup fetch
-*/
 #include <stdc.h>
 #include <x11.h>
 
index a0994c6c1c330e0166bd728af6f491b2ee98c408..bdc2fe169fcce3c29f19ac74b4e4192219514052 100644 (file)
@@ -1,2 +1 @@
-/** @file */
-char* ARGV0 = NULL;
+char* ARGV0 = 0;
index e7853f8a8452191fd7314f506fa803daf5336997..252dfa0e373968deea68ff2b7ab46651c5160fb6 100644 (file)
@@ -1,4 +1,3 @@
-/** @file */
 #include <stdc.h>
 #include <dbc.h>
 #include <utf.h>
@@ -9,11 +8,6 @@
 #include <sys/stat.h>
 #include "config.h"
 
-UNITTEST(foo)
-{
-
-}
-
 #ifndef NDEBUG
 static bool buf_valid(Buf* buf)
 {
index 69d3a6f37f7d589f36648edffa4caaa6cbcadbc2..bb4f96b71ab3a40eddf140ad02819592d40c795a 100644 (file)
@@ -1,4 +1,4 @@
-/** @file */
+#include <stdc.h>
 #include <dbc.h>
 #include <stdio.h>
 #include <signal.h>
index f788949ea7009578b3b24b9794e8f7f9aa4aec7c..747ee010dcfa13fa0cf56b4f3e6c4a231be0219b 100644 (file)
@@ -1,4 +1,3 @@
-/** @file */
 #include <stdc.h>
 #include <utf.h>
 #include <x11.h>
index 8c5c947f838264f47e51d4c4b4ef0b62463f17e7..023edcead1d2b065b3ae090d4d8d411750650154 100644 (file)
@@ -1,4 +1,3 @@
-/** @file */
 #include <stdc.h>
 #include <dbc.h>
 #include <utf.h>
index 0fa2f7fb2707848b111449581941c14c3f0ca66e..a12876ebcf703f63433ef54b6b3e6e89e199a612 100644 (file)
@@ -1,4 +1,3 @@
-/** @file */
 #include <stdc.h>
 #include <utf.h>
 #include <edit.h>
index 72ba87a475443e80035b27beeca2cf14c1c81a8b..a5b915cce63344014c4f7114b637dac7baa54118 100644 (file)
@@ -1,4 +1,3 @@
-/** @file */
 #include <stdc.h>
 #include <dbc.h>
 #include <utf.h>
index d913a54e9f07c7b730585ee6d9a6f9604ae72f3d..08f1c8c4f9891a1a94d57a39e2a5c6ea97af7932 100644 (file)
@@ -1,4 +1,3 @@
-/** @file */
 #include <stdc.h>
 #include <utf.h>
 #include <edit.h>
index a7c0301fb26072b783de6ebbd8b15317ef79fbf4..db022b1a4d8679f49339c656c9d005b6bae582ac 100644 (file)
@@ -1,4 +1,4 @@
-/** @file */
+#include <stdc.h>
 #include <utf.h>
 #include <x11.h>
 #include <edit.h>
index a5136aa0fc1af5eb0d5b0c1b0738f06bfd8f3593..7eecc44e2d42060aa48cfea30eb162481cbcac74 100644 (file)
@@ -1,4 +1,3 @@
-/** @file */
 #include <stdc.h>
 #include <utf.h>
 #include <edit.h>
index 75f1cc26ca0827fd28f1bfa5114c0bb93bb5aae5..f27a9c27e4b047dcea63980d9a877b58fbdb8e76 100644 (file)
@@ -1,4 +1,4 @@
-/** @file */
+#include <stdc.h>
 #include <io.h>
 
 long readfd(int fd, char* data, long toread)
index 05facba5417afadb37bab6a418d87ffdc44e5e10..e8c9cbcd12c9f92b80ee30e4aeb83493cbc78160 100644 (file)
@@ -1,4 +1,4 @@
-/** @file */
+#include <stdc.h>
 #include <io.h>
 #include <fcntl.h>
 #include <sys/stat.h>
index 19936226bb625c4ba44b3521ec95d6387acdbf3e..aee183224cef7df90b684f8acf24b4474e4b29ad 100644 (file)
@@ -1,4 +1,4 @@
-/** @file */
+#include <stdc.h>
 #include <utf.h>
 #include <edit.h>
 #include <win.h>
index 9f3577de3ffab8e33a1a8de2f168933c0fe22989..ee9dc9402d08b0c8705e1a70f74bb66ae81170df 100644 (file)
@@ -1,4 +1,3 @@
-/** @file */
 #include <stdc.h>
 #include <time.h>
 #include <sys/types.h>
index ff736c742384abac111ddbecd14ea32e125284b7..622dc67e5b5287256d44ef70c572f4b1b7805837 100644 (file)
@@ -1,4 +1,3 @@
-/** @file */
 #include <stdc.h>
 #include <utf.h>
 #include <edit.h>
index e7072b66c99818e1e5bd088e9f80f89cd821a46a..87e24e107b7fdc2143de4cef5862e86c59d83db5 100644 (file)
@@ -1,4 +1,3 @@
-/** @file */
 #include <stdc.h>
 #include <dbc.h>
 #include <utf.h>
index 31dade2fa2f57d6143108443e7615e04df1dfa79..af1edb15b2b7383a65d55f093bc657312e59106e 100644 (file)
@@ -1,4 +1,4 @@
-/** @file */
+#include <stdc.h>
 #include <io.h>
 
 long writefd(int fd, char* data, long towrite)
index ed5eb5f0896e33d197031737998249ff5c6111d5..d10b25e821240df5e1c0847c242e5f4ba9e0de22 100644 (file)
@@ -1,4 +1,4 @@
-/** @file */
+#include <stdc.h>
 #include <x11.h>
 #include <utf.h>
 #include <io.h>
index c939e538eb47379dfc999cc1538742ce537b9c9a..77c8211d8a4a59e67d1446124ae120ce9479e148 100644 (file)
@@ -1,4 +1,4 @@
-/** @file */
+#include <stdc.h>
 #include <x11.h>
 #include <io.h>
 #include <X11/extensions/Xinerama.h>
index 0e95c557e86bcf70fc3d849b0af8a7c2e6070ecc..1c0170b0d7da7bc974e83cff064ee6c5280fb3cd 100644 (file)
@@ -1,4 +1,4 @@
-/** @file */
+#include <stdc.h>
 #include <x11.h>
 
 struct XSel {
index aa717ca71d284f25839764518ad3166dc3d13804..2907e3e989276f6f33361ff35e37cfcd43c47fa0 100644 (file)
@@ -1,4 +1,3 @@
-/** @file */
 #include <stdc.h>
 #include <utf.h>
 #include <edit.h>
index 4db071a87feae4f052154425a85c4cc757311c63..1f8b17118245d8cc5c29eb3ffeb669a94257d479 100644 (file)
@@ -1,7 +1,3 @@
-/**
-    @file
-    @ingroup pick
-*/
 #include <stdc.h>
 #include <vec.h>
 #include <x11.h>
index 4629b55c78af7e319ca57b8c45f3fe57af5fcc85..7a4cc345f4e4d894f0c35e035ff16ace95cbf8b0 100644 (file)
@@ -1,7 +1,3 @@
-/**
-    @file
-    @ingroup registrar
-*/
 #include <stdc.h>
 #include <x11.h>
 #include <io.h>
index 40274be45f6bef08dc401e8ef4ea98bf1d8c429b..45e99f55749a4294e70dc4425a5cb72b96e1c1ae 100644 (file)
@@ -1,7 +1,3 @@
-/**
-    @file
-    @ingroup tide
-*/
 #include <stdc.h>
 #include <dbc.h>
 #include <utf.h>
index 98a1402461496110487bfdd66afeaa5b43a55fdd..b5d11e2d31c3805242e7c6be124a15fd59dc96af 100644 (file)
@@ -1,6 +1,6 @@
+#include <stdc.h>
 #include <atf.h>
 #include <qcheck.h>
-#include <stdc.h>
 #include <utf.h>
 #include <edit.h>
 #include "config.h"