[Tinycc-devel] Re: [PATCH 7/7] tcc -E: Let output_default be file.o instead of a.out

2010-06-20 Thread Kirill Smelkov
On Fri, Jun 18, 2010 at 09:24:28PM +0200, grischka wrote:
 Did you consider pushing the feature(s) on the tinycc mob branch?

Yes. And I though mob was a bit destabilized by last member of union
patches, so I decided not to continue that.

Yes, I've read tinycc.git intro text about mob, and it's really up to
you on how to pick patches. I just though posting by mail is also ok,
and as your comments show, having a look on them before inclusion allows
(hopefully) to merge them in a bit more good shape.

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

Yes. I'm putting it into libtcc API as

LIBTCCAPI const char *tcc_default_target(TCCState *s)

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

Ok,

LIBTCCAPI void tcc_gen_makedeps(TCCState *s, const char *target, const char 
*filename)

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

Yes and thanks. I've though about tcc_fileextension(), but wrongly
decided that it's not for me because call to tcc_basename.

Thanks for suggestions - I'll repost reworked patches soon.


Kirill

___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/tinycc-devel


[Tinycc-devel] Re: [PATCH 7/7] tcc -E: Let output_default be file.o instead of a.out

2010-06-18 Thread grischka

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);


___
Tinycc-devel mailing list
Tinycc-devel@nongnu.org
http://lists.nongnu.org/mailman/listinfo/tinycc-devel