tinycc-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Tinycc-devel] Re: [PATCH 7/7] tcc -E: Let output_default be <file>.o in


From: grischka
Subject: [Tinycc-devel] Re: [PATCH 7/7] tcc -E: Let output_default be <file>.o instead of a.out
Date: Fri, 18 Jun 2010 21:24:28 +0200
User-agent: Thunderbird 2.0.0.23 (Windows/20090812)

Did you consider pushing the feature(s) on the tinycc mob branch?

Some suggestions:

+    /* compute default outfile name */
+    {
+        char *ext;
+
Put that into a function.

+        /* dump collected dependencies */
+        if (gen_deps) {
+          ...
Put that into a function.

+                ext = strrchr(buf, '.');
+                ext = ext ? ext : strchr(buf, 0);
Use tcc_fileextension().

--- grischka

Kirill Smelkov wrote:
This affectes where `tcc -E -MD file.c` will place generated dependency
information -- previously, for `tcc -E` output_default was a.out, and so
deps were put into a.d .

Avoid this behaviour, by treating `tcc -E` as `tcc -c` with respect to
output_default computation.

This will not hurt anything else (preprocessor outputs to either stdout,
or to explicitely given (-o <file>) destination, so no default filename
is used here), and on the other hand `tcc -E -MD file.c` now puts
dependencies into file.d (the same behaviour as for gcc -E).
---
 tcc.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/tcc.c b/tcc.c
index a4b610d..2526d9d 100644
--- a/tcc.c
+++ b/tcc.c
@@ -467,7 +467,9 @@ int main(int argc, char **argv)
             strcpy(ext, ".exe");
         else
 #endif
-        if (output_type == TCC_OUTPUT_OBJ && !reloc_output && *ext)
+        if ((output_type == TCC_OUTPUT_OBJ ||
+             output_type == TCC_OUTPUT_PREPROCESS)
+            && !reloc_output && *ext)
             strcpy(ext, ".o");
         else
             pstrcpy(outfile_default, sizeof(outfile_default), "a.out");



reply via email to

[Prev in Thread] Current Thread [Next in Thread]