especially when compiling stuff on embedded platforms, i find it
terribly annoying having to carry around a ton of C headers.

I wonder if there is interest for an option to ignore
errors on missing #include files (patch attached, as
you see it is really trivial)

The goal would be that an application could carry its own
"system header" as a single file and then be compiled with

tcc -include tcc_system_headers.h -include ignore_include_errors ...

where the first -include specifies the file that replaces
all necessary system headers, and the "-include ignore_include_errors"
is actually trapped by the compiler to ignore errors on missing
headers.

This way putting tcc on an embedded system would be really trivial
in terms of the number of files involved.

cheers
luigi
--- tccpp.c.1	2010-11-02 23:25:03.000000000 +0100
+++ tccpp.c	2010-11-12 17:39:32.000000000 +0100
@@ -1186,6 +1186,8 @@
     }
 }
 
+static int ignore_include_errors;
+
 /* is_bof is true if first non space token at beginning of file */
 static void preprocess(int is_bof)
 {
@@ -1271,6 +1273,10 @@
                 c = '>';
             }
         }
+        if (!strcmp(buf, "ignore_include_errors")) {
+		ignore_include_errors=1;
+		goto include_done;
+	}
 
         if (s1->include_stack_ptr >= s1->include_stack + INCLUDE_STACK_SIZE)
             error("#include recursion too deep");
@@ -1351,6 +1357,7 @@
             ch = file->buf_ptr[0];
             goto the_end;
         }
+	if (!ignore_include_errors)
         error("include file '%s' not found", buf);
 include_done:
         break;
_______________________________________________
Tinycc-devel mailing list
[email protected]
http://lists.nongnu.org/mailman/listinfo/tinycc-devel

Reply via email to